cheng
2023-12-12 c64c9f6fb38f65be99b827c1af8d3c3852f68ba4
添加油脂
已修改8个文件
140 ■■■■■ 文件已修改
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/gm/greaseManage/mapper/mapping/GreaseManageMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/gm/greaseManage/service/impl/GreaseManageServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/OpcServiceMain.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/opc/OPCComm.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/opc/OPCElement.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/server/DOP020/impl/DOP020ServerInterfaceImpl.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/server/EOP030/impl/EOP030ServerInterfaceImpl.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/server/OP050/impl/OP050ServerInterfaceImpl.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/gm/greaseManage/mapper/mapping/GreaseManageMapper.xml
@@ -26,6 +26,9 @@
        select
        <include refid="Base_Column_List"/>
        from gm_grease_manage where 1 = 1
        <if test="paramCondition.locationCode != null and paramCondition.locationCode != ''">
            and location_code like CONCAT('%',#{paramCondition.locationCode},'%')
        </if>
    </select>
    <select id="customMapList" resultType="map" parameterType="cn.stylefeng.guns.modular.gm.greaseManage.model.params.GreaseManageParam">
guns-vip-main/src/main/java/cn/stylefeng/guns/modular/gm/greaseManage/service/impl/GreaseManageServiceImpl.java
@@ -53,7 +53,7 @@
    @Override
    public List<GreaseManageResult> findListBySpec(GreaseManageParam param){
        return null;
        return this.baseMapper.customList(param);
    }
    @Override
guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/OpcServiceMain.java
@@ -9,6 +9,7 @@
import cn.stylefeng.guns.modular.dq.materialTraceability.service.MaterialTraceabilityService;
import cn.stylefeng.guns.modular.em.equipmentAlarm.service.EquipmentAlarmService;
import cn.stylefeng.guns.modular.em.equipmentStatus.service.EquipmentStatusService;
import cn.stylefeng.guns.modular.gm.greaseManage.service.GreaseManageService;
import cn.stylefeng.guns.modular.om.productionOrdeInfo.model.params.ProductionOrdeInfoParam;
import cn.stylefeng.guns.modular.om.productionOrdeInfo.model.result.ProductionOrdeInfoResult;
import cn.stylefeng.guns.modular.om.productionOrdeInfo.service.ProductionOrdeInfoService;
@@ -139,12 +140,15 @@
    @Autowired
    private LocationInfoService locationInfoService;
    @Autowired
    private GreaseManageService greaseManageService;
    @Override
    public void run(String... args) throws Exception {
        if(GlobalVariable.TERMINATED) {
            opc.init(productionOrdeInfoService,passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
                    equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
                    repairManageInfoService,locationInfoService);
                    repairManageInfoService,locationInfoService,greaseManageService);
            GlobalVariable.PRODUCT_TYPE_MAP.put("191.220001-01","1");
            GlobalVariable.PRODUCT_TYPE_MAP.put("191.220003-01","2");
guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/opc/OPCComm.java
@@ -8,6 +8,7 @@
import cn.stylefeng.guns.modular.dq.materialTraceability.service.MaterialTraceabilityService;
import cn.stylefeng.guns.modular.em.equipmentAlarm.service.EquipmentAlarmService;
import cn.stylefeng.guns.modular.em.equipmentStatus.service.EquipmentStatusService;
import cn.stylefeng.guns.modular.gm.greaseManage.service.GreaseManageService;
import cn.stylefeng.guns.modular.om.productionOrdeInfo.service.ProductionOrdeInfoService;
import cn.stylefeng.guns.modular.sc.repairManageInfo.service.RepairManageInfoService;
import cn.stylefeng.guns.modular.sc.serialNumbersConf.service.SerialNumbersConfService;
@@ -103,6 +104,8 @@
    @Autowired
    public LocationInfoService locationInfoService;
    @Autowired
    public GreaseManageService greaseManageService;
    //OP010
    private Item OP010_F_HEART_BEAT;//心跳
@@ -181,7 +184,7 @@
    private Item OP050_S_PRODUCT_STATE_CODE;//产品状态编码
    private Item OP050_OIL_STATE;//油脂状态
    //OP070
    private Item OP070_F_HEART_BEAT;//心跳
    private Item OP070_J_PLC_START;//PLC开始
@@ -461,6 +464,7 @@
    private Item BOP030_S_PRODUCT_STATE_CODE;//产品状态编码
    private Item BOP030_OIL_STATE;//油脂状态
    //BOP030B
    private Item BOP030B_F_HEART_BEAT;//心跳
    private Item BOP030B_J_PLC_START;//PLC开始
@@ -698,6 +702,7 @@
    private Item DOP020_S_PRODUCT_STATE_CODE;//产品状态编码
    private Item DOP020_OIL_STATE;//油脂状态
    /**
     * 单例模式
@@ -721,7 +726,8 @@
                     MaterialTraceabilityService materialTraceabilityService,
                     EquipmentInfoService equipmentInfoService,
                     RepairManageInfoService repairManageInfoService,
                     LocationInfoService locationInfoService
                     LocationInfoService locationInfoService,
                     GreaseManageService greaseManageService
                    ) throws Exception {
        this.productionOrdeInfoService = productionOrdeInfoService;
        this.passingStationCollectionService = passingStationCollectionService;
@@ -734,6 +740,7 @@
        this.equipmentInfoService = equipmentInfoService;
        this.repairManageInfoService = repairManageInfoService;
        this.locationInfoService = locationInfoService;
        this.greaseManageService = greaseManageService;
        // 加载配置文件
        final ConnectionInformation ci = getCLSIDConnectionInfomation();
@@ -961,7 +968,7 @@
            OP050_S_PRODUCT_STATE_CODE = OP050_GROUP.addItem((OPCElement.OP050_S_PRODUCT_STATE_CODE));//产品状态编码
            OP050_OIL_STATE = OP050_GROUP.addItem((OPCElement.OP050_OIL_STATE));//油脂状态
            //OP070组
            final Group OP070_GROUP = server.addGroup("OP070");
@@ -1243,6 +1250,10 @@
            BOP030_S_PRODUCT_STATE_CODE = BOP030_GROUP.addItem((OPCElement.BOP030_S_PRODUCT_STATE_CODE));//产品状态编码
            BOP030_OIL_STATE = BOP030_GROUP.addItem((OPCElement.BOP030_OIL_STATE));//油脂状态
            //BOP030B组
            final Group BOP030B_GROUP = server.addGroup("BOP030B");
            BOP030B_F_HEART_BEAT = BOP030B_GROUP.addItem((OPCElement.BOP030B_F_HEART_BEAT));//心跳
@@ -1477,6 +1488,10 @@
            DOP020_S_SFC_CODE = DOP020_GROUP.addItem((OPCElement.DOP020_S_SFC_CODE));//总成编码
            DOP020_S_PRODUCT_STATE_CODE = DOP020_GROUP.addItem((OPCElement.DOP020_S_PRODUCT_STATE_CODE));//产品状态编码
            DOP020_OIL_STATE = DOP020_GROUP.addItem((OPCElement.DOP020_OIL_STATE));//油脂状态
            // start reading
            access.bind();
        } catch (final JIException e) {
@@ -3175,4 +3190,20 @@
    public Item getDOP010_P_REPAIR_LOCATION() {
        return DOP010_P_REPAIR_LOCATION;
    }
    public GreaseManageService getGreaseManageService() {
        return greaseManageService;
    }
    public Item getOP050_OIL_STATE() {
        return OP050_OIL_STATE;
    }
    public Item getBOP030_OIL_STATE() {
        return BOP030_OIL_STATE;
    }
    public Item getDOP020_OIL_STATE() {
        return DOP020_OIL_STATE;
    }
}
guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/opc/OPCElement.java
@@ -100,6 +100,8 @@
    public static final String OP050_S_PRODUCT_STATE_CODE = OP050_ITEM + "S_PRODUCT_STATE_CODE";//产品状态编码
    public static final String OP050_OIL_STATE = OP050_ITEM + "OIL_STATE";//油脂状态
    /**
     * OP070
@@ -437,6 +439,9 @@
    public static final String BOP030_S_PRODUCT_STATE_CODE = BOP030_ITEM + "S_PRODUCT_STATE_CODE";//产品状态编码
    public static final String BOP030_OIL_STATE = BOP030_ITEM + "OIL_STATE";//油脂状态
    /**
     * BOP030B
     */
@@ -725,4 +730,7 @@
    public static final String DOP020_S_PRODUCT_STATE_CODE = DOP020_ITEM + "S_PRODUCT_STATE_CODE";//产品状态编码
    public static final String DOP020_OIL_STATE = DOP020_ITEM + "OIL_STATE";//油脂状态
}
guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/server/DOP020/impl/DOP020ServerInterfaceImpl.java
@@ -8,6 +8,9 @@
import cn.stylefeng.guns.modular.cm.paramCollection.service.ParamCollectionService;
import cn.stylefeng.guns.modular.cm.passingStationCollection.model.params.PassingStationCollectionParam;
import cn.stylefeng.guns.modular.cm.passingStationCollection.service.PassingStationCollectionService;
import cn.stylefeng.guns.modular.gm.greaseManage.model.params.GreaseManageParam;
import cn.stylefeng.guns.modular.gm.greaseManage.model.result.GreaseManageResult;
import cn.stylefeng.guns.modular.gm.greaseManage.service.GreaseManageService;
import cn.stylefeng.guns.plcserver.opc.GlobalVariable;
import cn.stylefeng.guns.plcserver.opc.OPCComm;
import cn.stylefeng.guns.plcserver.opc.unit.OPCUnit;
@@ -19,6 +22,8 @@
import org.openscada.opc.lib.da.Group;
import org.openscada.opc.lib.da.Item;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.Date;
import java.util.List;
@@ -68,7 +73,7 @@
                        handleFinsh();
                    }
                }
                handleOilState();
            }else{
                logger.info("DOP020工位与PLC断开,请检查PLC或网络是否异常!");
            }
