cl
2024-07-21 ddf2c28b00b38469c9119dcad42d986f849bc62d
添加电芯挡位校验
已修改7个文件
119 ■■■■ 文件已修改
jcdm-main/src/main/java/com/jcdm/main/da/cellData/domain/DaCellData.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/da/cellData/mapper/DaCellDataMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/da/cellData/service/IDaCellDataService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/da/cellData/service/impl/DaCellDataServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/resources/mapper/da/cellData/DaCellDataMapper.xml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/da/cellData/domain/DaCellData.java
@@ -54,7 +54,7 @@
    private String customerModuleBarcode;
    /** 电芯编号 */
    @Excel(name = "电芯编号")
    @Excel(name = "电芯组别")
    private String cellSerial;
    /** 电芯型号 */
jcdm-main/src/main/java/com/jcdm/main/da/cellData/mapper/DaCellDataMapper.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jcdm.main.da.cellData.domain.DaCellData;
import org.apache.ibatis.annotations.Param;
/**
 * 电芯数据Mapper接口
@@ -60,4 +61,6 @@
     * @return 结果
     */
    public int deleteDaCellDataByIds(Long[] ids);
    void deleteDaCellDataByGbCellCode(@Param("gbCellCode") String gbCellCode);
}
jcdm-main/src/main/java/com/jcdm/main/da/cellData/service/IDaCellDataService.java
@@ -62,4 +62,6 @@
    public int deleteDaCellDataById(Long id);
    void insertBatch(List<DaCellData> daCellDataList);
    void deleteDaCellDataByGbCellCode(String gbCellCode);
}
jcdm-main/src/main/java/com/jcdm/main/da/cellData/service/impl/DaCellDataServiceImpl.java
@@ -103,4 +103,10 @@
            return;
        }
    }
    @Override
    public void deleteDaCellDataByGbCellCode(String gbCellCode) {
        daCellDataMapper.deleteDaCellDataByGbCellCode(gbCellCode);
    }
}
jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java
@@ -88,8 +88,8 @@
                collectionParamConfService,
                daParamCollectionService,
                omProductionOrdeInfoService,
                daTestDeviceInterfaceTempService/*,
                daCellDataService*/);
                daTestDeviceInterfaceTempService,
                daCellDataService);
        List<String> lists = getSubList();
        System.out.println("订阅内容:"+lists);
jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
@@ -12,6 +12,8 @@
import com.jcdm.common.core.domain.AjaxResult;
import com.jcdm.framework.websocket.WebSocketUsers;
import com.jcdm.main.constant.Constants;
import com.jcdm.main.da.cellData.domain.DaCellData;
import com.jcdm.main.da.cellData.service.IDaCellDataService;
import com.jcdm.main.da.collectionParamConf.domain.DaCollectionParamConf;
import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService;
import com.jcdm.main.da.paramCollection.domain.DaParamCollection;
@@ -62,6 +64,8 @@
    public static IDaTestDeviceInterfaceTempService daTestDeviceInterfaceTempService;
    public static IDaCellDataService daCellDataService;
/*    @Value("${orderLineUrl}")
    private static String orderLineUrl;*/
@@ -70,13 +74,15 @@
                             IDaCollectionParamConfService collectionParamConfService,
                             IDaParamCollectionService daParamCollectionService,
                             IOmProductionOrdeInfoService omProductionOrdeInfoService,
                             IDaTestDeviceInterfaceTempService daTestDeviceInterfaceTempService) {
                             IDaTestDeviceInterfaceTempService daTestDeviceInterfaceTempService,
                             IDaCellDataService daCellDataService) {
        OPCUaSubscription.miloService = miloService;
        OPCUaSubscription.daPassingStationCollectionService = daPassingStationCollectionService;
        OPCUaSubscription.collectionParamConfService = collectionParamConfService;
        OPCUaSubscription.daParamCollectionService = daParamCollectionService;
        OPCUaSubscription.omProductionOrdeInfoService = omProductionOrdeInfoService;
        OPCUaSubscription.daTestDeviceInterfaceTempService = daTestDeviceInterfaceTempService;
        OPCUaSubscription.daCellDataService = daCellDataService;
    }
