New Preorderstatus handling at import
This commit is contained in:
@@ -243,6 +243,7 @@ foreach ($clusters as $cluster_data) {
|
||||
}
|
||||
$hausnummer_found_count++;
|
||||
|
||||
$hausnummer_id = $hausnummer->id;
|
||||
/*
|
||||
* Set Building Status based on Operational-/Executionstate
|
||||
*/
|
||||
@@ -254,18 +255,23 @@ foreach ($clusters as $cluster_data) {
|
||||
if($b_executionstate_label != $hausnummer->rimo_ex_state) {
|
||||
$hausnummer->rimo_ex_state = $b_executionstate_label;
|
||||
$hausnummer->save();
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
}
|
||||
if($b_operationalstate_label != $hausnummer->rimo_op_state) {
|
||||
$hausnummer->rimo_op_state = $b_operationalstate_label;
|
||||
$hausnummer->save();
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
}
|
||||
|
||||
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();
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
}
|
||||
|
||||
\mfValuecache::singleton()->set("adbhausnummer-save-nesting-level-".$hausnummer->id, 0);
|
||||
|
||||
$last_unit_num = 0;
|
||||
$existing_units = [];
|
||||
$existing_units_extref = [];
|
||||
@@ -300,6 +306,7 @@ foreach ($clusters as $cluster_data) {
|
||||
$rimo_home_count = count($building->homes->item);
|
||||
|
||||
foreach ($building->homes->item as $home) {
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
//print_r($home);exit;
|
||||
$homes_count++;
|
||||
$home_rimo_id = $home->id;
|
||||
@@ -325,6 +332,8 @@ foreach ($clusters as $cluster_data) {
|
||||
if (!$unit->save()) {
|
||||
die("Error saving new unit\n" . print_r($home, true));
|
||||
}
|
||||
\mfValuecache::singleton()->set("adbhausnummer-save-nesting-level-".$hausnummer->id, 0);
|
||||
\mfValuecache::singleton()->set("adbwohneinheit-save-nesting-level-".$unit->id, 0);
|
||||
}
|
||||
|
||||
if ($unit->extref != $home_rimo_id) {
|
||||
@@ -332,19 +341,27 @@ foreach ($clusters as $cluster_data) {
|
||||
if (!$unit->save()) {
|
||||
die("Error saving new extref on unit\n" . print_r($home, true));
|
||||
}
|
||||
\mfValuecache::singleton()->set("adbhausnummer-save-nesting-level-".$hausnummer->id, 0);
|
||||
\mfValuecache::singleton()->set("adbwohneinheit-save-nesting-level-".$unit->id, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: Status based on execution-/operational-state
|
||||
* TODO: Status based on execution-/operationalstate
|
||||
*/
|
||||
|
||||
if($home->executionState->userLabel != $unit->rimo_ex_state) {
|
||||
$unit->rimo_ex_state = $home->executionState->userLabel;
|
||||
$unit->save();
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
\mfValuecache::singleton()->set("adbhausnummer-save-nesting-level-".$hausnummer->id, 0);
|
||||
\mfValuecache::singleton()->set("adbwohneinheit-save-nesting-level-".$unit->id, 0);
|
||||
}
|
||||
if($home->operationalState->userLabel != $unit->rimo_op_state) {
|
||||
$unit->rimo_op_state = $home->operationalState->userLabel;
|
||||
$unit->save();
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
\mfValuecache::singleton()->set("adbhausnummer-save-nesting-level-".$hausnummer->id, 0);
|
||||
\mfValuecache::singleton()->set("adbwohneinheit-save-nesting-level-".$unit->id, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -523,6 +540,8 @@ foreach ($clusters as $cluster_data) {
|
||||
if ($wo) {
|
||||
//echo "Updating Workorder $rimo_workorder_id ($workorder_home_id)\n";
|
||||
if ($workorder_status != $wo->rimo_status) {
|
||||
\mfValuecache::singleton()->set("adbhausnummer-save-nesting-level-".$hausnummer->id, 0);
|
||||
\mfValuecache::singleton()->set("adbwohneinheit-save-nesting-level-".$unit->id, 0);
|
||||
$wo->rimo_status = $workorder_status;
|
||||
$wo->save();
|
||||
}
|
||||
@@ -544,6 +563,8 @@ foreach ($clusters as $cluster_data) {
|
||||
continue;
|
||||
}
|
||||
|
||||
\mfValuecache::singleton()->set("adbhausnummer-save-nesting-level-".$hausnummer->id, 0);
|
||||
\mfValuecache::singleton()->set("adbwohneinheit-save-nesting-level-".$unit->id, 0);
|
||||
//echo "Creating Workorder $rimo_workorder_id ($workorder_home_id)\n";
|
||||
$wo = \RimoWorkorderModel::create([
|
||||
"adb_wohneinheit_id" => $wo_home->id,
|
||||
@@ -595,6 +616,7 @@ foreach ($clusters as $cluster_data) {
|
||||
if ($hausnummer->home_trench != $home_trench) {
|
||||
$hausnummer->home_trench = json_encode($home_trench);
|
||||
$hausnummer->save();
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -611,6 +633,7 @@ foreach ($clusters as $cluster_data) {
|
||||
$hausnummer->borderpoint_lat = $lat;
|
||||
$hausnummer->borderpoint_long = $long;
|
||||
$hausnummer->save();
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -631,6 +654,7 @@ foreach ($clusters as $cluster_data) {
|
||||
//var_dump($trenches);exit;
|
||||
$hausnummer->trenches = json_encode($trenches);
|
||||
$hausnummer->save();
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user