@@ -82,6 +87,27 @@
        }
    }
    public void handleOilState(){
        GreaseManageParam param = new GreaseManageParam();
        GreaseManageService greaseManageService = opc.greaseManageService;
        param.setLocationCode(LOCATION_CODE);
        List<GreaseManageResult> list = greaseManageService.findListBySpec(param);
        if(list.size()>0) {
            String duaDate = list.get(0).getDuaDate();
            LocalDate date1 = LocalDate.parse(duaDate); // 第一个日期
            LocalDate date2 = LocalDate.now(); // 当前日期(或者指定其他日期)
            long daysBetween = ChronoUnit.DAYS.between(date1, date2);
            if(daysBetween>0){
                OPCUnit.write(opc.getOP050_OIL_STATE(), "false"); //写油脂状态
            }else{
                OPCUnit.write(opc.getOP050_OIL_STATE(), "true"); //写油脂状态
            }
            logger.info("到期日期:"+date1+"当前日期:"+date1+"剩余天数::"+daysBetween);
        }
    }
    //PC读工单
    public void handleOrder() {
        IN_TIME = DateTool.getLocalTimeForDate();
guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/server/EOP030/impl/EOP030ServerInterfaceImpl.java
@@ -8,6 +8,9 @@
import cn.stylefeng.guns.modular.cm.paramCollection.service.ParamCollectionService;
import cn.stylefeng.guns.modular.cm.passingStationCollection.model.params.PassingStationCollectionParam;
import cn.stylefeng.guns.modular.cm.passingStationCollection.service.PassingStationCollectionService;
import cn.stylefeng.guns.modular.gm.greaseManage.model.params.GreaseManageParam;
import cn.stylefeng.guns.modular.gm.greaseManage.model.result.GreaseManageResult;
import cn.stylefeng.guns.modular.gm.greaseManage.service.GreaseManageService;
import cn.stylefeng.guns.plcserver.opc.GlobalVariable;
import cn.stylefeng.guns.plcserver.opc.OPCComm;
import cn.stylefeng.guns.plcserver.opc.unit.OPCUnit;
@@ -19,6 +22,8 @@
import org.openscada.opc.lib.da.Group;
import org.openscada.opc.lib.da.Item;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.Date;
import java.util.List;
@@ -69,6 +74,7 @@
                    }
                }
                handleOilState();
            }else{
                logger.info("EOP030工位与PLC断开,请检查PLC或网络是否异常!");
            }
