1
81041
2019-06-20 ab3c4acf83f54f8449ca8664c4a2bb79bd30f297
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package com.fgkj.services.Ld9;
 
import java.util.List;
 
import com.fgkj.dao.BaseDAO;
import com.fgkj.dao.BaseDAOFactory;
import com.fgkj.dao.impl.BattInfImpl;
import com.fgkj.dao.impl.Batt_rtdataDAOImpl;
import com.fgkj.dao.impl.Ld9.LD9_setparamImpl;
import com.fgkj.dao.impl.ram.Fbs9100_setparamImpl;
import com.fgkj.dto.BattInf;
import com.fgkj.dto.LD9_setparam;
import com.fgkj.dto.ServiceModel;
import com.fgkj.dto.ram.Fbs9100_setparam;
 
public class LD9_setparamService {
    private BaseDAO dao;
    private ServiceModel model;
    
    public LD9_setparamService() {
        super();
        this.dao =BaseDAOFactory.getBaseDAO(BaseDAO.LD9_SETPARAM);
        this.model = new ServiceModel();
    }
    
     //弹出框的确定操作
    public ServiceModel update(Object obj) {
        LD9_setparam ld9=(LD9_setparam) obj;
        Boolean b=dao.update(obj);
        if(b){
            boolean bl=((LD9_setparamImpl)dao).sendCmdToLd9Dev(ld9.getNum(), ld9.getDev_id());
            if(bl){
                model.setCode(1);
                model.setMsg("修改成功!");
            }else{
                model.setCode(0);
                model.setMsg("设置9100参数失败,请检查网络!");
            }
        }else{
            model.setCode(0);
            model.setMsg("修改失败!");
        }        
        return model;    
    }
     //根据机房编号和维护区查询放电机房的信息和放电参数
    public ServiceModel serchByCondition(Object obj){
        BattInf binf=(BattInf) obj;
        int dev_id=(new BattInfImpl()).serchDev_id(binf);
        boolean bl=((LD9_setparamImpl)dao).sendCmdToLd9Dev(binf.getNum(), dev_id);
        List list=dao.serchByCondition(obj);
        if(bl){
            model.setCode(1);
            model.setData(list);
            model.setMsg("查询成功!");
            
        }else{
            model.setCode(0);
            model.setData(list);
            model.setMsg("查询失败!");
        }
        return model;
    } 
    
    //右键查看参数和弹出框的刷新按钮
    public ServiceModel serchbyDev_id(Object obj) {
        LD9_setparam ld9=(LD9_setparam) obj;
        boolean bl=((LD9_setparamImpl)dao).sendCmdToLd9Dev(ld9.getNum(), ld9.getDev_id());
        List list=((LD9_setparamImpl)dao).serchbyDev_id(obj);
        if(bl){
            model.setCode(1);
            model.setData(list);
            model.setMsg("查询成功!");
 
        }else{
            model.setCode(0);
            model.setData(list);
            model.setMsg("设置9100参数失败,请检查网络!");
        }
        //System.out.println(model.getData());
        return model;    
    }
    
    
    //根据电池组id查询电池组内前五的内阻数据
    public ServiceModel serchByThirdBatt(Object obj){
        List list=(new Batt_rtdataDAOImpl()).serchByThirdBatt(obj);
        if(list!=null&&list.size()>0){
            model.setCode(1);
            model.setData(list);
            model.setMsg("查询成功!");
        }else{
            model.setCode(0);
            model.setMsg("查询失败!");
        }
        return model;
    }
}