Эх сурвалжийг харах

2020-06-12 / ct_chen

Actions:
1. Webservice modify UI

Files:
1. as list
ct_chen 4 жил өмнө
parent
commit
aca9586e18

+ 9 - 9
EVSE/Modularization/WebService.c

@@ -359,6 +359,7 @@ int main(int argc, char *argv[]) {
 			json_object *val_obj = NULL;
 			char *SystemId=NULL;
 			char *SystemDateTime = NULL;
+			int PhaseLossPolicy = 0;
 			int FactoryConfiguration = 0;
 			int AuthorisationMode = 0;
 			int RfidCardNumEndian = 0;
@@ -375,6 +376,9 @@ int main(int argc, char *argv[]) {
 			if( json_object_object_get_ex(jobj, "SystemDateTime", &val_obj) ) {
 				SystemDateTime = (char*)json_object_get_string(val_obj);
 			}
+			if( json_object_object_get_ex(jobj, "PhaseLossPolicy", &val_obj) ) {
+				PhaseLossPolicy = json_object_get_int(val_obj);
+			}
 			if( json_object_object_get_ex(jobj, "FactoryConfiguration", &val_obj) ) {
 				FactoryConfiguration = json_object_get_int(val_obj);
 			}
@@ -403,6 +407,7 @@ int main(int argc, char *argv[]) {
 				QRCodeContent = json_object_get_string(val_obj);
 			}
 			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemId,SystemId);
+			ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy = PhaseLossPolicy;
 			ShmSysConfigAndInfo->SysInfo.FactoryConfiguration = FactoryConfiguration;
 			ShmSysConfigAndInfo->SysConfig.AuthorisationMode = AuthorisationMode;
 			ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian = RfidCardNumEndian;
@@ -430,7 +435,6 @@ int main(int argc, char *argv[]) {
 			int MaxChargingCurrent = 0;
 			int AcMaxChargingCurrent = 0;
 			int MaxChargingDuration = 0;
-			int PhaseLossPolicy = 0;
 			char *LocalWhiteCard0 = NULL;
 			char *LocalWhiteCard1 = NULL;
 			char *LocalWhiteCard2 = NULL;
@@ -483,9 +487,6 @@ int main(int argc, char *argv[]) {
 			if( json_object_object_get_ex(jobj, "MaxChargingDuration", &val_obj) ) {
 				MaxChargingDuration = json_object_get_int(val_obj);
 			}
-			if( json_object_object_get_ex(jobj, "PhaseLossPolicy", &val_obj) ) {
-				PhaseLossPolicy = json_object_get_int(val_obj);
-			}
 			if( json_object_object_get_ex(jobj, "LocalWhiteCard0", &val_obj) ) {
 				LocalWhiteCard0 = (char*)json_object_get_string(val_obj);
 			}
@@ -599,7 +600,6 @@ int main(int argc, char *argv[]) {
 			ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent = MaxChargingCurrent;
 			ShmSysConfigAndInfo->SysConfig.AcMaxChargingCurrent = AcMaxChargingCurrent;
 			ShmSysConfigAndInfo->SysConfig.MaxChargingDuration = MaxChargingDuration;
-			ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy = PhaseLossPolicy;
 			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0],LocalWhiteCard0);
 			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1],LocalWhiteCard1);
 			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2],LocalWhiteCard2);
@@ -793,6 +793,7 @@ int main(int argc, char *argv[]) {
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemId, "1234567890");
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemDateTime, "2019-12-31 23:59:59");
 		ShmSysConfigAndInfo->SysConfig.AcPhaseCount=1;
+		ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy=0;
 		ShmSysConfigAndInfo->SysInfo.FactoryConfiguration=0;
 		ShmSysConfigAndInfo->SysConfig.AuthorisationMode=0;
 		ShmSysConfigAndInfo->SysConfig.DefaultLanguage=0;
@@ -845,7 +846,6 @@ int main(int argc, char *argv[]) {
 		ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent= 0;
 		ShmSysConfigAndInfo->SysConfig.AcMaxChargingCurrent= 0;
 		ShmSysConfigAndInfo->SysConfig.MaxChargingDuration=0;
-		ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy=0;
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0], "111");
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1], "222");
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2], "333");
@@ -1056,6 +1056,7 @@ int main(int argc, char *argv[]) {
 		struct json_object *SerialNumber;
 		struct json_object *SystemId;
 		struct json_object *AcPhaseCount;
+		struct json_object *PhaseLossPolicy;
 		struct json_object *FactoryConfiguration;
 		struct json_object *AuthorisationMode;
 		struct json_object *DefaultLanguage;
@@ -1117,7 +1118,6 @@ int main(int argc, char *argv[]) {
 		struct json_object *MaxChargingCurrent;
 		struct json_object *AcMaxChargingCurrent;
 		struct json_object *MaxChargingDuration;
-		struct json_object *PhaseLossPolicy;
 		struct json_object *LocalWhiteCard[10];
 		struct json_object *LocalWhiteCardArr= json_object_new_array();
 		struct json_object *isBilling;
@@ -1201,6 +1201,7 @@ int main(int argc, char *argv[]) {
 		SerialNumber = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.SerialNumber);
 		SystemId = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.SystemId);
 		AcPhaseCount = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcPhaseCount);
+		PhaseLossPolicy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy);
 		FactoryConfiguration = json_object_new_int(ShmSysConfigAndInfo->SysInfo.FactoryConfiguration);
 		AuthorisationMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AuthorisationMode);
 		DefaultLanguage = json_object_new_int(ShmSysConfigAndInfo->SysConfig.DefaultLanguage);
