lxw
2023-08-15 160e150009b51a39fa95d9462c3798ba28d51a09
src/main/java/com/whyc/service/Fbs9100SetparamService.java
@@ -5,10 +5,14 @@
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;
@@ -22,6 +26,10 @@
    private Fbs9100SetparamMapper mapper;
    @Resource
    private Li9130SetparamPlanMapper li9130Mapper;
    @Resource
    private BattInfMapper binfMapper;
    @Resource
    private Fbs9100SetParamTempMapper tmpMapper;
    //查询设备的参数
    public Response serchdevParam(int devId) {
@@ -36,6 +44,25 @@
    //右键查看参数和弹出框的刷新按钮-----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参数失败,请检查网络!");
    }
@@ -696,4 +723,39 @@
    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);
    }
}