| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.DeviceTypeDTO; |
| | | import com.whyc.dto.FBS9100_ComBase; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.BattInfMapper; |
| | | import com.whyc.mapper.Fbs9100SetParamTempMapper; |
| | | import com.whyc.mapper.Fbs9100SetparamMapper; |
| | | import com.whyc.mapper.Li9130SetparamPlanMapper; |
| | | import com.whyc.pojo.Battinf; |
| | | import com.whyc.pojo.Fbs9100Setparam; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private Fbs9100SetparamMapper mapper; |
| | | @Resource |
| | | private Li9130SetparamPlanMapper li9130Mapper; |
| | | @Resource |
| | | private BattInfMapper binfMapper; |
| | | @Resource |
| | | private Fbs9100SetParamTempMapper tmpMapper; |
| | | |
| | | //查询设备的参数 |
| | | public Response serchdevParam(int devId) { |
| | |
| | | //右键查看参数和弹出框的刷新按钮-----BTS停止 |
| | | public Response serchbyDev_id(int num, Integer testCmd, int devId, int battGroupNum) { |
| | | boolean bl = sendCmdToFBS9100Dev2(num, testCmd != null ? testCmd : 0, devId, battGroupNum); |
| | | if ((devId / 100000 == DeviceTypeDTO.DEVICE6185) && (num == FBS9100_ComBase.CMD_Start)) {//当启动放电设备为6185时 |
| | | //将二次放电表中电池组id的ischarge改为1 |
| | | //先查询出电池组id |
| | | int battGroupId = 0; |
| | | QueryWrapper queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("FBSDeviceId", devId); |
| | | queryWrapper.eq("GroupIndexInFBSDevice", battGroupNum - 1); |
| | | queryWrapper.last("limit 1"); |
| | | Battinf binf = binfMapper.selectOne(queryWrapper); |
| | | if (binf != null) { |
| | | battGroupId = binf.getBattGroupId(); |
| | | } |
| | | //修改ischarge改为1 |
| | | UpdateWrapper wrapper = new UpdateWrapper(); |
| | | wrapper.set("is_charge", 1); |
| | | wrapper.eq("battGroupId", battGroupId); |
| | | tmpMapper.update(null, wrapper); |
| | | |
| | | } |
| | | Fbs9100Setparam setparam = mapper.serchbyDev_id(devId); |
| | | return new Response().setII(1, setparam, bl, bl == true ? "查询成功!" : "设置9100参数失败,请检查网络!"); |
| | | } |
| | |
| | | UpdateWrapper updateWrapper = new UpdateWrapper(); |
| | | updateWrapper.set("op_cmd", m_cmd); |
| | | updateWrapper.set("BattGroupNum", battGroupNum); |
| | | //读取时加参数在testcmd中参数类型,0-实时核容参数 1-计划核容参数 2-活化参数 3-充电参数 HV_mon_uppernum1 |
| | | if (cmd == FBS9100_ComBase.CMD_GetMutilMode_Param) { |
| | | updateWrapper.set("HV_mon_uppernum1", testCmd); |
| | | } |
| | | if (cmd == FBS9100_ComBase.CMD_Start || cmd == FBS9100_ComBase.CMD_Stop) { |
| | | updateWrapper.set("TestCmd", testCmd); |
| | | } |
| | |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(250); |
| | | Thread.sleep(500); |
| | | } catch (InterruptedException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | |
| | | case FBS9100_ComBase.CMD_Start: m_cmd_ack = FBS9100_ComBase.CMD_StartAck; break; |
| | | case FBS9100_ComBase.CMD_Stop: m_cmd_ack = FBS9100_ComBase.CMD_StopAck; break; |
| | | case FBS9100_ComBase.CMD_EOperatingSwitch_ControlSwitch: m_cmd_ack = FBS9100_ComBase.CMD_EOperatingSwitch_ControlSwitchAck; break; |
| | | |
| | | case FBS9100_ComBase.CMD_ResetSystem: m_cmd_ack = FBS9100_ComBase.CMD_ResetSystemAck; break; |
| | | default: |
| | | return false; |
| | | } |
| | |
| | | } |
| | | |
| | | //在线监测-实时监控-读取并联电源放电参数 |
| | | public Response searchParalleParam(int opCmd, int battGroupNum, int devId) { |
| | | public Response searchParalleParam(int opCmd, int hvMonUppernum1, int battGroupNum, int devId) { |
| | | PageHelper.startPage(1, 1); |
| | | QueryWrapper wrapper = new QueryWrapper(); |
| | | wrapper.eq("dev_id", devId); |
| | | boolean bl = sendCmdToFBS9100Dev3(opCmd, 0, devId, battGroupNum); |
| | | //读取时加参数在testcmd中参数类型,0-实时核容参数 1-计划核容参数 2-活化参数 3-充电参数 HV_mon_uppernum1 |
| | | boolean bl = sendCmdToFBS9100Dev3(opCmd, hvMonUppernum1, devId, battGroupNum); |
| | | Fbs9100Setparam paralleParam = mapper.selectOne(wrapper); |
| | | return new Response().setII(1, bl, paralleParam, bl == true ? "读取参数成功!" : "读取并联电源参数失败,请检查网络!"); |
| | | } |
| | |
| | | } |
| | | return new Response().set(1, bl, bl == true ? "修改参数成功!" : "设置并联电源参数失败,请检查网络!"); |
| | | } |
| | | |
| | | public Response searchPW(int devId) { |
| | | int opCmd = FBS9100_ComBase.CMD_GetDischargeParm; |
| | | return searchParam(devId,opCmd); |
| | | } |
| | | |
| | | private Response searchParam(int devId, int opCmd) { |
| | | boolean res = sendCmdToDev(opCmd, devId); |
| | | Fbs9100Setparam fbs9100Setparam = null; |
| | | if(res){ |
| | | QueryWrapper<Fbs9100Setparam> query = Wrappers.query(); |
| | | query.eq("dev_id",devId).last(" limit 1"); |
| | | fbs9100Setparam = mapper.selectOne(query); |
| | | } |
| | | return new Response().setII(1, res, fbs9100Setparam, res ? "读取参数成功" : "读取参数失败,请检查网络"); |
| | | } |
| | | |
| | | public Response updatePW(Fbs9100Setparam param) { |
| | | Long devId = param.getDevId(); |
| | | UpdateWrapper<Fbs9100Setparam> update = Wrappers.update(); |
| | | update.set("DisCurr",param.getDisCurr()) |
| | | .set("DisCap",param.getDisCap()) |
| | | .set("DisTime",param.getDisTime()) |
| | | .set("GroupVol_LOW",param.getGroupvolLow()) |
| | | .set("BattGroupNum",param.getBattGroupNum()) |
| | | .set("DCVolHighLimit",param.getDCVolHighLimit()) |
| | | .set("ChargeCurrSet",param.getChargeCurrSet()) |
| | | .eq("dev_id",devId); |
| | | mapper.update(null,update); |
| | | |
| | | boolean res = sendCmdToDev(FBS9100_ComBase.CMD_SetDischargeParm, devId.intValue()); |
| | | return new Response().set(1, res, res ? "修改参数成功" : "设置参数失败,请检查网络"); |
| | | } |
| | | |
| | | public Response updateOpCmdAndTestCmd(int devId,int opCmd,int testCmd) { |
| | | UpdateWrapper<Fbs9100Setparam> update = Wrappers.update(); |
| | | update.set("TestCmd",testCmd).eq("dev_id",devId); |
| | | Boolean res=mapper.update(null,update)==1; |
| | | boolean res2=false; |
| | | if(res){ |
| | | res2=sendCmdToDev(opCmd,devId); |
| | | } |
| | | return new Response().set(1,res2, res2 ?"启动测试成功!":"启动测试失败,请检查网络!"); |
| | | } |
| | | |
| | | public Response updateOpCmd(int devId,int opCmd) { |
| | | boolean res = sendCmdToDev(opCmd,devId); |
| | | return new Response().set(1,res, res ?"停止测试成功!":"停止测试失败,请检查网络!"); |
| | | } |
| | | |
| | | public Response updatePWStartTest(int devId,int opCmd,int testCmd) { |
| | | return updateOpCmdAndTestCmd(devId,opCmd,testCmd); |
| | | } |
| | | |
| | | public Response updatePWStopTest(int devId) { |
| | | return updateOpCmd(devId,FBS9100_ComBase.CMD_Stop); |
| | | } |
| | | |
| | | public Response updatePWRestartDevice(int devId) { |
| | | return updateOpCmd(devId,FBS9100_ComBase.CMD_ResetSystem); |
| | | } |
| | | |
| | | public Response searchLD6(int devId) { |
| | | int opCmd = FBS9100_ComBase.LD6_CMD_GETPARAM; |
| | | return searchParam(devId,opCmd); |
| | | } |
| | | |
| | | public Response updateLD6(Fbs9100Setparam param) { |
| | | Long devId = param.getDevId(); |
| | | UpdateWrapper<Fbs9100Setparam> update = Wrappers.update(); |
| | | update |
| | | .set("GroupVol_LOW",param.getGroupvolLow()) |
| | | .set("MonomerVol_LOW",param.getMonomervolLow()) |
| | | .set("MonomerLowCount",param.getMonomerLowCount()) |
| | | .set("MonomerTmp_High",param.getMonomertmpHigh()) |
| | | .set("DisTime",param.getDisTime()) |
| | | .set("DisCap",param.getDisCap()) |
| | | .set("AutoTestStartVol",param.getAutoTestStartVol()) |
| | | .set("ChargeCurrSet",param.getChargeCurrSet()) |
| | | .set("DisCurr",param.getDisCurr()) |
| | | .set("BattGroupNum",param.getBattGroupNum()) |
| | | .set("DCVolHighLimit",param.getDCVolHighLimit()) |
| | | .eq("dev_id",devId); |
| | | mapper.update(null,update); |
| | | |
| | | boolean res = sendCmdToDev(FBS9100_ComBase.CMD_SetDischargeParm, devId.intValue()); |
| | | return new Response().set(1, res, res ? "修改参数成功" : "设置参数失败,请检查网络"); |
| | | } |
| | | |
| | | public Response updateLD6StartTest(int devId) { |
| | | return updateOpCmd(devId,FBS9100_ComBase.LD6_CMD_STARTTEST); |
| | | } |
| | | |
| | | public Response updateLD6StopTest(int devId) { |
| | | return updateOpCmd(devId,FBS9100_ComBase.LD6_CMD_STOPTEST); |
| | | } |
| | | } |