12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- require_once "curlexec.php";
- require_once "auth.php";
- $params = [];
- //$params['user_id'] = "023169da-e473-11e2-aaad-ac162db0b20c";
- $params['user_id'] = "0231698c-e473-11e2-aaad-ac162db0b20c";
-
- //$params['work_id'] = "735f7f76-5982-4b82-a60c-3b4a88d0d7eb";
- $params['work_id'] = "9957c42a-234f-4f8e-99e7-1b4f6165a422";
- $url = "http://devplatform.digitaldepot.ru:8085/Thingworx/Things/2050UserLibraryExp/Services/work_measurements";
- $response = CURLrequestPOST($url, '', $params);
- var_dump($response);
- //try {
- // ResponseToMeasurement($response);
- // } catch (\Throwable $e) {
- // echo $e->getMessage();
- // }
- function ResponseToMeasurement($response)
- {
- global $link;
- $json = json_decode($response);
- foreach ($json->data as $item) {
- $comment = json_encode($item->measurement_comment);
- $worker = json_encode($item->worker);
- $compliance = intval($item->value_compliance);
- $is_hw = intval($item->is_hw_measurement);
- $value = floatval($item->measurement_value);
- $complete = intval($item->measurement_complete);
- $qstr = "insert into asusg_measurements
- (
- measurement_id,
- measurement_name,
- characteristic_id,
- characteristic_name,
- measurement_stage,
- measurement_complete,
- measurement_norm,
- measurement_value,
- value_type,
- value_compliance,
- worker,
- measurement_date,
- measurement_comment,
- work_id,
- is_hw_measurement,
- smopp_date_requested
- )
- values
- (
- '$item->measurement_id',
- '$item->measurement_name',
- '$item->characteristic_id',
- '$item->characteristic_name',
- $item->measurement_stage,
- $complete,
- '$item->measurement_norm',
- $value,
- '$item->value_type',
- $compliance,
- '$worker',
- $item->measurement_date,
- '$comment',
- '$item->work_id',
- $is_hw,
- now()
- )";
- mysqli_query($link, $qstr);
- }
- }
|