V5.0.0bug修复
This commit is contained in:
@@ -149,7 +149,7 @@ Assign BOOL isInitHostoryView;
|
||||
_changeWaterView.hidden=NO;
|
||||
return _changeWaterView;
|
||||
}
|
||||
|
||||
//设置换水周期
|
||||
-(void)didSelectRow1:(NSString *)v andRow2:(NSString *)v2{
|
||||
v=[v stringByReplacingOccurrencesOfString:@"天" withString:@""];
|
||||
v2=[v2 stringByReplacingOccurrencesOfString:@":00" withString:@""];
|
||||
@@ -159,54 +159,31 @@ Assign BOOL isInitHostoryView;
|
||||
}
|
||||
IfishHotBarVo*vo=self.datas[4];
|
||||
vo.title=str;
|
||||
|
||||
if (!self.vo.heater) {
|
||||
self.vo.heater = InitObject(IfishHeaterVo);
|
||||
}
|
||||
self.vo.heater.heaterCycle=v;
|
||||
self.vo.heater.heaterReminderTime=v2;
|
||||
[self setTeampleture];
|
||||
[self.mainTableView reloadData];
|
||||
}
|
||||
|
||||
-(void)submitText:(NSString *)w andh:(NSString *)h andV:(NSString *)v{
|
||||
IfishHotBarVo*vo=self.datas[1];
|
||||
float heaterVolume;
|
||||
if (w&&h&&v) {
|
||||
heaterVolume=[w integerValue]*[h integerValue]*[v integerValue]*0.001;
|
||||
self.vo.heater.heaterVolume=[NSString stringWithFormat:@"%0.1f",heaterVolume];
|
||||
self.vo.heater.heaterLong=v;
|
||||
self.vo.heater.heaterWidth=w;
|
||||
self.vo.heater.heaterHeight=h;
|
||||
}
|
||||
if (self.vo.heater.heaterVolume.length) {
|
||||
vo.title=[NSString stringWithFormat:@"鱼缸容量 %@L",self.vo.heater.heaterVolume];
|
||||
vo.subTitle=[NSString stringWithFormat:@"推荐流量:%.1fL--%.1fL",[self.vo.heater.heaterVolume intValue]*1.5,[self.vo.heater.heaterVolume intValue]*2.0];
|
||||
[self.mainTableView reloadData];
|
||||
}
|
||||
[self setHeigh:h andW:w andLong:v];
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
-(void)didSelectTeamptrue:(NSString *)up andDown:(NSString *)down andT:(NSString *)t andWarnCode:(NSString *)code{
|
||||
up=[up stringByReplacingOccurrencesOfString:@"°c" withString:@""];
|
||||
down=[down stringByReplacingOccurrencesOfString:@"°c" withString:@""];
|
||||
t=[t stringByReplacingOccurrencesOfString:@"°c" withString:@""];
|
||||
|
||||
// [self setHeatTeapWith:t];
|
||||
//设置加热温度
|
||||
-(void)didChangeTemperature:(NSString *)temp{
|
||||
temp=[temp stringByReplacingOccurrencesOfString:@"°c" withString:@""];
|
||||
IfishHotBarVo*vo=self.datas[0];
|
||||
self.vo.heaterNum=[NSString stringWithFormat:@"%f",t.floatValue];
|
||||
|
||||
self.vo.heaterNum=[NSString stringWithFormat:@"%f",temp.floatValue];
|
||||
vo.title=[NSString stringWithFormat:@"设置温度 %.1f°c",[self.vo.heaterNum floatValue]];
|
||||
[self.mainTableView reloadData];
|
||||
[self setHeatTeapWith:temp];
|
||||
}
|
||||
//设置预警温度
|
||||
-(void)didSelectTeamptrue:(NSString *)up andDown:(NSString *)down andWarnCode:(NSString *)code{
|
||||
up=[up stringByReplacingOccurrencesOfString:@"°c" withString:@""];
|
||||
down=[down stringByReplacingOccurrencesOfString:@"°c" withString:@""];
|
||||
self.vo.wornCode=code;
|
||||
// self.vo.wornCode=[NSString stringWithFormat:@"%llu",[dataContorl hexToTen:self.vo.wornCode]];
|
||||
|
||||
self.vo.upTeamp=up;
|
||||
|
||||
self.vo.downTeamp=down;
|
||||
|
||||
[self setHeatTeapWith:t];
|
||||
// [self setTeampletureWithUp:self.vo.upTeamp andDown:self.vo.downTeamp andHnum:0 andWarmC:self.vo.wornCode];
|
||||
[self setTeampletureWithUp:self.vo.upTeamp andDown:self.vo.downTeamp andHnum:0 andWarmC:self.vo.wornCode];
|
||||
}
|
||||
|
||||
|
||||
@@ -321,66 +298,7 @@ Assign BOOL isInitHostoryView;
|
||||
}
|
||||
|
||||
#pragma mark------请求服务器-------
|
||||
|
||||
-(void)setHeigh:(NSString*)h andW:(NSString*)w andLong:(NSString*)l{
|
||||
// 参数名称 参数类型 是否必须 说明描述
|
||||
// heaterId Integer 是 保存信息此字段为空
|
||||
// 修改信息此字段有值
|
||||
// heaterMacAddress String 是 加热棒mac地址
|
||||
// heaterVolume String 是 鱼缸容积
|
||||
// heaterLong String 是 鱼缸长
|
||||
// heaterWidth String 是 鱼缸宽
|
||||
// heaterHeight String 是 鱼缸高
|
||||
// heaterCycle String 是 换水提醒周期
|
||||
// c String 是 提醒时间
|
||||
if ([l isEqualToString:@""]) {
|
||||
[self.view makeToast:@"请输入鱼缸长"];
|
||||
return;
|
||||
}else if ([w isEqualToString:@""]){
|
||||
[self.view makeToast:@"请输入鱼缸宽"];
|
||||
return;
|
||||
}else if([h isEqualToString:@""])
|
||||
{
|
||||
[self.view makeToast:@"请输入鱼缸高"];
|
||||
return;
|
||||
}
|
||||
NSString*v=@"";
|
||||
NSString*r=@"";
|
||||
NSString*c=@"";
|
||||
NSString*heaterId=@"";
|
||||
if (self.vo.heater) {
|
||||
v=self.vo.heater.heaterVolume;
|
||||
c=self.vo.heater.heaterCycle;
|
||||
r=self.vo.heater.heaterReminderTime;
|
||||
heaterId=self.vo.heater.heaterId;
|
||||
}
|
||||
|
||||
NSDictionary*para=@{
|
||||
@"heaterId":heaterId,
|
||||
@"heaterMacAddress":self.devicemodel.macAddress,
|
||||
@"heaterVolume":v,
|
||||
@"heaterLong":l,
|
||||
@"heaterWidth":w,
|
||||
@"heaterHeight":h,
|
||||
@"heaterCycle":c,
|
||||
@"heaterRemindTime":r
|
||||
};
|
||||
[SVProgressHUD showWithMaskType:SVProgressHUDMaskTypeBlack];
|
||||
[AFHttpTool requestWihtMethod:RequestMethodTypePost url:SaveHotBarInfo params:para success:^(id response) {
|
||||
NSLog(@"-----------%@",response);
|
||||
NSDictionary*dict=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
|
||||
NSString*result=dict[@"result"];
|
||||
if ([result integerValue]==100) {
|
||||
// self.vo=[IfishHotBarVo mj_objectWithKeyValues:dict[@"data"]];
|
||||
[SVProgressHUD dismiss];
|
||||
[self showLableAction:@"修改成功"];
|
||||
}
|
||||
} failure:^(NSError *err) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
//删除加热棒
|
||||
-(void)deleteHotBarInfo{
|
||||
|
||||
NSDictionary*para=@{
|
||||
@@ -401,17 +319,11 @@ Assign BOOL isInitHostoryView;
|
||||
//重置数据库
|
||||
NSArray*deviceArry=[[DataCenter defaultDtacenter]valueForKey:@"deviceInfo"];
|
||||
NSMutableArray *newArr = [NSMutableArray arrayWithArray:deviceArry];
|
||||
|
||||
for (DeviceModel *model in deviceArry) {
|
||||
|
||||
if ([model.deviceId isEqual:self.devicemodel.deviceId]) {
|
||||
|
||||
[newArr removeObject:model];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[[DataCenter defaultDtacenter] setValue: newArr forKey:@"deviceInfo"];
|
||||
|
||||
if ([newArr count]==0) {
|
||||
@@ -444,7 +356,6 @@ Assign BOOL isInitHostoryView;
|
||||
[SVProgressHUD dismiss];
|
||||
if ([result integerValue]==100) {
|
||||
self.vo=[IfishHotBarVo mj_objectWithKeyValues:dict[@"data"]];
|
||||
|
||||
if (self.vo.phs.count>0) {
|
||||
NSDate *curDate = [NSDate dateWithTimeInterval:self.curDay*60*60*-24 sinceDate:[NSDate date]];
|
||||
NSDateFormatter *dateFormatter=[[NSDateFormatter alloc]init];//创建一个日期格式化器
|
||||
@@ -456,8 +367,7 @@ Assign BOOL isInitHostoryView;
|
||||
self.historyView.datas=self.vo.phs;
|
||||
self.historyView.hidden=YES;
|
||||
}
|
||||
//去除鱼缸容积,改为设置预警温度
|
||||
|
||||
//去除鱼缸容积
|
||||
IfishHotBarVo*vo1=self.datas[4];
|
||||
if (self.vo.heater.heaterCycle.length) {
|
||||
if (self.vo.heater.heaterReminderTime.length) {
|
||||
@@ -491,16 +401,16 @@ Assign BOOL isInitHostoryView;
|
||||
}
|
||||
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if (indexPath.row==3) {
|
||||
|
||||
if (indexPath.row==2){//水泵流量,点击无效果
|
||||
|
||||
}else if (indexPath.row==3) {//历史趋势
|
||||
if (!self.isInitHostoryView) {
|
||||
[self getHistoryDataRequest];
|
||||
}
|
||||
self.historyView.hidden=NO;
|
||||
|
||||
}else if (indexPath.row==2){
|
||||
|
||||
}
|
||||
else{
|
||||
}else{
|
||||
[self changeWaterView];
|
||||
self.changeWaterView.hotVo=self.vo;
|
||||
self.changeWaterView.viewType=indexPath.row;
|
||||
@@ -575,8 +485,6 @@ Assign BOOL isInitHostoryView;
|
||||
self.vo.downTeamp=[info substringWithRange:NSMakeRange(50, 4)];
|
||||
self.vo.downTeamp=[NSString stringWithFormat:@"%f",[dataContorl hexToTen:self.vo.downTeamp]*0.1];
|
||||
|
||||
|
||||
|
||||
[self.mainTableView reloadData];
|
||||
|
||||
}
|
||||
@@ -599,6 +507,7 @@ Assign BOOL isInitHostoryView;
|
||||
//2 最低报警温度,关闭报警时传0
|
||||
//2 最高报警温度,关闭报警时传0
|
||||
//2 CRC16校验码
|
||||
//设置换水周期
|
||||
-(void)setTeampleture{
|
||||
if (!self.vo.heater.heaterCycle||!self.vo.heater.heaterReminderTime) {
|
||||
return;
|
||||
@@ -610,14 +519,12 @@ Assign BOOL isInitHostoryView;
|
||||
NSString*heaterHeight=@"";
|
||||
NSString*heaterId=@"";
|
||||
NSString*heaterVolume=@"";
|
||||
if (self.vo.heater) {
|
||||
longNum=self.vo.heater.heaterLong;
|
||||
heaterWidth=self.vo.heater.heaterWidth;
|
||||
heaterHeight=self.vo.heater.heaterHeight;
|
||||
if (self.vo.heater.heaterId) {
|
||||
heaterId=self.vo.heater.heaterId;
|
||||
heaterVolume=self.vo.heater.heaterVolume;
|
||||
}
|
||||
|
||||
if (self.vo.heater.heaterVolume) {
|
||||
heaterVolume=self.vo.heater.heaterVolume;
|
||||
}
|
||||
NSDictionary*para=@{
|
||||
@"heaterId":heaterId,
|
||||
@"heaterMacAddress":self.devicemodel.macAddress,
|
||||
@@ -641,30 +548,19 @@ Assign BOOL isInitHostoryView;
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark-----打开开关----
|
||||
#pragma mark-----打开预警温度开关----
|
||||
-(void)clickWormCode:(NSString *)code{
|
||||
IfishHotBarPackegeVo*pvo=[[IfishHotBarPackegeVo alloc]init];
|
||||
|
||||
pvo.msgType=@"00";
|
||||
pvo.funcCode=@"05";
|
||||
pvo.sendAdr=self.devicemodel.macAddress;
|
||||
pvo.reciceAdr=self.devicemodel.macAddress;
|
||||
pvo.lenth=@"16";
|
||||
|
||||
pvo.warnCode=code;
|
||||
|
||||
pvo.downTeamptrue=@"0000";
|
||||
pvo.upTeamptrue=@"0000";
|
||||
|
||||
|
||||
|
||||
|
||||
pvo.crcCode=@"0000";
|
||||
|
||||
|
||||
NSString*stateString=[pvo description];
|
||||
|
||||
NSData*selctorData=[dataContorl stringToHexData:stateString];
|
||||
[[Socketsingleton sharedInstance].clientSocket writeData:selctorData withTimeout:-1 tag:0];
|
||||
[[Socketsingleton sharedInstance].clientSocket readDataWithTimeout:-1 tag:0];
|
||||
@@ -700,21 +596,14 @@ Assign BOOL isInitHostoryView;
|
||||
pvo.upTeamptrue=[dataContorl leftAddZero:4 andStr:pvo.upTeamptrue];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
pvo.crcCode=@"0000";
|
||||
|
||||
|
||||
NSString*stateString=[pvo description];
|
||||
|
||||
NSData*selctorData=[dataContorl stringToHexData:stateString];
|
||||
self.vo.heaterNum=num;
|
||||
[[Socketsingleton sharedInstance].clientSocket writeData:selctorData withTimeout:-1 tag:0];
|
||||
[[Socketsingleton sharedInstance].clientSocket readDataWithTimeout:-1 tag:0];
|
||||
// [self showLableAction:@"发送成功"];
|
||||
|
||||
|
||||
[self showLableAction:@"发送成功"];
|
||||
}
|
||||
|
||||
|
||||
@@ -725,11 +614,7 @@ Assign BOOL isInitHostoryView;
|
||||
|
||||
-(void)setHeatTeapWith:(NSString*)num{
|
||||
if(!num){
|
||||
// [self.view makeToast:@"请选择加热温度"];
|
||||
|
||||
// self.vo.wornCode=[NSString stringWithFormat:@"%llu",[dataContorl hexToTen:self.vo.wornCode]];
|
||||
|
||||
[self setTeampletureWithUp:self.vo.upTeamp andDown:self.vo.downTeamp andHnum:0 andWarmC:self.vo.wornCode];
|
||||
[self.view makeToast:@"请选择加热温度"];
|
||||
return;
|
||||
}
|
||||
IfishPackageHeaderVo*header=[[IfishPackageHeaderVo alloc]init];
|
||||
@@ -749,7 +634,7 @@ Assign BOOL isInitHostoryView;
|
||||
NSString*stateString=[NSString stringWithFormat:@"%@%@%@",[header getHeader],num,crc];
|
||||
|
||||
NSData*selctorData=[dataContorl stringToHexData:stateString];
|
||||
[[Socketsingleton sharedInstance].clientSocket writeData:selctorData withTimeout:-1 tag:0];
|
||||
[[Socketsingleton sharedInstance].clientSocket writeData:selctorData withTimeout:-1 tag:0];
|
||||
[[Socketsingleton sharedInstance].clientSocket readDataWithTimeout:-1 tag:0];
|
||||
[self showLableAction:@"发送成功"];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user