@@ -82,6 +88,27 @@
        }
    }
    public void handleOilState(){
        GreaseManageParam param = new GreaseManageParam();
        GreaseManageService greaseManageService = opc.greaseManageService;
        param.setLocationCode(LOCATION_CODE);
        List<GreaseManageResult> list = greaseManageService.findListBySpec(param);
        if(list.size()>0) {
            String duaDate = list.get(0).getDuaDate();
            LocalDate date1 = LocalDate.parse(duaDate); // 第一个日期
            LocalDate date2 = LocalDate.now(); // 当前日期(或者指定其他日期)
            long daysBetween = ChronoUnit.DAYS.between(date1, date2);
            if(daysBetween>0){
                OPCUnit.write(opc.getOP050_OIL_STATE(), "false"); //写油脂状态
            }else{
                OPCUnit.write(opc.getOP050_OIL_STATE(), "true"); //写油脂状态
            }
            logger.info("到期日期:"+date1+"当前日期:"+date1+"剩余天数::"+daysBetween);
        }
    }
    //PC读工单
    public void handleOrder() {
        IN_TIME = DateTool.getLocalTimeForDate();
guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/server/OP050/impl/OP050ServerInterfaceImpl.java
@@ -8,6 +8,9 @@
import cn.stylefeng.guns.modular.cm.paramCollection.service.ParamCollectionService;
import cn.stylefeng.guns.modular.cm.passingStationCollection.model.params.PassingStationCollectionParam;
import cn.stylefeng.guns.modular.cm.passingStationCollection.service.PassingStationCollectionService;
import cn.stylefeng.guns.modular.gm.greaseManage.model.params.GreaseManageParam;
import cn.stylefeng.guns.modular.gm.greaseManage.model.result.GreaseManageResult;
import cn.stylefeng.guns.modular.gm.greaseManage.service.GreaseManageService;
import cn.stylefeng.guns.plcserver.opc.GlobalVariable;
import cn.stylefeng.guns.plcserver.opc.OPCComm;
import cn.stylefeng.guns.plcserver.opc.unit.OPCUnit;
@@ -19,6 +22,8 @@
import org.openscada.opc.lib.da.Group;
import org.openscada.opc.lib.da.Item;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.Date;
import java.util.List;
@@ -69,6 +74,8 @@
                    }
                }
                handleOilState();
            }else{
                logger.info("OP050工位与PLC断开,请检查PLC或网络是否异常!");
            }
@@ -82,6 +89,28 @@
        }
    }
    public void handleOilState(){
        GreaseManageParam param = new GreaseManageParam();
        GreaseManageService greaseManageService = opc.greaseManageService;
        param.setLocationCode(LOCATION_CODE);
        List<GreaseManageResult> list = greaseManageService.findListBySpec(param);
        if(list.size()>0) {
            String duaDate = list.get(0).getDuaDate();
            LocalDate date1 = LocalDate.parse(duaDate); // 第一个日期
            LocalDate date2 = LocalDate.now(); // 当前日期(或者指定其他日期)
            long daysBetween = ChronoUnit.DAYS.between(date1, date2);
            if(daysBetween>0){
                OPCUnit.write(opc.getOP050_OIL_STATE(), "false"); //写油脂状态
            }else{
                OPCUnit.write(opc.getOP050_OIL_STATE(), "true"); //写油脂状态
            }
            logger.info("到期日期:"+date1+"当前日期:"+date1+"剩余天数::"+daysBetween);
        }
    }
    //PC读工单
    public void handleOrder() {
        IN_TIME = DateTool.getLocalTimeForDate();