@@ -143,9 +149,22 @@
                    miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordSNDone").value(1).build());//没有要生产的工单
                }
            }else if (Constants.RECORD_DATA.equals(tab)){//出入站
                if (Constants.ONE.equals(valueString)){//入站
                    //1:告知MES托盘已到站,请求下发进站状态
                    if (Constants.OP030.equals(device)){
                if (Constants.ONE.equals(valueString)){//入站 //1:告知MES托盘已到站,请求下发进站状态
                    //OP020 电芯挡位校验
                    if (Constants.OP020.equals(device)){
                        Integer result = 11;
                        Object cellGearObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".CellGear").getValue();
                        if (ObjectUtil.isNull(cellGearObjcet)){
                            result = 16;//电芯挡位为空
                        }else{
                            String cellGear = cellGearObjcet.toString();
                            List<String> cellCodeList = readCellCodeList(thoroughfare, device);
                            result = checkCellGear(thoroughfare, device,cellCodeList,cellGear);//校验电芯挡位和组别
                        }
                        miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(result).build());
                    }else if (Constants.OP030.equals(device)){
                        //反馈电芯ocv检测结果
                        boolean b = OCVResultFeedBack(thoroughfare, device);//进站对4个电芯校验
                        //四个电芯的状态
@@ -221,11 +240,32 @@
                            result = savePassingStation(thoroughfare, device,cellCodeList);//保存过站
                            if(result == 21) {
                                if(Constants.OP030.contains(device)){
                                    daTestDeviceInterfaceTempService.deleteDaTestDeviceInterfaceTempByProductNum(cellCode1);
                                    daTestDeviceInterfaceTempService.deleteDaTestDeviceInterfaceTempByProductNum(cellCode2);
                                    daTestDeviceInterfaceTempService.deleteDaTestDeviceInterfaceTempByProductNum(cellCode3);
                                    daTestDeviceInterfaceTempService.deleteDaTestDeviceInterfaceTempByProductNum(cellCode4);
                                if(Constants.OP020.contains(device)){
                                    if(!cellCode1.isEmpty()){
                                        daCellDataService.deleteDaCellDataByGbCellCode(cellCode1);
                                    }
                                    if(!cellCode2.isEmpty()){
                                        daCellDataService.deleteDaCellDataByGbCellCode(cellCode2);
                                    }
                                    if(!cellCode3.isEmpty()){
                                        daCellDataService.deleteDaCellDataByGbCellCode(cellCode3);
                                    }
                                    if(!cellCode4.isEmpty()){
                                        daCellDataService.deleteDaCellDataByGbCellCode(cellCode4);
                                    }
                                }else if(Constants.OP030.contains(device)){
                                    if(!cellCode1.isEmpty()){
                                        daTestDeviceInterfaceTempService.deleteDaTestDeviceInterfaceTempByProductNum(cellCode1);
                                    }
                                    if(!cellCode2.isEmpty()){
                                        daTestDeviceInterfaceTempService.deleteDaTestDeviceInterfaceTempByProductNum(cellCode2);
                                    }
                                    if(!cellCode3.isEmpty()){
                                        daTestDeviceInterfaceTempService.deleteDaTestDeviceInterfaceTempByProductNum(cellCode3);
                                    }
                                    if(!cellCode4.isEmpty()) {
                                        daTestDeviceInterfaceTempService.deleteDaTestDeviceInterfaceTempByProductNum(cellCode4);
                                    }
                                }
                                result = saveParamCollection(device,cellCodeList);//保存参数,发送工厂MES
                            }
@@ -818,6 +858,42 @@
        }
        return flag;
    }
    /**
     * OP020校验电芯挡位
     * @param thoroughfare
     * @param device
     * @throws Exception
     */
    private Integer checkCellGear(String thoroughfare, String device,List<String> cellCodeList,String cellGear) throws Exception {
        Integer result = 11;
        for(int i = 0; i < cellCodeList.size(); i ++){
            Integer cellStatus = 1;
            String cellCode = cellCodeList.get(i);
            if(!cellCode.isEmpty()){
                List<DaCellData> list = daCellDataService.list(new LambdaQueryWrapper<DaCellData>()
                        .eq(DaCellData::getGbCellCode,cellCode));
                if(CollUtil.isNotEmpty(list)){
                    DaCellData daCellData = list.get(0);
                    String cellValue = daCellData.getCellValue();//数据库中电芯挡位
                    String cellSerial = daCellData.getCellSerial();//数据库中电芯组别
                    if(!cellValue.isEmpty() && cellValue.equals(cellGear)){
                        cellStatus = 1;
                    }else {
                        cellStatus = 2;
                        result = 17;//挡位校验不合格
                    }
                }else {
                    cellStatus = 2;
                    result = 17;//查不到要校验的挡位
                }
                miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_"+(i+1)).value(cellStatus).build());
            }
        }
        return result;
    }
    /**
     * 030工位返回ocv测试结果
     * @param thoroughfare
jcdm-main/src/main/resources/mapper/da/cellData/DaCellDataMapper.xml
@@ -139,4 +139,12 @@
            #{id}
        </foreach>
    </delete>
    <delete id="deleteDaCellDataByGbCellCode" parameterType="String">
        DELETE
        FROM
            da_cell_data
        WHERE
            gb_cell_code = #{gbCellCode}
    </delete>
</mapper>