@@ -1274,7 +1275,6 @@ int main(int argc, char *argv[]) {
 		MaxChargingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
 		AcMaxChargingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcMaxChargingCurrent);
 		MaxChargingDuration = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingDuration);
-		PhaseLossPolicy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy);
 		LocalWhiteCard[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0]);
 		LocalWhiteCard[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1]);
 		LocalWhiteCard[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2]);
@@ -1633,6 +1633,7 @@ int main(int argc, char *argv[]) {
 		json_object_object_add(jobj1,"SerialNumber",SerialNumber);
 		json_object_object_add(jobj1,"SystemId",SystemId);
 		json_object_object_add(jobj1,"AcPhaseCount",AcPhaseCount);
+		json_object_object_add(jobj2,"PhaseLossPolicy",PhaseLossPolicy);
 		json_object_object_add(jobj1,"FactoryConfiguration",FactoryConfiguration);
 		json_object_object_add(jobj1,"AuthorisationMode",AuthorisationMode);
 		json_object_object_add(jobj1,"DefaultLanguage",DefaultLanguage);
@@ -1697,7 +1698,6 @@ int main(int argc, char *argv[]) {
 		json_object_object_add(jobj2,"MaxChargingCurrent",MaxChargingCurrent);
 		json_object_object_add(jobj2,"AcMaxChargingCurrent",AcMaxChargingCurrent);
 		json_object_object_add(jobj2,"MaxChargingDuration",MaxChargingDuration);
-		json_object_object_add(jobj2,"PhaseLossPolicy",PhaseLossPolicy);
 		json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[0]);
 		json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[1]);
 		json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[2]);

+ 6 - 6
EVSE/rootfs/var/www/head.php

@@ -72,6 +72,11 @@
 		$showWifi="none";
 		$showTelcom="block";
 	}
+	if(substr($model,10,1)=="D"){
+		$showEthernet="block";
+		$showWifi="block";
+		$showTelcom="block";
+	}
 	
 	//$ModelName='AC Net';
 	 //$ModelName='AC Eco';
@@ -225,12 +230,7 @@
 					</ul> 
 				</li>
 				<li<?php echo ($tag_header=='upgrade'?' class="active"':''); ?>>
-					<a href="#" accesskey="2" title="Upgrade"><?php echo $lang->showWord("upgrade"); ?></a>
-					<ul>	
-						<li>
-						  <a href="upgrade_iso.php"><?php echo "Image"; ?></a>
-						</li>
-					</ul> 
+					<a href="upgrade_iso.php" accesskey="2" title="Upgrade"><?php echo $lang->showWord("upgrade"); ?></a>
 				</li>
 				<li<?php echo ($tag_header=='other'?' class="active"':''); ?>>
 					<a href="#" accesskey="3" title="Other"><?php echo $lang->showWord("other"); ?></a>

+ 94 - 45
EVSE/rootfs/var/www/set_charging.php

