Initial commit
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
date_default_timezone_set('Europe/Warsaw');
|
||||
require_once("./func.php");
|
||||
require_once("./dbaccess.php");
|
||||
require_once('./polynomial/PolynomialRegression.php' );
|
||||
|
||||
$polacz = mysql_connect($db_host, $db_user, $db_user_pass) or die ('cannot connect to db');
|
||||
mysql_select_db($db_name);
|
||||
mysql_query("SET NAMES utf8");
|
||||
mysql_query("SET CHARACTER_SET utf8_general_ci");
|
||||
?>
|
||||
|
||||
<?php
|
||||
//studnie
|
||||
echo "On Off<br/>";
|
||||
|
||||
mysql_query("delete from seg_wells_manual_work_syndis where SLA_DATETIME<='2016-10-18 23:59:59' and SLA_DRS_ID in (select distinct DRS_ID from a_ademb_wyniki_onoff_02)");
|
||||
mysql_query("delete from seg_dev_resources_det where DRD_RESOURCES_DETAIL=507 and DRD_AUDIT_DATE<='2016-10-18 23:59:59' and DRD_DRS_ID in (select distinct DRS_ID from a_ademb_wyniki_onoff_02)");
|
||||
//mysql_query("delete from seg_dev_resources_det_his where DRD_RESOURCES_DETAIL=507 and DRD_AUDIT_DATE<='2016-10-18 23:59:59' and DRD_DRS_ID in (select distinct DRS_ID from a_ademb_wyniki_onoff_02)");
|
||||
|
||||
unset($wellArray);
|
||||
|
||||
$id=0;
|
||||
$stat = 'OFF';
|
||||
$last='2016-10-01 00:00:00';
|
||||
|
||||
$wellArray = sqlGetResAsArray("select * from a_ademb_wyniki_onoff_02 where data_pom<='2016-10-18 23:59:59' order by WLL_ID,data_pom");
|
||||
for($i=0; $i<count($wellArray); $i++)
|
||||
{
|
||||
if ($id!=$wellArray[$i]['DRS_ID'])
|
||||
{
|
||||
$stat = 'OFF';
|
||||
$id=$wellArray[$i]['DRS_ID'];
|
||||
$last='2016-10-01 00:00:00';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// if ($stat!=$wellArray[$i]['ONOFF'] && ((strtotime($wellArray[$i]['data_pom']) - strtotime($last))/3600)>1)
|
||||
if ($stat!=$wellArray[$i]['ONOFF'] && $last!=$wellArray[$i]['data_pom'])
|
||||
{
|
||||
// wstawia do tabeli do obliczeń czasu pracy
|
||||
mysql_query("INSERT INTO seg_wells_manual_work_syndis SET SLA_WLL_ID=".$wellArray[$i]['WLL_ID'].",SLA_DRS_ID=".$wellArray[$i]['DRS_ID'].",SLA_NAME='".$wellArray[$i]['WLL_NAME']."',SLA_WORK_STATUS='".$wellArray[$i]['ONOFF']."',SLA_DATETIME='".$wellArray[$i]['data_pom']."',SLA_AUDIT_CD=now()");
|
||||
|
||||
// wstawia do tabeli details
|
||||
mysql_query("INSERT INTO seg_dev_resources_det SET DRD_DRS_ID=".$wellArray[$i]['DRS_ID'].",DRD_RESOURCES_DETAIL=507,DRD_VALUE='".$wellArray[$i]['ONOFF']."',DRD_EXPORT_SEGAP='1',DRD_AUDIT_USR='SYNDIS',DRD_AUDIT_DATE='".$wellArray[$i]['data_pom']."'");
|
||||
|
||||
|
||||
echo "Studnia: ".$wellArray[$i]['WLL_NAME']." zmieniła status na: ".$wellArray[$i]['ONOFF'].", data: ".$wellArray[$i]['data_pom']."<br/>";
|
||||
$stat=$wellArray[$i]['ONOFF'];
|
||||
$last = $wellArray[$i]['data_pom'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
mysql_close($polacz);
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user