<?php
// ini_set('display_errors','1');
// error_reporting(E_ALL);
header('Content-Type: application/json; charset=utf-8');
include("../function/func.php");
$data = json_decode(file_get_contents('php://input'), true);
$line = json_encode($data);
$ordersID = $data['orderID'];
$resultCode['retCode'] = 1;
$resultCode['resMessage'] = "";
for($i=0;$i<count($data['test']);$i++){
    if($data['test'][$i]['pressureValue']=='0'){
        $data['test'][$i]['pressureValue']="";
    }
    if($data['test'][$i]['designLoadKgf']=='0'){
        $data['test'][$i]['designLoadKgf']="";
    }
    if($data['test'][$i]['loadKgf']=='0'){
        $data['test'][$i]['loadKgf']="";
    }
    if($data['test'][$i]['destoryLocation']=='0'){
        $data['test'][$i]['destoryLocation']="";
    }
    $testTypeName = $data['test'][$i]['testTypeName'];
    $serialNum = (int)$data['test'][$i]['serialNum'];
    $number = $data['test'][$i]['number'];
    $equipment = $data['test'][$i]['equipment'];
    $type = $data['test'][$i]['type'];
    $info = $data['test'][$i]['info'];
    $forcePercentage = $data['test'][$i]['forcePercentage'];
    $formOfForce = $data['test'][$i]['formOfForce'];
    $direction = $data['test'][$i]['direction'];
    $pressureValue = $data['test'][$i]['pressureValue'];
    $designLoadKgf = $data['test'][$i]['designLoadKgf'];
    $loadKgf = $data['test'][$i]['loadKgf'];
    $destoryLocation = $data['test'][$i]['destoryLocation'];
    $result = createPullTest($testTypeName, $ordersID, $number, $serialNum, $equipment, $type, $info, $forcePercentage, $formOfForce, $direction, $pressureValue, $designLoadKgf, $loadKgf, $destoryLocation);
    if ($result != 1) {
        $resultCode['retCode'] = 0;
        $resultCode['resMessage'] = "here".$data;
        break;
    }
}
echo json_encode($resultCode);
?>