@@ -279,42 +279,35 @@ img {
 									<header><?php echo $lang->showWord("charging_relevant_parameters"); ?><i class="fa fa-plus"></i></header>
 									<section>
 										<div class="form-group" style="display:<?php echo $am111;?>">
-											<label>Max Charging Energy</label>
+											<label id="MaxChargingEnergyLbl">Max Charging Energy</label>
 											<small class="form-text text-muted-red">kWh</small>
-											<input type="text" name="MaxChargingEnergy" id="MaxChargingEnergy" class="form-control" value="<?php echo $obj['MaxChargingEnergy'];?>" placeholder="<?php echo ($obj['MaxChargingEnergy']==0||$obj['MaxChargingEnergy']=="")?"'0' means unlimit":"";?>" title="'0' means unlimit" onchange="MaxValue_changed(document.getElementById('MaxChargingEnergy').id,document.getElementById('MaxChargingEnergyText').id);">
+											<input type="text" name="MaxChargingEnergy" id="MaxChargingEnergy" class="form-control" value="<?php echo $obj['MaxChargingEnergy'];?>" placeholder="<?php echo ($obj['MaxChargingEnergy']==0||$obj['MaxChargingEnergy']=="")?"'0' means unlimit":"";?>" title="'0' means unlimit">
 											<small class="form-text text-muted-red"><label id="MaxChargingEnergyText" style="display:none;">'0' means unlimit</label></small>
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
-											<label>Max Charging Power</label>
+											<label id="MaxChargingPowerLbl">Max Charging Power</label>
 											<small class="form-text text-muted-red">kW</small>
-											<input type="text" name="MaxChargingPower" id="MaxChargingPower" class="form-control" value="<?php echo $obj['MaxChargingPower'];?>" placeholder="<?php echo ($obj['MaxChargingPower']==0||$obj['MaxChargingPower']=="")?"'0' means unlimit":"";?>" title="'0' means unlimit" onchange="MaxValue_changed(document.getElementById('MaxChargingPower').id,document.getElementById('MaxChargingPowerText').id);">
+											<input type="text" name="MaxChargingPower" id="MaxChargingPower" class="form-control" value="<?php echo $obj['MaxChargingPower'];?>" placeholder="<?php echo ($obj['MaxChargingPower']==0||$obj['MaxChargingPower']=="")?"'0' means unlimit":"";?>" title="'0' means unlimit">
 											<input type="hidden" name="RatingPower" id="RatingPower" value="<?php echo $RatingPower;?>">
 											<small class="form-text text-muted-red"><label id="MaxChargingPowerText" style="display:none;">'0' means unlimit</label></small>
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label id="MaxChargingCurrentLbl">Max Charging Current</label>
 											<small class="form-text text-muted-red">amp</small>
-											<input type="text" name="MaxChargingCurrent" id="MaxChargingCurrent" class="form-control" value="<?php echo $obj['MaxChargingCurrent'];?>" placeholder="<?php echo ($obj['MaxChargingCurrent']==0||$obj['MaxChargingCurrent']=="")?"'0' means unlimit":"";?>" title="'0' means unlimit" onchange="MaxValue_changed(document.getElementById('MaxChargingCurrent').id,document.getElementById('MaxChargingCurrentText').id);">
+											<input type="text" name="MaxChargingCurrent" id="MaxChargingCurrent" class="form-control" value="<?php echo $obj['MaxChargingCurrent'];?>" placeholder="<?php echo ($obj['MaxChargingCurrent']==0||$obj['MaxChargingCurrent']=="")?"'0' means unlimit":"";?>" title="'0' means unlimit">
 											<input type="hidden" name="RatingCurrent" id="RatingCurrent" value="<?php echo $RatingCurrent;?>">
 											<small class="form-text text-muted-red"><label id="MaxChargingCurrentText" style="display:none;">'0' means unlimit</label></small>
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
-											<label>Max Charging Duration</label>
+											<label id="MaxChargingDurationLbl">Max Charging Duration</label>
 											<small class="form-text text-muted-red">minutes</small>
-											<input type="text" name="MaxChargingDuration" id="MaxChargingDuration" class="form-control" value="<?php echo $obj['MaxChargingDuration'];?>" placeholder="<?php echo ($obj['MaxChargingDuration']==0||$obj['MaxChargingDuration']=="")?"'0' means unlimit":"";?>" title="'0' means unlimit" onchange="MaxValue_changed(document.getElementById('MaxChargingDuration').id,document.getElementById('MaxChargingDurationText').id);">
+											<input type="text" name="MaxChargingDuration" id="MaxChargingDuration" class="form-control" value="<?php echo $obj['MaxChargingDuration'];?>" placeholder="<?php echo ($obj['MaxChargingDuration']==0||$obj['MaxChargingDuration']=="")?"'0' means unlimit":"";?>" title="'0' means unlimit">
 											<small class="form-text text-muted-red"><label id="MaxChargingDurationText" style="display:none;">'0' means unlimit</label></small>
 										</div>
-										<div class="form-group" style="display:<?php echo $am001;?>">
-											<label>AC Phase Loss Policy</label>
-											<select class="form-control" id="PhaseLossPolicy" name="PhaseLossPolicy">
-												<option value="0" <?php echo $obj['PhaseLossPolicy']=="0"?"selected":""?>>de-rating</option>
-												<option value="1" <?php echo $obj['PhaseLossPolicy']=="1"?"selected":""?>>stop charging</option>
-											</select>
-										</div>
 										<div class="form-group" id="AcMaxChargingCurrentDiv">
 											<label>AC Max Charging Current</label>
 											<small class="form-text text-muted-red">amp</small>
-											<input type="text" name="AcMaxChargingCurrent" id="AcMaxChargingCurrent" class="form-control" value="<?php echo $obj['AcMaxChargingCurrent'];?>" placeholder="<?php echo ($obj['AcMaxChargingCurrent']==0||$obj['AcMaxChargingCurrent']=="")?"'0' means unlimit":"";?>" title="'0' means unlimit" onchange="MaxValue_changed(document.getElementById('AcMaxChargingCurrent').id,document.getElementById('AcMaxChargingCurrentText').id);">
+											<input type="text" name="AcMaxChargingCurrent" id="AcMaxChargingCurrent" class="form-control" value="<?php echo $obj['AcMaxChargingCurrent'];?>" placeholder="<?php echo ($obj['AcMaxChargingCurrent']==0||$obj['AcMaxChargingCurrent']=="")?"'0' means unlimit":"";?>" title="'0' means unlimit">
 											<input type="hidden" name="AcRatingCurrent" id="AcRatingCurrent" value="<?php echo $AcRatingCurrent;?>">
 											<small class="form-text text-muted-red"><label id="AcMaxChargingCurrentText" style="display:none;">'0' means unlimit</label></small>
 										</div>
@@ -573,22 +566,22 @@ img {
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>Present Charging Voltage</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['PresentChargingVoltage'];?> volt">
+											<input type="text" readonly class="form-control" placeholder="<?php echo round($obj['ChargingInfo1']['PresentChargingVoltage'],2);?> volt">
 											<input type="hidden" name="PresentChargingVoltage1" id="PresentChargingVoltage1" value="<?php echo $obj['ChargingInfo1']['PresentChargingVoltage'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Present Charging Current</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['PresentChargingCurrent'];?> amp">
+											<input type="text" readonly class="form-control" placeholder="<?php echo round($obj['ChargingInfo1']['PresentChargingCurrent'],2);?> amp">
 											<input type="hidden" name="PresentChargingCurrent1" id="PresentChargingCurrent1" value="<?php echo $obj['ChargingInfo1']['PresentChargingCurrent'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Present Charging Power</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['PresentChargingPower'];?> kW">
+											<input type="text" readonly class="form-control" placeholder="<?php echo round($obj['ChargingInfo1']['PresentChargingPower'],2);?> kW">
 											<input type="hidden" name="PresentChargingPower1" id="PresentChargingPower1" value="<?php echo $obj['ChargingInfo1']['PresentChargingPower'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Present Charging Energy</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['PresentChargedEnergy'];?> kWh">
+											<input type="text" readonly class="form-control" placeholder="<?php echo round($obj['ChargingInfo1']['PresentChargedEnergy'],2);?> kWh">
 											<input type="hidden" name="PresentChargedEnergy1" id="PresentChargedEnergy1" value="<?php echo $obj['ChargingInfo1']['PresentChargedEnergy'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
@@ -603,12 +596,12 @@ img {
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>EV Battery Max Voltage</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['EvBatteryMaxVoltage'];?> volt">
+											<input type="text" readonly class="form-control" placeholder="<?php echo round($obj['ChargingInfo1']['EvBatteryMaxVoltage'],2);?> volt">
 											<input type="hidden" name="EvBatteryMaxVoltage1" id="EvBatteryMaxVoltage1" value="<?php echo $obj['ChargingInfo1']['EvBatteryMaxVoltage'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
 											<label>EV Battery Target Voltage</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj['ChargingInfo1']['EvBatterytargetVoltage'];?> volt">
+											<input type="text" readonly class="form-control" placeholder="<?php echo round($obj['ChargingInfo1']['EvBatterytargetVoltage'],2);?> volt">
 											<input type="hidden" name="EvBatterytargetVoltage1" id="EvBatterytargetVoltage1" value="<?php echo $obj['ChargingInfo1']['EvBatterytargetVoltage'];?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
@@ -819,12 +812,55 @@ img {
 			if(document.getElementById("AcMaxChargingCurrent").value=="0" || document.getElementById("AcMaxChargingCurrent").value==""){
 				document.getElementById("AcMaxChargingCurrentText").style.display="block";
 			}
+			document.getElementById("MaxChargingEnergyLbl").innerHTML="DC MaxCharging Energy";
+			document.getElementById("MaxChargingPowerLbl").innerHTML="DC MaxCharging Power";
 			document.getElementById("MaxChargingCurrentLbl").innerHTML="DC MaxCharging Current";
+			document.getElementById("MaxChargingDurationLbl").innerHTML="DC MaxCharging Duration";
 		}
 		else{
 			document.getElementById("AcMaxChargingCurrentDiv").style.display="none";
 		}
 		isBilling_clicked();
+		document.getElementById("MaxChargingEnergy").addEventListener("change", function() {
+			if(document.getElementById(this.id).value == "0" || document.getElementById(this.id).value == ""){
+				document.getElementById(this.id+"Text").style.display="block";
+			}
+			else{
+				document.getElementById(this.id+"Text").style.display="none";
+			}
+		});
+		document.getElementById("MaxChargingPower").addEventListener("change", function() {
+			if(document.getElementById(this.id).value == "0" || document.getElementById(this.id).value == ""){
+				document.getElementById(this.id+"Text").style.display="block";
+			}
+			else{
+				document.getElementById(this.id+"Text").style.display="none";
+			}
+		});
+		document.getElementById("MaxChargingCurrent").addEventListener("change", function() {
+			if(document.getElementById(this.id).value == "0" || document.getElementById(this.id).value == ""){
+				document.getElementById(this.id+"Text").style.display="block";
+			}
+			else{
+				document.getElementById(this.id+"Text").style.display="none";
+			}
+		});
+		document.getElementById("MaxChargingDuration").addEventListener("change", function() {
+			if(document.getElementById(this.id).value == "0" || document.getElementById(this.id).value == ""){
+				document.getElementById(this.id+"Text").style.display="block";
+			}
+			else{
+				document.getElementById(this.id+"Text").style.display="none";
+			}
+		});
+		document.getElementById("AcMaxChargingCurrent").addEventListener("change", function() {
+			if(document.getElementById(this.id).value == "0" || document.getElementById(this.id).value == ""){
+				document.getElementById(this.id+"Text").style.display="block";
+			}
+			else{
+				document.getElementById(this.id+"Text").style.display="none";
+			}
+		});
 	});
 
 	document.getElementById("save").onclick = function() {
@@ -842,7 +878,6 @@ img {
 						"&MaxChargingCurrent=" + document.getElementById("MaxChargingCurrent").value+
 						"&AcMaxChargingCurrent=" + document.getElementById("AcMaxChargingCurrent").value+
 						"&MaxChargingDuration=" + document.getElementById("MaxChargingDuration").value+
-						"&PhaseLossPolicy=" + document.getElementById("PhaseLossPolicy").value+
 						"&LocalWhiteCard0=" + document.getElementById("LocalWhiteCard0").value+
 						"&LocalWhiteCard1=" + document.getElementById("LocalWhiteCard1").value+
 						"&LocalWhiteCard2=" + document.getElementById("LocalWhiteCard2").value+
@@ -991,6 +1026,12 @@ img {
 				return false;
 			}
 		}
+		if(MaxChargingEnergy =="")
+		{
+			alert("Fill Max Charging Energy !");
+			document.getElementById("MaxChargingEnergy").focus();
+			return false;
+		}
 		if(MaxChargingEnergy >65535)
 		{
 			alert("Max Charging Energy must <= 65535!");
@@ -1003,16 +1044,10 @@ img {
 			document.getElementById("MaxChargingEnergy").focus();
 			return false;
 		}
-		if(AcMaxChargingCurrent >65535)
-		{
-			alert("Ac Max Charging Current must <= 65535!");
-			document.getElementById("AcMaxChargingCurrent").focus();
-			return false;
-		}
-		if(AcMaxChargingCurrent < 0)
+		if(MaxChargingPower =="")
 		{
-			alert("Ac Max Charging Current must >= 0!");
-			document.getElementById("AcMaxChargingCurrent").focus();
+			alert("Fill Max Charging Power !");
+			document.getElementById("MaxChargingPower").focus();
 			return false;
 		}
 		if(RatingPower!="" && RatingPower!=0){
@@ -1031,10 +1066,10 @@ img {
 				return false;
 			}
 		}
-		if(MaxChargingPower < 0)
+		if(MaxChargingCurrent =="")
 		{
-			alert("Max Charging Power must >= 0!");
-			document.getElementById("MaxChargingPower").focus();
+			alert("Fill Max Charging Current !");
+			document.getElementById("MaxChargingCurrent").focus();
 			return false;
 		}
 		if(RatingCurrent!="" && RatingCurrent!=0){
@@ -1053,6 +1088,12 @@ img {
 				return false;
 			}
 		}
+		if(document.getElementById("ModelName").value.substr(8,1)!= "0" && AcMaxChargingCurrent =="")
+		{
+			alert("Fill AC Max Charging Current !");
+			document.getElementById("AcMaxChargingCurrent").focus();
+			return false;
+		}
 		if(AcRatingCurrent!="" && AcRatingCurrent!=0){
 			if(parseFloat(AcMaxChargingCurrent) > parseFloat(AcRatingCurrent))
 			{
@@ -1068,6 +1109,18 @@ img {
 				document.getElementById("AcMaxChargingCurrent").focus();
 				return false;
 			}
+			if(AcMaxChargingCurrent < 0)
+			{
+				alert("Ac Max Charging Current must >= 0!");
+				document.getElementById("AcMaxChargingCurrent").focus();
+				return false;
+			}
+		}
+		if(MaxChargingCurrent =="")
+		{
+			alert("Fill Max Charging Current !");
+			document.getElementById("MaxChargingCurrent").focus();
+			return false;
 		}
 		if(MaxChargingCurrent < 0)
 		{
@@ -1077,7 +1130,13 @@ img {
 		}
 		if(MaxChargingDuration >65535)
 		{
-		    alert("MaxChargingDuration must <= 65535!");
+			alert("MaxChargingDuration must <= 65535!");
+			document.getElementById("MaxChargingDuration").focus();
+			return false;
+		}
+		if(MaxChargingDuration =="")
+		{
+			alert("Fill Max Charging Duration !");
 			document.getElementById("MaxChargingDuration").focus();
 			return false;
 		}
@@ -1090,16 +1149,6 @@ img {
 		
 		return true;
 	}
-
-	function MaxValue_changed(id,id2){
-		if(document.getElementById(id).value == "0" || document.getElementById(id).value == ""){
-			document.getElementById(id2).style.display="block";
-		}
-		else{
-			document.getElementById(id2).style.display="none";
-		}
-	}
-
 	function isBilling_clicked(){
 		if(document.getElementById("isBilling").checked){
 			document.getElementById("CurrencyDiv").style.display="block";

+ 0 - 2
EVSE/rootfs/var/www/set_charging_action.php

@@ -27,7 +27,6 @@
 		checkMaxValue("MaxChargingCurrent");
 		checkMaxValue("AcMaxChargingCurrent");
 		checkMaxValue("MaxChargingDuration");
-		checkValue("PhaseLossPolicy");
 //		$json = json_decode(file_get_contents("charging.txt"), true);
 //		$json = string[];
 		$json['MaxChargingEnergy']			= (int)$_POST['MaxChargingEnergy'];
@@ -35,7 +34,6 @@
 		$json['MaxChargingCurrent']			= (int)$_POST['MaxChargingCurrent'];
 		$json['AcMaxChargingCurrent']		= (int)$_POST['AcMaxChargingCurrent'];
 		$json['MaxChargingDuration'] 		= (int)$_POST['MaxChargingDuration'];
-		$json['PhaseLossPolicy']			= (int)$_POST['PhaseLossPolicy'];
 		$json['LocalWhiteCard0']			= isset($_POST['LocalWhiteCard0'])?$_POST['LocalWhiteCard0']:"";
 		$json['LocalWhiteCard1']	 		= isset($_POST['LocalWhiteCard1'])?$_POST['LocalWhiteCard1']:"";
 		$json['LocalWhiteCard2']			= isset($_POST['LocalWhiteCard2'])?$_POST['LocalWhiteCard2']:"";

+ 63 - 3
EVSE/rootfs/var/www/set_network.php

@@ -3,6 +3,9 @@
 	$tag_header = 'set';
 	include 'head.php';
 	$obj = json_decode(trim($output[2]));//var_dump($obj);
+	$system = json_decode(trim($output[0]),true);//var_dump($obj);
+	$ModelName = $system['ModelName'];
+	$SerialNumber = $system['SerialNumber'];
 	$InternetConn='';
 	switch ($obj->{'InternetConn'}){
 		case 0:
@@ -121,7 +124,7 @@ img {
 									<section>
 										<div class="form-group">
 											<label>DHCP Client</label>
-											<select class="form-control" id="Eth0DhcpClient" name="Eth0DhcpClient">
+											<select class="form-control" id="Eth0DhcpClient" name="Eth0DhcpClient" onchange="EthDhcp_changed();">
 												<option value="0" <?php echo $obj->{'Eth0DhcpClient'}=="0"?"selected":""?>>enable</option>
 												<option value="1" <?php echo $obj->{'Eth0DhcpClient'}=="1"?"selected":""?>>disable</option>
 											</select>
@@ -210,7 +213,7 @@ img {
 										</div>
 										<div class="form-group">
 											<label>DHCP Client</label>
-											<select class="form-control" id="WifiDhcpClient" name="WifiDhcpClient">
+											<select class="form-control" id="WifiDhcpClient" name="WifiDhcpClient" onchange="WifiDhcp_changed();">
 												<option value="0" <?php echo $obj->{'WifiDhcpClient'}=="0"?"selected":""?>>enable</option>
 												<option value="1" <?php echo $obj->{'WifiDhcpClient'}=="1"?"selected":""?>>disable</option>
 											</select>
@@ -340,6 +343,8 @@ img {
 <script type="text/JavaScript">
 	$(document).ready(function(){
 		WifiMode_changed();
+		EthDhcp_changed();
+		WifiDhcp_changed();
 	});
 
 	document.getElementById("save").onclick = function() {
@@ -441,6 +446,12 @@ img {
 			document.getElementById("WifiPassword").disabled=true;
 			document.getElementById("WifiSsid").value="";
 			document.getElementById("WifiPassword").value="";
+			document.getElementById("WifiIpAddress").disabled=true;
+			document.getElementById("WifiSubmaskAddress").disabled=true;
+			document.getElementById("WifiGatewayAddress").disabled=true;
+			document.getElementById("WifiIpAddress").value="";
+			document.getElementById("WifiSubmaskAddress").value="";
+			document.getElementById("WifiGatewayAddress").value="";
 		}
 		if(document.getElementById("WifiMode").value=="1"){
 			document.getElementById("WifiDhcpServer").disabled=true;
@@ -451,6 +462,12 @@ img {
 			document.getElementById("WifiPassword").disabled=false;
 			document.getElementById("WifiSsid").value="<?php echo $obj->{'WifiSsid'};?>";
 			document.getElementById("WifiPassword").value="<?php echo $obj->{'WifiPassword'};?>";
+			document.getElementById("WifiIpAddress").disabled=false;
+			document.getElementById("WifiSubmaskAddress").disabled=false;
+			document.getElementById("WifiGatewayAddress").disabled=false;
+			document.getElementById("WifiIpAddress").value="<?php echo $obj->{'WifiIpAddress'};?>";
+			document.getElementById("WifiSubmaskAddress").value="<?php echo $obj->{'WifiSubmaskAddress'};?>";
+			document.getElementById("WifiGatewayAddress").value="<?php echo $obj->{'WifiGatewayAddress'};?>";
 		}
 		if(document.getElementById("WifiMode").value=="2"){
 			document.getElementById("WifiDhcpServer").disabled=false;
@@ -459,8 +476,51 @@ img {
 //			document.getElementById("WifiDhcpClient").selectedIndex=1;
 			document.getElementById("WifiSsid").disabled=true;
 			document.getElementById("WifiPassword").disabled=true;
-			document.getElementById("WifiSsid").value="";
+			document.getElementById("WifiSsid").value="<?php echo $ModelName.$SerialNumber?>";
 			document.getElementById("WifiPassword").value="";
+			document.getElementById("WifiIpAddress").disabled=true;
+			document.getElementById("WifiSubmaskAddress").disabled=true;
+			document.getElementById("WifiGatewayAddress").disabled=true;
+			document.getElementById("WifiIpAddress").value="";
+			document.getElementById("WifiSubmaskAddress").value="";
+			document.getElementById("WifiGatewayAddress").value="";
+		}
+		WifiDhcp_changed();
+	}
+	function EthDhcp_changed(){
+		if(document.getElementById("Eth0DhcpClient").value=="0"){
+			document.getElementById("Eth0IpAddress").disabled=true;
+			document.getElementById("Eth0SubmaskAddress").disabled=true;
+			document.getElementById("Eth0GatewayAddress").disabled=true;
+			document.getElementById("Eth0IpAddress").value="";
+			document.getElementById("Eth0SubmaskAddress").value="";
+			document.getElementById("Eth0GatewayAddress").value="";
+		}
+		if(document.getElementById("Eth0DhcpClient").value=="1"){
+			document.getElementById("Eth0IpAddress").disabled=false;
+			document.getElementById("Eth0SubmaskAddress").disabled=false;
+			document.getElementById("Eth0GatewayAddress").disabled=false;
+			document.getElementById("Eth0IpAddress").value="<?php echo $obj->{'Eth0IpAddress'};?>";
+			document.getElementById("Eth0SubmaskAddress").value="<?php echo $obj->{'Eth0SubmaskAddress'};?>";
+			document.getElementById("Eth0GatewayAddress").value="<?php echo $obj->{'Eth0GatewayAddress'};?>";
+		}
+	}
+	function WifiDhcp_changed(){
+		if(document.getElementById("WifiDhcpClient").disabled===false && document.getElementById("WifiDhcpClient").value=="0"){
+			document.getElementById("WifiIpAddress").disabled=true;
+			document.getElementById("WifiSubmaskAddress").disabled=true;
+			document.getElementById("WifiGatewayAddress").disabled=true;
+			document.getElementById("WifiIpAddress").value="";
+			document.getElementById("WifiSubmaskAddress").value="";
+			document.getElementById("WifiGatewayAddress").value="";
+		}
+		if(document.getElementById("WifiDhcpClient").disabled===false && document.getElementById("WifiDhcpClient").value=="1"){
+			document.getElementById("WifiIpAddress").disabled=false;
+			document.getElementById("WifiSubmaskAddress").disabled=false;
+			document.getElementById("WifiGatewayAddress").disabled=false;
+			document.getElementById("WifiIpAddress").value="<?php echo $obj->{'WifiIpAddress'};?>";
+			document.getElementById("WifiSubmaskAddress").value="<?php echo $obj->{'WifiSubmaskAddress'};?>";
+			document.getElementById("WifiGatewayAddress").value="<?php echo $obj->{'WifiGatewayAddress'};?>";
 		}
 	}
 

+ 29 - 21
EVSE/rootfs/var/www/set_system.php

@@ -83,9 +83,9 @@ img {
 		<section class="envor-section">
 			<div class="container">
 				<div class="row">
-					<div class="col-lg-12">         
+					<div class="col-lg-12">
 						<div class="envor-sorting" id="faq-sorting">
-							<div class="envor-toggle">                
+							<div class="envor-toggle">
 								<!--System Information-->
 								<article class="envor-sorting-item css">
 									<header><?php echo $lang->showWord("system_information"); ?><i class="fa fa-plus"></i></header>
@@ -119,6 +119,13 @@ img {
 												</span>
 											</div>
 										</div>
+										<div class="form-group" style="display:<?php echo $am001;?>">
+											<label>AC Phase Loss Policy</label>
+											<select class="form-control" id="PhaseLossPolicy" name="PhaseLossPolicy">
+												<option value="0" <?php echo $obj->{'PhaseLossPolicy'}=="0"?"selected":""?>>de-rating</option>
+												<option value="1" <?php echo $obj->{'PhaseLossPolicy'}=="1"?"selected":""?>>stop charging</option>
+											</select>
+										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>
 											<input type="checkbox" id="FactoryConfiguration" name="FactoryConfiguration" <?php echo $obj->{'FactoryConfiguration'}==1?"checked":"";?>>
@@ -137,17 +144,17 @@ img {
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Input Voltage R</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'InputVoltageR'};?> volt">
+											<input type="text" readonly class="form-control" placeholder="<?php echo round($obj->{'InputVoltageR'},2);?> volt">
 											<input type="hidden" name="InputVoltageR" id="InputVoltageR" value="<?php echo $obj->{'InputVoltageR'};?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Input Voltage S</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'InputVoltageS'};?> volt">
+											<input type="text" readonly class="form-control" placeholder="<?php echo round($obj->{'InputVoltageS'},2);?> volt">
 											<input type="hidden" name="InputVoltageS" id="InputVoltageS" value="<?php echo $obj->{'InputVoltageS'};?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Input Voltage T</label>
-											<input type="text" readonly class="form-control" placeholder="<?php echo $obj->{'InputVoltageT'};?> volt">
+											<input type="text" readonly class="form-control" placeholder="<?php echo round($obj->{'InputVoltageT'},2);?> volt">
 											<input type="hidden" name="InputVoltageT" id="InputVoltageT" value="<?php echo $obj->{'InputVoltageT'};?>">
 										</div>
 										<div class="form-group" style="display:<?php echo $am001;?>">
@@ -331,6 +338,7 @@ img {
 			// POST 參數須使用 send() 發送
 			var data =  "SystemId=" + document.getElementById("SystemId").value+
 						"&SystemDateTime=" + document.getElementById("SystemDateTime").value+
+						"&PhaseLossPolicy=" + document.getElementById("PhaseLossPolicy").value+
 						"&FactoryConfiguration=" + (document.getElementById("FactoryConfiguration").checked?1:0)+
 						"&AuthorisationMode=" + document.getElementById("AuthorisationMode").value+
 						"&isAPP=" + (document.getElementById("isAPP").checked?1:0)+
@@ -340,7 +348,7 @@ img {
 						"&QRCodeContent=" + document.getElementById("QRCodeContent").value+
 						"&RfidCardNumEndian=" + document.getElementById("RfidCardNumEndian").value+
 						"&PsuAcInputType=" + document.getElementById("PsuAcInputType").value;
-			
+
 			// POST 請求必須設置表頭在 open() 下面,send() 上面
 			request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
 			request.send(data);
@@ -348,7 +356,7 @@ img {
 			request.onreadystatechange = function() {
 				// 伺服器請求完成
 				if (request.readyState == 4) {
-					 document.getElementById("loading").style.display="none";
+					document.getElementById("loading").style.display="none";
 					// 伺服器回應成功
 					if (request.status == 200 && JSON.parse(request.responseText).result=="Success") {
 						alert("<?php echo $lang->showWord("done")?>");
@@ -361,21 +369,21 @@ img {
 			}
 		}
 	}
-	
+
 	function formCheck()
 	{
 		var SystemId = document.getElementById("SystemId").value;
 		var SystemDateTime = document.getElementById("SystemDateTime").value;
 		var result=true;
-		 
-/*		 
+
+/*
 		if(SystemId.length < 1)
 		{
 			alert("SystemId format is not correct, ID is required .");
 			document.getElementById("SystemId").focus();
 			result = false;
 		}
-		
+
 */
 		return result;
 	}
@@ -409,15 +417,15 @@ img {
 		}
 	}
 
-	Date.prototype.Format = function (fmt) { //author: meizz 
+	Date.prototype.Format = function (fmt) { //author: meizz
 		var o = {
-			"M+": this.getMonth() + 1, //月份 
-			"d+": this.getDate(), //日 
-			"h+": this.getHours(), //小时 
-			"m+": this.getMinutes(), //分 
-			"s+": this.getSeconds(), //秒 
-			"q+": Math.floor((this.getMonth() + 3) / 3), //季度 
-			"S": this.getMilliseconds() //毫秒 
+			"M+": this.getMonth() + 1, //月份
+			"d+": this.getDate(), //日
+			"h+": this.getHours(), //小时
+			"m+": this.getMinutes(), //分
+			"s+": this.getSeconds(), //秒
+			"q+": Math.floor((this.getMonth() + 3) / 3), //季度
+			"S": this.getMilliseconds() //毫秒
 		};
 		if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
 		for (var k in o)
@@ -428,10 +436,10 @@ img {
 	function isNumberKey(evt)
 	{
 		var charCode = (evt.which) ? evt.which : event.keyCode
-		
+
 		if (charCode > 31 && (charCode < 48 || charCode > 57) && (charCode != 46))
 			return false;
-		
+
 		return true;
 	}
 

+ 2 - 1
EVSE/rootfs/var/www/set_system_action.php

@@ -22,6 +22,7 @@
 		}
 //		checkValue("AcPhaseCount",1);
 //		checkValue("FactoryConfiguration",1);
+		checkValue("PhaseLossPolicy",2);
 		checkValue("AuthorisationMode",2);
 		checkValue("isAPP",2);
 		checkValue("isQRCode",2);
@@ -32,7 +33,7 @@
 //		$json = json_decode(file_get_contents("system.txt"), true);
 		$json['SystemId']				= $_POST["SystemId"];
 		$json['SystemDateTime']			= $_POST['SystemDateTime'];
-//		$json['AcPhaseCount']			= $_POST['AcPhaseCount'];
+		$json['PhaseLossPolicy']		= (int)$_POST['PhaseLossPolicy'];
 		$json['FactoryConfiguration']	= $_POST['FactoryConfiguration'];
 		$json['AuthorisationMode']		= (int)$_POST['AuthorisationMode'];
 		$json['isAPP']					= (int)$_POST['isAPP'];

+ 13 - 5
EVSE/rootfs/var/www/upgrade_iso.php

@@ -1,7 +1,15 @@
 <?php
+	ini_set('error_reporting', E_ALL | E_STRICT);
 	$tag_header = 'upgrade';
 	include 'head.php';
 ?>
+<style>
+img {
+  display: block;
+  margin-left: auto;
+  margin-right: auto;
+}
+</style>
 	<div class="envor-content">
 		<!--
 		Page Title start
@@ -61,6 +69,7 @@
 		if(formCheck("iso"))
 		{
 			window.location="#loadinghref";
+			document.getElementById("loading").style.display="block";
 			var fileInput = document.getElementById('file_iso');
 			
 			// 發送 Ajax 查詢請求並處理
@@ -76,25 +85,25 @@
 
 			// POST 請求必須設置表頭在 open() 下面,send() 上面
 			request.upload.onprogress = function(e) {
-			   document.getElementById("createResult").innerHTML = "Upload " + (Math.round( (e.loaded/e.total) *10000)/100) + "%";
+				document.getElementById("createResult").innerHTML = "Upload " + (Math.round( (e.loaded/e.total) *10000)/100) + "%";
 			}
-
 			request.send(formData);
-
 			request.onreadystatechange = function() {
 				// 伺服器請求完成
 				if (request.readyState == 4) {
+					document.getElementById("loading").style.display="none";
 					// 伺服器回應成功
 					if (request.status == 200) {
 						document.getElementById("createResult").innerHTML = "";
 						document.getElementById("createResult").innerHTML = request.responseText;
+						//location.href="upgrade_iso.php";
 					} else {
 						alert(JSON.parse(request.responseText).message);
 					}
 					request = null;
 				}
 				else{
-					document.getElementById("createResult").innerHTML = request.responseText;	
+					document.getElementById("createResult").innerHTML = request.responseText;
 				}
 			}
 		}
@@ -143,4 +152,3 @@
 	
 </script>
 
-

+ 4 - 3
EVSE/rootfs/var/www/upgrade_iso_action.php

@@ -20,8 +20,8 @@
 		$message = $lang->showWord("message_upgrade");
 
 		chdir('/root');
-		echo '<font color=#ff0000>Work directory: '.getcwd().'<br>';
-		echo 'System date/time: '.nl2br(shell_exec('date +%Y-%m-%d_%H:%M:%S')).'</font>';
+//		echo '<font color=#ff0000>Work directory: '.getcwd().'<br>';
+//		echo 'System date/time: '.nl2br(shell_exec('date +%Y-%m-%d_%H:%M:%S')).'</font>';
 		// ini_set('max_execution_time','120');
 		// ini_set('max_input_time','120');
 		// ini_set('post_max_size','2048M');
@@ -46,7 +46,8 @@
 			chdir("/root");
 			$str_json=json_encode($json);
 			exec("'./WebService' 'upgrade' '".$_FILES["file"]["name"]."'",$output,$return_var);
-			echo 'Result:'.json_decode(trim($output[0]))->{'Result'}.'    Message:'.json_decode(trim($output[0]))->{'Message'};
+//			echo 'Result:'.json_decode(trim($output[0]))->{'Result'}.'    Message:'.json_decode(trim($output[0]))->{'Message'};
+			echo '<font color=#ff0000>'.json_decode(trim($output[0]))->{'Message'}.'</font>';
 			//printf($output);
 		}
 		shell_exec('sync;sync;sync');