package cn.estsh.i3plus.pojo.andon.sqlpack;

import cn.estsh.i3plus.pojo.andon.bean.*;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import org.springframework.util.StringUtils;

/**
 * @Description : 安灯对象查询封装
 * @Reference :
 * @Author : silliter.yuan
 * @CreateDate : 2019-05-10 10:45
 * @Modify:
 **/
public class AndonHqlPack {

    /**
     * 安灯通知方式查询封装
     * @param andonCellGroupCfg
     * @return
     */
    public static DdlPackBean getAndonCellGroupCfg(AndonCellGroupCfg andonCellGroupCfg) {
        DdlPackBean packBean = DdlPackBean.getDdlPackBean();
        DdlPreparedPack.getStringEqualPack(andonCellGroupCfg.getOrganizeCode(), "organizeCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonCellGroupCfg.getWorkCenterCode(), "workCenterCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonCellGroupCfg.getCellGroup(), "cellGroup", packBean);
        DdlPreparedPack.getStringEqualPack(andonCellGroupCfg.getGroupCode(), "groupCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonCellGroupCfg.getGroupName(), "groupName", packBean);
        return packBean;
    }

    /**
     * 安灯通知方式查询封装
     * @param andonResponse
     * @return
     */
    public static DdlPackBean getAndonResponse(AndonResponse andonResponse) {
        DdlPackBean packBean = DdlPackBean.getDdlPackBean();
        DdlPreparedPack.getStringEqualPack(andonResponse.getOrganizeCode(), "organizeCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonResponse.getResponseCode(), "responseCode", packBean);
        return packBean;
    }

    /**
     * 安灯通知记录查询条件封装
     * @param andonMessageRecord
     * @return
     */
    public static DdlPackBean getAndonMessageRecord(AndonMessageRecord andonMessageRecord) {
        DdlPackBean packBean = DdlPackBean.getDdlPackBean();
        DdlPreparedPack.getStringEqualPack(andonMessageRecord.getOrganizeCode(), "organizeCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonMessageRecord.getWorkCenterCode(), "workCenterCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonMessageRecord.getAlarmCode(), "alarmCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonMessageRecord.getAndonOrderNo(), "andonOrderNo", packBean);
        DdlPreparedPack.getStringEqualPack(andonMessageRecord.getRpCode(), "rpCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonMessageRecord.getRpLevel(), "rpLevel", packBean);
        DdlPreparedPack.getStringEqualPack(andonMessageRecord.getRpObjectCode(), "rpObjectCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonMessageRecord.getStatusCode(), "statusCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonMessageRecord.getIsSucceed(), "isSucceed", packBean);
        if(!StringUtils.isEmpty(andonMessageRecord.getCreateDateTimeStart()) || !StringUtils.isEmpty(andonMessageRecord.getCreateDateTimeEnd())){
            DdlPreparedPack.timeBuilder(andonMessageRecord.getCreateDateTimeStart(), andonMessageRecord.getCreateDateTimeEnd(), "createDatetime", packBean, true);
        }
        return packBean;
    }

    /**
     * 工作单元呼叫原因配置查询条件封装
     * @param andonCellAlarmCause
     * @return
     */
    public static DdlPackBean getAndonCellAlarmCause(AndonCellAlarmCause andonCellAlarmCause) {
        DdlPackBean packBean = DdlPackBean.getDdlPackBean();
        DdlPreparedPack.getStringEqualPack(andonCellAlarmCause.getOrganizeCode(), "organizeCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonCellAlarmCause.getWorkCenterCode(), "workCenterCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonCellAlarmCause.getWorkCellCode(), "workCellCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonCellAlarmCause.getAcCode(), "acCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonCellAlarmCause.getAlarmCode(), "alarmCode", packBean);
        return packBean;
    }

    /**
     * 工作单元事件方法配置查询条件封装
     * @param andonEventMethod
     * @return
     */
    public static DdlPackBean getAndonCellEventMethod(AndonCellEventMethod andonEventMethod) {
        DdlPackBean packBean = DdlPackBean.getDdlPackBean();
        DdlPreparedPack.getStringEqualPack(andonEventMethod.getOrganizeCode(), "organizeCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonEventMethod.getWorkCenterCode(), "workCenterCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonEventMethod.getWorkCellCode(), "workCellCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonEventMethod.getAlarmCode(), "alarmCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonEventMethod.getEmCode(), "emCode", packBean);
        return packBean;
    }

    /**
     * 工作单元事件原因查询封装
     * @param andonEventCause
     * @return
     */
    public static DdlPackBean getAndonCellEventCause(AndonCellEventCause andonEventCause) {
        DdlPackBean packBean = DdlPackBean.getDdlPackBean();
        DdlPreparedPack.getStringEqualPack(andonEventCause.getOrganizeCode(), "organizeCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonEventCause.getWorkCenterCode(), "workCenterCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonEventCause.getWorkCellCode(), "workCellCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonEventCause.getAlarmCode(), "alarmCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonEventCause.getEcCode(), "ecCode", packBean);
        return packBean;
    }

    /**
     * 工作单元事件现象查询条件封装
     * @param andonEventPhenoMenon
     * @return
     */
    public static DdlPackBean getAndonCellEventPhenomenon(AndonCellEventPhenomenon andonEventPhenoMenon) {
        DdlPackBean packBean = DdlPackBean.getDdlPackBean();
        DdlPreparedPack.getStringEqualPack(andonEventPhenoMenon.getOrganizeCode(), "organizeCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonEventPhenoMenon.getWorkCenterCode(), "workCenterCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonEventPhenoMenon.getWorkCellCode(), "workCellCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonEventPhenoMenon.getAlarmCode(), "alarmCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonEventPhenoMenon.getEpmCode(), "epmCode", packBean);
        return packBean;
    }

    /**
     * 广播条件查询
     * @param andonBroadCast
     * @return
     */
    public static DdlPackBean getAndonBroadCast(AndonBroadCast andonBroadCast) {
        DdlPackBean packBean = DdlPackBean.getDdlPackBean();
        DdlPreparedPack.getStringEqualPack(andonBroadCast.getOrganizeCode(), "organizeCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonBroadCast.getWorkCenterCode(), "workCenterCode", packBean);
        DdlPreparedPack.getStringLikerPack(andonBroadCast.getTargetIds(), "targetIds", packBean);
        DdlPreparedPack.getStringEqualPack(andonBroadCast.getGroupNo(), "groupNo", packBean);
        DdlPreparedPack.getStringEqualPack(andonBroadCast.getDeviceDec(), "deviceDec", packBean);
        DdlPreparedPack.getNumEqualPack(andonBroadCast.getIsValid(),"isValid",packBean);
        return packBean;
    }

    /**
     * 广播配置条件查询
     * @param andonBroadCastCfg
     * @return
     */
    public static DdlPackBean getAndonBroadCastCfg(AndonBroadCastCfg andonBroadCastCfg) {
        DdlPackBean packBean = DdlPackBean.getDdlPackBean();
        DdlPreparedPack.getStringEqualPack(andonBroadCastCfg.getOrganizeCode(), "organizeCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonBroadCastCfg.getWorkCenterCode(), "workCenterCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonBroadCastCfg.getAlarmCode(), "alarmCode", packBean);
        DdlPreparedPack.getStringLikerPack(andonBroadCastCfg.getGroupNo(), "groupNo", packBean);
        DdlPreparedPack.getNumEqualPack(andonBroadCastCfg.getIsValid(),"isValid",packBean);
        return packBean;
    }

    /**
     * 自处理维护配置
     * @param andonDisposalMaintenCfg
     * @return
     */
    public static DdlPackBean getAndonDisposalMaintenCfg(AndonDisposalMaintenCfg andonDisposalMaintenCfg) {
        DdlPackBean packBean = DdlPackBean.getDdlPackBean();
        DdlPreparedPack.getStringEqualPack(andonDisposalMaintenCfg.getOrganizeCode(), "organizeCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonDisposalMaintenCfg.getAlarmCode(), "alarmCode", packBean);
        DdlPreparedPack.getNumEqualPack(andonDisposalMaintenCfg.getIsValid(),"isValid",packBean);
        return packBean;
    }

    /**
     * 安灯附属表
     * @param andonQueueAttach
     * @return
     */
    public static DdlPackBean getAndonQueueAttach(AndonQueueAttach andonQueueAttach) {
        DdlPackBean packBean = DdlPackBean.getDdlPackBean();
        DdlPreparedPack.getStringEqualPack(andonQueueAttach.getOrganizeCode(), "organizeCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonQueueAttach.getAndonOrderNo(), "andonOrderNo", packBean);
        DdlPreparedPack.getNumEqualPack(andonQueueAttach.getIsValid(),"isValid",packBean);
        return packBean;
    }


    /**
     * genju 安灯队列参数查询安灯队列
     * @param andonManageQueue
     * @return
     */
    public static DdlPackBean getAndonQueuePack(AndonManageQueue andonManageQueue, String[] statusCodeArray) {
        DdlPackBean packBean = DdlPackBean.getDdlPackBean();
        DdlPreparedPack.getStringEqualPack(andonManageQueue.getOrganizeCode(), "organizeCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonManageQueue.getWorkCenterCode(), "workCenterCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonManageQueue.getWorkCellCode(), "workCellCode", packBean);
        DdlPreparedPack.getInPackArray(statusCodeArray, "statusCode", packBean);
        return packBean;
    }
    /**
     * 封装公用查询参数
     *
     * @param bean   实体对象
     * @param hqlStr 查询语句
     * @return 封装完成的查询语句
     */
    public static DdlPackBean getStringBuilderPack(BaseBean bean, DdlPackBean hqlStr) {

        // 判断工厂代码是否为空
        if (!StringUtils.isEmpty(bean.getOrganizeCode())) {
            DdlPreparedPack.getStringEqualPack(bean.getOrganizeCode(), "organizeCode", hqlStr);
        }

        // 封装有效状态和删除状态
        DdlPreparedPack.getNumEqualPack(bean.getIsValid(), "isValid", hqlStr);
        DdlPreparedPack.getNumEqualPack(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), "isDeleted", hqlStr);

        return hqlStr;
    }

    /**
     * 按灯PLC查询条件
     *
     * @param andonPLC plc实体
     * @return
     */
    public static DdlPackBean packHqlAndonPLCInfo(AndonPLC andonPLC) {
        DdlPackBean result = new DdlPackBean();

        //查询参数封装
        DdlPreparedPack.getStringEqualPack(andonPLC.getWorkCenterCode(), "workCenterCode", result);
        DdlPreparedPack.getStringEqualPack(andonPLC.getWorkCellCode(), "workCellCode", result);
        DdlPreparedPack.getStringEqualPack(andonPLC.getNodeIP(), "nodeIP", result);
        DdlPreparedPack.getStringEqualPack(andonPLC.getChannelName(), "channelName", result);
        DdlPreparedPack.getStringEqualPack(andonPLC.getTagName(), "tagName", result);
        DdlPreparedPack.getStringEqualPack(andonPLC.getTagAddress(), "tagAddress", result);
        DdlPreparedPack.getStringEqualPack(andonPLC.getTagBusinessType(), "tagBusinessType", result);
        DdlPreparedPack.getStringEqualPack(andonPLC.getTagType(), "tagType", result);
        DdlPreparedPack.getStringEqualPack(andonPLC.getAlarmCode(), "alarmCode", result);
        DdlPreparedPack.getStringEqualPack(andonPLC.getGroupNo(), "groupNo", result);

        getStringBuilderPack(andonPLC, result);
        return result;
    }

    /**
     * 按条件查询工作中心
     * @param mesWorkCenter
     * @return
     */
    public static DdlPackBean packHqlMesWorkCenter(MesWorkCenter mesWorkCenter){
        DdlPackBean result = new DdlPackBean();

        DdlPreparedPack.getStringEqualPack(mesWorkCenter.getWorkCenterCode(), "workCenterCode", result);
        getStringBuilderPack(mesWorkCenter, result);

        return result;
    }

    /**
     * 按条件查询工作单元（工位）
     * @param mesWorkCell
     * @return
     */
    public static DdlPackBean packHqlMesWorkCell(MesWorkCell mesWorkCell){
        DdlPackBean result = new DdlPackBean();
        DdlPreparedPack.getStringEqualPack(mesWorkCell.getOrganizeCode(), "organizeCode", result);
        DdlPreparedPack.getStringEqualPack(mesWorkCell.getWorkCenterCode(), "workCenterCode", result);
        DdlPreparedPack.getStringEqualPack(mesWorkCell.getWorkCellCode(), "workCellCode", result);
        getStringBuilderPack(mesWorkCell, result);

        return result;
    }

    /**
     * 按条件查询设备
     * @param mesEquipment
     * @return
     */
    public static DdlPackBean packHqlMesEquipment(MesEquipment mesEquipment){
        DdlPackBean result = new DdlPackBean();

        DdlPreparedPack.getStringEqualPack(mesEquipment.getWorkCenterCode(), "workCenterCode", result);
        DdlPreparedPack.getStringEqualPack(mesEquipment.getWorkCellCode(), "workCellCode", result);
        getStringBuilderPack(mesEquipment, result);

        return result;
    }

    /**
     * 按条件查询班次
     * @param mesShift
     * @return
     */
    public static DdlPackBean packHqlMesShift(MesShift mesShift){
        DdlPackBean result = new DdlPackBean();

        DdlPreparedPack.getStringEqualPack(mesShift.getWorkCenterCode(), "workCenterCode", result);
        getStringBuilderPack(mesShift, result);

        return result;
    }

    /**
     * 按条件查询ANDON呼叫原因,==
     * @param andonAlarmCause
     * @return
     */
    public static DdlPackBean packHqlAndonAlarmCause(AndonAlarmCause andonAlarmCause){
        DdlPackBean result = new DdlPackBean();

        DdlPreparedPack.getStringEqualPack(andonAlarmCause.getAcCode(),"acCode", result);
        DdlPreparedPack.getStringEqualPack(andonAlarmCause.getAcName(),"acName", result);
        DdlPreparedPack.getStringEqualPack(andonAlarmCause.getAlarmCode(), "alarmCode", result);
        getStringBuilderPack(andonAlarmCause, result);

        return result;
    }
    /**
     * 按条件模糊查询ANDON呼叫原因,
     * @param andonAlarmCause
     * @return
     */
    public static DdlPackBean packHqlAndonAlarmCauseLike(AndonAlarmCause andonAlarmCause){
        DdlPackBean result = new DdlPackBean();
        DdlPreparedPack.getStringEqualPack(andonAlarmCause.getAlarmCode(), "alarmCode", result);
        DdlPreparedPack.getStringLikerPack(andonAlarmCause.getAcCode(),"acCode", result);
        DdlPreparedPack.getStringLikerPack(andonAlarmCause.getAcName(),"acName", result);
        getStringBuilderPack(andonAlarmCause, result);
        return result;
    }

    /**
     * 按条件查询ANDON事件处理方法
     * @param andonEventMethod
     * @return
     */
    public static DdlPackBean packHqlAndonAlarmEventMethod(AndonEventMethod andonEventMethod){
        DdlPackBean result = new DdlPackBean();
        DdlPreparedPack.getStringEqualPack(andonEventMethod.getAlarmCode(), "alarmCode", result);
        getStringBuilderPack(andonEventMethod, result);
        return result;
    }

    /**
     * 按条件查询ANDON事件原因
     * @param andonEventCause
     * @return
     */
    public static DdlPackBean packHqlAndonEventCause(AndonEventCause andonEventCause){
        DdlPackBean result = new DdlPackBean();
        DdlPreparedPack.getStringEqualPack(andonEventCause.getAlarmCode(), "alarmCode", result);
        getStringBuilderPack(andonEventCause, result);
        return  result;
    }

    /**
     * 按条件查询安灯知识库
     * @param andonKnowledgeBase
     * @return
     */
    public static DdlPackBean packAndonKnowlegeBase(AndonKnowledgeBase andonKnowledgeBase){
        DdlPackBean packBean = new DdlPackBean();
        DdlPreparedPack.getStringEqualPack(andonKnowledgeBase.getAndonOrderNo(), "andonOrderNo", packBean);
        DdlPreparedPack.getStringEqualPack(andonKnowledgeBase.getAlarmCode(), "alarmCode", packBean);
        DdlPreparedPack.getNumEqualPack(andonKnowledgeBase.getFlowStatus(), "flowStatus", packBean);
        DdlPreparedPack.getStringEqualPack(andonKnowledgeBase.getOrganizeCode(), "organizeCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonKnowledgeBase.getWorkCenterCode(), "workCenterCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonKnowledgeBase.getWorkCellCode(), "workCellCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonKnowledgeBase.getAcCode(), "acCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonKnowledgeBase.getEcCode(), "ecCode", packBean);
        DdlPreparedPack.getStringEqualPack(andonKnowledgeBase.getEmCode(), "emCode", packBean);

        if(!StringUtils.isEmpty(andonKnowledgeBase.getCreateDateTimeStart()) || !StringUtils.isEmpty(andonKnowledgeBase.getCreateDateTimeEnd())){
            DdlPreparedPack.timeBuilder(andonKnowledgeBase.getCreateDateTimeStart(), andonKnowledgeBase.getCreateDateTimeEnd(), "createDatetime", packBean, true);
        }

        getStringBuilderPack(andonKnowledgeBase, packBean);
        packBean.setOrderByStr(andonKnowledgeBase.orderBy());
        return packBean;
    }

    /**
     * 按条件查询按灯队列信息
     * @param andonManageQueue
     * @return
     */
    public static DdlPackBean packHqlAndonManageQueueUseByPlc(AndonManageQueue andonManageQueue, Object[] obj){
        DdlPackBean result = new DdlPackBean();
        DdlPreparedPack.getStringEqualPack(andonManageQueue.getOrganizeCode(), "organizeCode", result);
        DdlPreparedPack.getStringEqualPack(andonManageQueue.getWorkCellCode(), "workCellCode", result);
        DdlPreparedPack.getStringEqualPack(andonManageQueue.getWorkCenterCode(), "workCenterCode", result);
        DdlPreparedPack.getStringEqualPack(andonManageQueue.getEquipmentCode(), "equipmentCode", result);
        DdlPreparedPack.getInPackArray(obj, "statusCode", result);
        DdlPreparedPack.getStringEqualPack(andonManageQueue.getAlarmCode(), "alarmCode", result);
        getStringBuilderPack(andonManageQueue, result);
        return result;
    }

    /**
     * 按条件查询按灯队列信息
     * @param andonManageQueue
     * @return
     */
    public static DdlPackBean packHqlAndonManageQueue(AndonManageQueue andonManageQueue, Object[] obj){
        DdlPackBean result = new DdlPackBean();
        DdlPreparedPack.getStringEqualPack(andonManageQueue.getOrganizeCode(), "organizeCode", result);
        DdlPreparedPack.getStringEqualPack(andonManageQueue.getWorkCellCode(), "workCellCode", result);
        DdlPreparedPack.getStringEqualPack(andonManageQueue.getWorkCenterCode(), "workCenterCode", result);
        DdlPreparedPack.getStringEqualPack(andonManageQueue.getEquipmentCode(), "equipmentCode", result);
        DdlPreparedPack.getStringEqualPack(andonManageQueue.getActionCode(), "actionCode", result);
        DdlPreparedPack.getStringEqualPack(andonManageQueue.getAndonOrderNo(), "andonOrderNo", result);
        DdlPreparedPack.getStringEqualPack(andonManageQueue.getShiftCode(), "shiftCode", result);
        DdlPreparedPack.getInPackList(andonManageQueue.getStatusList(), "statusCode", result); // 只有安灯任务管理特殊用途
        DdlPreparedPack.getInPackArray(obj, "statusCode", result);
        DdlPreparedPack.getInPackList(andonManageQueue.getTypeList(), "alarmCode", result); // 只有安灯任务管理特殊用途
        DdlPreparedPack.getStringEqualPack(andonManageQueue.getAlarmCode(), "alarmCode", result);

        if(!StringUtils.isEmpty(andonManageQueue.getCallTimeStart()) || !StringUtils.isEmpty(andonManageQueue.getCallTimeEnd())){
            DdlPreparedPack.timeBuilder(andonManageQueue.getCallTimeStart(), andonManageQueue.getCallTimeEnd(), "callTime", result, true);
        }
        getStringBuilderPack(andonManageQueue, result);
        // 根据优先级倒序，序号升序排序
//        DdlPreparedPack.getOrderByPack(new Object[]{2, 1},
//                new String[]{"priorityLevel", "seq"}, result);

         result.setOrderByStr(andonManageQueue.orderBy());

        return result;
    }

    /**
     * 按条件查询安灯自处理配置
     * @param andonDisposalCfg
     * @return
     */
    public static DdlPackBean packHqlAndonDisposalCfg(AndonDisposalCfg andonDisposalCfg){
        DdlPackBean result = new DdlPackBean();

        DdlPreparedPack.getStringEqualPack(andonDisposalCfg.getWorkCenterCode(),"workCenterCode", result);
        DdlPreparedPack.getStringEqualPack(andonDisposalCfg.getWorkCellCode(),"workCellCode", result);
        DdlPreparedPack.getStringEqualPack(andonDisposalCfg.getAlarmCode(),"alarmCode", result);
        DdlPreparedPack.getStringEqualPack(andonDisposalCfg.getAcCode(),"acCode", result);
        DdlPreparedPack.getInPackArray(andonDisposalCfg.getFlowStatusArray(), "flowStatus", result);
        DdlPreparedPack.getNumEqualPack(andonDisposalCfg.getFlowStatus(),"flowStatus", result);

        getStringBuilderPack(andonDisposalCfg, result);
        return  result;
    }

    /**
     * 按条件查询按灯记录信息
     * @param andonManageRecord
     * @return
     */
    public static DdlPackBean packHqlAndonManageRecord(AndonManageRecord andonManageRecord, Object[] obj){
        DdlPackBean result = new DdlPackBean();

        DdlPreparedPack.getStringEqualPack(andonManageRecord.getAndonOrderNo(), "andonOrderNo", result);
        DdlPreparedPack.getStringEqualPack(andonManageRecord.getWorkCellCode(), "workCellCode", result);
        DdlPreparedPack.getStringEqualPack(andonManageRecord.getWorkCenterCode(), "workCenterCode", result);
        DdlPreparedPack.getStringEqualPack(andonManageRecord.getEquipmentCode(), "equipmentCode", result);
        DdlPreparedPack.getStringEqualPack(andonManageRecord.getAlarmCode(), "alarmCode", result);
        DdlPreparedPack.getStringEqualPack(andonManageRecord.getActionCode(), "actionCode", result);
        DdlPreparedPack.getInPackArray(obj, "statusCode", result);

        getStringBuilderPack(andonManageRecord, result);

//        // 根据优先级倒序，序号升序排序
//        DdlPreparedPack.getOrderByPack(new Object[]{2, 1},
//                new String[]{"priorityLevel", "seq"}, result);
        // 信息时间排序
        DdlPreparedPack.getOrderDefault(andonManageRecord);
        result.setOrderByStr(andonManageRecord.orderBy());

        return result;
    }

    /**
     * 按条件查询按灯系统配置信息
     * @param andonConfig
     * @return
     */
    public static DdlPackBean packHqlAndonConfig(AndonConfig andonConfig){
        DdlPackBean result = new DdlPackBean();
        DdlPreparedPack.getStringEqualPack(andonConfig.getConfigCode(), "configCode", result);
        DdlPreparedPack.getNumEqualPack(andonConfig.getConfigGroup(), "configGroup", result);
        DdlPreparedPack.getNumEqualPack(andonConfig.getConfigType(), "configType", result);
        getStringBuilderPack(andonConfig, result);
        return result;
    }

    /**
     * 通用查询条件
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getAllBaseDataByNormalPro(BaseBean baseBean, String organizeCode) {
        DdlPackBean packBean = new DdlPackBean();
        DdlPreparedPack.getStringEqualPack(organizeCode, "organizeCode", packBean);
        DdlPreparedPack.getNumEqualPack(baseBean.getIsValid(), "isValid", packBean);
        DdlPreparedPack.getNumEqualPack(CommonEnumUtil.IS_DEAL.NO.getValue(), "isDeleted", packBean);
        return packBean;
    }

    /**
     * MES区域信息查询条件封装
     * @param mesArea
     * @return
     */
    public static DdlPackBean getMesArea(MesArea mesArea, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesArea, organizeCode);
        DdlPreparedPack.getStringEqualPack(mesArea.getAreaCode(), "areaCode", packBean);
        packBean.setOrderByStr(mesArea.orderBy());

        return packBean;
    }

    /**
     * MES工作中心信息查询条件封装
     * @param mesWorkCenter
     * @return
     */
    public static DdlPackBean getMesWorkCenter(MesWorkCenter mesWorkCenter, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesWorkCenter, organizeCode);

        DdlPreparedPack.getStringEqualPack(mesWorkCenter.getWorkCenterCode(), "workCenterCode", packBean);
        DdlPreparedPack.getStringEqualPack(mesWorkCenter.getAreaCode(), "areaCode", packBean);
        packBean.setOrderByStr(mesWorkCenter.orderBy());

        return packBean;
    }

    /**
     * MES工作单元信息查询条件封装
     * @param mesWorkCell
     * @return
     */
    public static DdlPackBean getMesWorkCell(MesWorkCell mesWorkCell, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesWorkCell, organizeCode);

        DdlPreparedPack.getStringEqualPack(mesWorkCell.getWorkCenterCode(), "workCenterCode", packBean);
        DdlPreparedPack.getStringEqualPack(mesWorkCell.getAreaCode(), "areaCode", packBean);
        DdlPreparedPack.getStringEqualPack(mesWorkCell.getWorkCellCode(), "workCellCode", packBean);

        packBean.setOrderByStr(mesWorkCell.orderBy());

        return packBean;
    }

    /**
     * MES设备信息查询条件封装
     * @param mesEquipment
     * @return
     */
    public static DdlPackBean getMesEquipment(MesEquipment mesEquipment, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesEquipment, organizeCode);
        if (!StringUtils.isEmpty(mesEquipment.getWorkCellCode())){
            DdlPreparedPack.getStringEqualPack(mesEquipment.getWorkCellCode(), "workCellCode", packBean);
        }
        if (!StringUtils.isEmpty(mesEquipment.getWorkCenterCode())){
            DdlPreparedPack.getStringEqualPack(mesEquipment.getWorkCenterCode(), "workCenterCode", packBean);
        }
        if (!StringUtils.isEmpty(mesEquipment.getEquipmentCode())){
            DdlPreparedPack.getStringEqualPack(mesEquipment.getEquipmentCode(), "equipmentCode", packBean);
        }
        packBean.setOrderByStr(mesEquipment.orderBy());

        return packBean;
    }

    /**
     * MES班次信息查询条件封装
     * @param shift
     * @return
     */
    public static DdlPackBean getMesShift(MesShift shift, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(shift, organizeCode);
        if (!StringUtils.isEmpty(shift.getShiftCode())){
            DdlPreparedPack.getStringEqualPack(shift.getShiftCode(), "shiftCode", packBean);
        }
        if (!StringUtils.isEmpty(shift.getShiftName())){
            DdlPreparedPack.getStringLikerPack(shift.getShiftName(), "shiftName", packBean);
        }
        if (!StringUtils.isEmpty(shift.getWorkCenterCode())){
            DdlPreparedPack.getStringEqualPack(shift.getWorkCenterCode(), "workCenterCode", packBean);
        }

        return packBean;
    }

    /**
     * 通知配置信息封装
     * @param responseCfg
     * @return
     */
    public static DdlPackBean packAndonAlarmResponseCfg(AndonAlarmResponseCfg responseCfg) {
        DdlPackBean result = new DdlPackBean();
        DdlPreparedPack.getStringEqualPack(responseCfg.getAlarmCode(), "alarmCode", result);
        DdlPreparedPack.getStringEqualPack(responseCfg.getAndonStatus(), "andonStatus", result);
        DdlPreparedPack.getStringEqualPack(responseCfg.getRpLevel(), "rpLevel", result);
        DdlPreparedPack.getStringEqualPack(responseCfg.getWorkCenterCode(), "workCenterCode", result);
        DdlPreparedPack.getStringEqualPack(responseCfg.getRpObjectCode(), "rpObjectCode", result);
        DdlPreparedPack.getStringEqualPack(responseCfg.getOrganizeCode(), "organizeCode", result);
        DdlPreparedPack.getStringEqualPack(responseCfg.getRpCode(), "rpCode", result);
        getStringBuilderPack(responseCfg, result);

        return result;
    }

    /**
     * 安灯停线配置信息封装
     * @param stopLineConfig
     * @return
     */
    public static DdlPackBean packAndonHaltCfg(AndonHaltCfg stopLineConfig) {
        DdlPackBean result = new DdlPackBean();

        DdlPreparedPack.getStringEqualPack(stopLineConfig.getAlarmCode(), "alarmCode", result);
        DdlPreparedPack.getStringEqualPack(stopLineConfig.getWorkCellCode(), "workCellCode", result);
        DdlPreparedPack.getStringEqualPack(stopLineConfig.getWorkCenterCode(), "workCenterCode", result);

        getStringBuilderPack(stopLineConfig, result);

        return result;
    }

    /**
     * 安灯子类型信息封装
     * @param andonAlarmDetailType
     * @return
     */
    public static DdlPackBean packAndonAlarmDetailType(AndonAlarmDetailType andonAlarmDetailType) {
        DdlPackBean result = new DdlPackBean();

        DdlPreparedPack.getStringEqualPack(andonAlarmDetailType.getAlarmCode(), "alarmCode", result);
        DdlPreparedPack.getStringEqualPack(andonAlarmDetailType.getAlarmDetailCode(), "alarmDetailCode", result);

        getStringBuilderPack(andonAlarmDetailType, result);

        return result;
    }

    /**
     * 模糊查询安灯子类型信息
     * @param andonAlarmDetailType
     * @return
     */
    public static DdlPackBean packAndonAlarmDetailTypeLike(AndonAlarmDetailType andonAlarmDetailType) {
        DdlPackBean result = new DdlPackBean();

        DdlPreparedPack.getStringEqualPack(andonAlarmDetailType.getAlarmCode(), "alarmCode", result);
        DdlPreparedPack.getStringLikerPack(andonAlarmDetailType.getAlarmDetailCode(), "alarmDetailCode", result);
        DdlPreparedPack.getStringLikerPack(andonAlarmDetailType.getAlarmDetailName(), "alarmDetailName", result);

        getStringBuilderPack(andonAlarmDetailType, result);

        return result;
    }
//
//    /**
//     * 安灯类型查询条件封装
//     * @param andonAlarmType
//     * @return
//     */
//    public static DdlPackBean packAndonAlarmType(AndonAlarmType andonAlarmType) {
//        DdlPackBean result = new DdlPackBean();
//
//        getStringBuilderPack(andonAlarmType, result);
//
//        return result;
//    }

    /**
     * ANDON通知对象查询条件封装
     * @param andonResponseObject
     * @return
     */
    public static DdlPackBean packAndonResponseObject(AndonResponseObject andonResponseObject){
        DdlPackBean result = new DdlPackBean();
        DdlPreparedPack.getStringEqualPack(andonResponseObject.getRpObjectCode(), "rpObjectCode", result);
        DdlPreparedPack.getStringEqualPack(andonResponseObject.getRpObjectName(), "rpObjectName", result);
        DdlPreparedPack.getStringLikerPack(andonResponseObject.getRpObjectValue(), "rpObjectValue", result);
        getStringBuilderPack(andonResponseObject, result);
        return result;
    }

    /**
     * ANDON_事件原因
     * @param andonEventCause
     * @return
     */
    public static DdlPackBean packAndonEventCause(AndonEventCause andonEventCause) {
        DdlPackBean result = new DdlPackBean();
        DdlPreparedPack.getStringEqualPack(andonEventCause.getAlarmCode(), "alarmCode", result);
        DdlPreparedPack.getStringLikerPack(andonEventCause.getEcCode(), "ecCode", result);
        DdlPreparedPack.getStringLikerPack(andonEventCause.getEcName(), "ecName", result);
        getStringBuilderPack(andonEventCause, result);
        return result;
    }

    /**
     * ANDON_停机类型
     * @param haltType
     * @return
     */
    public static DdlPackBean packAndonHaltType(AndonHaltType haltType) {
        DdlPackBean result = new DdlPackBean();
        getStringBuilderPack(haltType, result);

        return result;
    }

    /**
     * ANDON_事件现象
     * @param eventPhenoMenon
     * @return
     */
    public static DdlPackBean packAndonEventPhenoMenon(AndonEventPhenoMenon eventPhenoMenon) {
        DdlPackBean result = new DdlPackBean();

        DdlPreparedPack.getStringLikerPack(eventPhenoMenon.getEpmCode(), "epmCode", result);
        DdlPreparedPack.getStringLikerPack(eventPhenoMenon.getEpmName(), "epmName", result);
        DdlPreparedPack.getStringEqualPack(eventPhenoMenon.getAlarmCode(), "alarmCode", result);
        DdlPreparedPack.getOrderByPack(
                new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()},
                new String[]{eventPhenoMenon.getOrderByParam()},
                result
        );

        getStringBuilderPack(eventPhenoMenon, result);

        return result;
    }

    /**
     * ANDON_ 事件处理方法
     * @param eventMethod
     * @return
     */
    public static DdlPackBean packAndonEventMethod(AndonEventMethod eventMethod) {
        DdlPackBean result = new DdlPackBean();
        DdlPreparedPack.getStringEqualPack(eventMethod.getAlarmCode(), "alarmCode", result);
        DdlPreparedPack.getStringLikerPack(eventMethod.getEmName(), "emName", result);
        DdlPreparedPack.getStringLikerPack(eventMethod.getEmCode(), "emCode", result);
        getStringBuilderPack(eventMethod, result);
        return result;
    }

    /**
     * ANDON_ 安灯PLC控制
     * @param plc
     * @return
     */
    public static DdlPackBean packAndonPLC(AndonPLC plc) {
        DdlPackBean result = new DdlPackBean();
        DdlPreparedPack.getStringEqualPack(plc.getAlarmCode(), "alarmCode", result);
        DdlPreparedPack.getStringLikerPack(plc.getTagAddress(),"tagAddress",result);
        DdlPreparedPack.getStringLikerPack(plc.getTagName(),"tagName",result);
        DdlPreparedPack.getStringEqualPack(plc.getChannelName(),"channelName",result);
        DdlPreparedPack.getStringEqualPack(plc.getGroupNo(),"groupNo",result);
        DdlPreparedPack.getStringEqualPack(plc.getWorkCenterCode(), "workCenterCode", result);
        DdlPreparedPack.getStringEqualPack(plc.getWorkCellCode(), "workCellCode", result);
        DdlPreparedPack.getStringEqualPack(plc.getAlarmCode(), "alarmCode", result);
        getStringBuilderPack(plc, result);
        return result;
    }

    /**
     * 检查安灯记录是否以存在
     * @param andonManageRecord
     * @return
     */
    public static DdlPackBean packHqlAndonManageRecordIsExist(AndonManageRecord andonManageRecord){
        DdlPackBean result = new DdlPackBean();

        DdlPreparedPack.getStringEqualPack(andonManageRecord.getAndonOrderNo(),"andonOrderNo", result);
        DdlPreparedPack.getStringEqualPack(andonManageRecord.getStatusCode(),"statusCode", result);
        DdlPreparedPack.getStringEqualPack(andonManageRecord.getAlarmCode(),"alarmCode", result);
        DdlPreparedPack.getStringEqualPack(andonManageRecord.getActionCode(),"actionCode", result);

        getStringBuilderPack(andonManageRecord, result);
        return  result;
    }

    /**
     * 区域唯一校验
     * @param mesArea
     * @return
     */
    public static DdlPackBean packHqlCheckMesAreaOnlyByAreaCode(MesArea mesArea){
        DdlPackBean result = new DdlPackBean();
        if (mesArea != null && mesArea.getId() != null && mesArea.getId().longValue() > 0) {
            DdlPreparedPack.getNumNOEqualPack(mesArea.getId(),"id",result);
        }

        if (mesArea != null) {
            DdlPreparedPack.getStringEqualPack(mesArea.getAreaCode(), "areaCode", result);
        }
        DdlPreparedPack.getNumEqualPack(CommonEnumUtil.IS_DEAL.NO.getValue(),"isDeleted",result);

        return result;
    }

    /**
     * 工作中心唯一校验
     * @param mesWorkCenter
     * @return
     */
    public static DdlPackBean packHqlCheckMesWorkCenterOnlyByWorkCenterCode(MesWorkCenter mesWorkCenter){
        DdlPackBean result = new DdlPackBean();
        if (mesWorkCenter != null && mesWorkCenter.getId() != null && mesWorkCenter.getId().longValue() > 0) {
            DdlPreparedPack.getNumNOEqualPack(mesWorkCenter.getId(),"id",result);
        }

        if (mesWorkCenter != null) {
            DdlPreparedPack.getStringEqualPack(mesWorkCenter.getWorkCenterCode(), "workCenterCode", result);
        }
        DdlPreparedPack.getNumEqualPack(CommonEnumUtil.IS_DEAL.NO.getValue(),"isDeleted",result);

        return result;
    }

    /**
     * 工作单元唯一校验
     * @param mesWorkCell
     * @return
     */
    public static DdlPackBean packHqlCheckMesWorkCellOnlyByWorkCellCode(MesWorkCell mesWorkCell){
        DdlPackBean result = new DdlPackBean();
        if (mesWorkCell != null && mesWorkCell.getId() != null && mesWorkCell.getId().longValue() > 0) {
            DdlPreparedPack.getNumNOEqualPack(mesWorkCell.getId(),"id",result);
        }

        if (mesWorkCell != null) {
            DdlPreparedPack.getStringEqualPack(mesWorkCell.getWorkCellCode(), "workCellCode", result);
        }
        DdlPreparedPack.getNumEqualPack(CommonEnumUtil.IS_DEAL.NO.getValue(),"isDeleted",result);

        return result;
    }

    /**
     * 设备唯一校验
     * @param mesEquipment
     * @return
     */
    public static DdlPackBean packHqlCheckMesEquipmentOnlyByEquipmentCode(MesEquipment mesEquipment){
        DdlPackBean result = new DdlPackBean();
        if (mesEquipment != null && mesEquipment.getId() != null && mesEquipment.getId().longValue() > 0) {
            DdlPreparedPack.getNumNOEqualPack(mesEquipment.getId(),"id",result);
        }

        if (mesEquipment != null) {
            DdlPreparedPack.getStringEqualPack(mesEquipment.getEquipmentCode(), "equipmentCode", result);
        }
        DdlPreparedPack.getNumEqualPack(CommonEnumUtil.IS_DEAL.NO.getValue(),"isDeleted",result);

        return result;
    }

    /**
     * 班次唯一校验
     * @param mesShift
     * @return
     */
    public static DdlPackBean packHqlCheckMesShiftOnlyByShiftCode(MesShift mesShift){
        DdlPackBean result = new DdlPackBean();
        if (mesShift != null && mesShift.getId() != null && mesShift.getId().longValue() > 0) {
            DdlPreparedPack.getNumNOEqualPack(mesShift.getId(),"id",result);
            DdlPreparedPack.getStringNoEqualPack(mesShift.getWorkCenterCode(),"workCenterCode",result);
        }

        if (mesShift != null) {
            DdlPreparedPack.getStringEqualPack(mesShift.getShiftCode(), "shiftCode", result);
        }
        DdlPreparedPack.getNumEqualPack(CommonEnumUtil.IS_DEAL.NO.getValue(),"isDeleted",result);

        return result;
    }

    public static DdlPackBean packHqlAndonMenu(String organizeCode, String workCenterCode, String startDateTime, String endDateTime) {
        DdlPackBean result = DdlPackBean.getDdlPackBean(organizeCode);
        if (!StringUtils.isEmpty(workCenterCode)) {
            DdlPreparedPack.getStringEqualPack(workCenterCode, "workCenterCode", result);
        }
        DdlPreparedPack.timeBuilder(startDateTime, endDateTime, "createDatetime", result, true);
        return result;
    }

    /**
     * actor信息
     * @param actor
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getAndonActor(AndonActor actor, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(actor, organizeCode);
        if (!StringUtils.isEmpty(actor.getActorCode())) {
            DdlPreparedPack.getStringLikerPack(actor.getActorCode(), "actorCode", packBean);
        }
        if (!StringUtils.isEmpty(actor.getActorName())) {
            DdlPreparedPack.getStringLikerPack(actor.getActorName(), "actorName", packBean);
        }
        if (!StringUtils.isEmpty(actor.getActorClass())) {
            DdlPreparedPack.getStringLikerPack(actor.getActorClass(), "actorClass", packBean);
        }
        return packBean;
    }

    /**
     * 消息类型
     * @param messageType
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getAndonMessageType(AndonMessageType messageType, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(messageType, organizeCode);
        if (!StringUtils.isEmpty(messageType.getMtCode())) {
            DdlPreparedPack.getStringLikerPack(messageType.getMtCode(), "mtCode", packBean);
        }
        if (!StringUtils.isEmpty(messageType.getMtName())) {
            DdlPreparedPack.getStringLikerPack(messageType.getMtName(), "mtName", packBean);
        }
        return packBean;
    }

    /**
     * actor消息类型配置
     * @param actorRule
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getAndonActorRule(AndonActorRule actorRule, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(actorRule, organizeCode);
        if (!StringUtils.isEmpty(actorRule.getActorCode())) {
            DdlPreparedPack.getStringLikerPack(actorRule.getActorCode(), "actorCode", packBean);
        }
        if (!StringUtils.isEmpty(actorRule.getMtCode())) {
            DdlPreparedPack.getStringLikerPack(actorRule.getMtCode(), "mtCode", packBean);
        }
        return packBean;
    }

    /**
     * 安灯类型
     * @param alarmType
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getAndonAlarmType(AndonAlarmType alarmType, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(alarmType, organizeCode);
        if (!StringUtils.isEmpty(alarmType.getAlarmCode())) {
            DdlPreparedPack.getStringLikerPack(alarmType.getAlarmCode(), "alarmCode", packBean);
        }
        if (!StringUtils.isEmpty(alarmType.getAlarmName())) {
            DdlPreparedPack.getStringLikerPack(alarmType.getAlarmName(), "alarmName", packBean);
        }
        return packBean;
    }

    /**
     * 组件
     * @param actionModule
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getAndonActionModule(AndonActionModule actionModule, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(actionModule, organizeCode);
        if (!StringUtils.isEmpty(actionModule.getAmCode())) {
            DdlPreparedPack.getStringLikerPack(actionModule.getAmCode(), "amCode", packBean);
        }
        if (!StringUtils.isEmpty(actionModule.getAmName())) {
            DdlPreparedPack.getStringLikerPack(actionModule.getAmName(), "amName", packBean);
        }
        if (!StringUtils.isEmpty(actionModule.getCallClass())) {
            DdlPreparedPack.getStringLikerPack(actionModule.getCallClass(), "callClass", packBean);
        }
        if (!StringUtils.isEmpty(actionModule.getAmType())) {
            DdlPreparedPack.getNumEqualPack(actionModule.getAmType(), "amType", packBean);
        }
        return packBean;
    }

    /**
     * 组件参数
     * @param actionModuleParam
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getAndonActionModuleParam(AndonActionModuleParam actionModuleParam, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(actionModuleParam, organizeCode);
        if (!StringUtils.isEmpty(actionModuleParam.getAmCode())) {
            DdlPreparedPack.getStringLikerPack(actionModuleParam.getAmCode(), "amCode", packBean);
        }
        if (!StringUtils.isEmpty(actionModuleParam.getParamCode())) {
            DdlPreparedPack.getStringLikerPack(actionModuleParam.getParamCode(), "paramCode", packBean);
        }
        if (!StringUtils.isEmpty(actionModuleParam.getParamName())) {
            DdlPreparedPack.getStringLikerPack(actionModuleParam.getParamName(), "paramName", packBean);
        }
        if (!StringUtils.isEmpty(actionModuleParam.getParamType())) {
            DdlPreparedPack.getNumEqualPack(actionModuleParam.getParamType(), "paramType", packBean);
        }
        return packBean;
    }

    /**
     * 上升流程配置
     * @param riteRoute
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getAndonRiteRoute(AndonRiteRoute riteRoute, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(riteRoute, organizeCode);
        if (!StringUtils.isEmpty(riteRoute.getAlarmCode())) {
            DdlPreparedPack.getStringLikerPack(riteRoute.getAlarmCode(), "alarmCode", packBean);
        }
        if (!StringUtils.isEmpty(riteRoute.getAndonStatus())) {
            DdlPreparedPack.getStringEqualPack(riteRoute.getAndonStatus(), "andonStatus", packBean);
        }
        if (!StringUtils.isEmpty(riteRoute.getWorkCenterCode())) {
            DdlPreparedPack.getStringLikerPack(riteRoute.getWorkCenterCode(), "workCenterCode", packBean);
        }
        if (!StringUtils.isEmpty(riteRoute.getWorkCenterNameRdd())) {
            DdlPreparedPack.getStringLikerPack(riteRoute.getWorkCenterNameRdd(), "workCenterNameRdd", packBean);
        }
        return packBean;
    }

    /**
     * 上升配置明细
     * @param riteRouteDetail
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getAndonRiteRouteDetail(AndonRiteRouteDetail riteRouteDetail, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(riteRouteDetail, organizeCode);
        if (!StringUtils.isEmpty(riteRouteDetail.getRiteRouteId())) {
            DdlPreparedPack.getNumEqualPack(riteRouteDetail.getRiteRouteId(), "riteRouteId", packBean);
        }
        if (!StringUtils.isEmpty(riteRouteDetail.getRpCode())) {
            DdlPreparedPack.getStringEqualPack(riteRouteDetail.getRpCode(), "rpCode", packBean);
        }
        if (!StringUtils.isEmpty(riteRouteDetail.getRpLevel())) {
            DdlPreparedPack.getStringEqualPack(riteRouteDetail.getRpLevel(), "rpLevel", packBean);
        }
        if (!StringUtils.isEmpty(riteRouteDetail.getRpObjectCode())) {
            DdlPreparedPack.getStringLikerPack(riteRouteDetail.getRpObjectCode(), "rpObjectCode", packBean);
        }
        return packBean;
    }

    /**
     * 作业流程
     * @param actionRoute
     * @param organizeCode
     * @return
     */
    public static DdlPackBean packHqlAndonActionRoute(AndonActionRoute actionRoute, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(actionRoute, organizeCode);
        DdlPreparedPack.getStringLikerPack(actionRoute.getRouteCode(), "routeCode", packBean);
        DdlPreparedPack.getStringLikerPack(actionRoute.getRouteName(), "routeName", packBean);
        DdlPreparedPack.getNumEqualPack(actionRoute.getRouteType(), "routeType", packBean);
        return packBean;
    }

    /**
     * 安灯作业流程配置
     * @param alarmRoute
     * @param organizeCode
     * @return
     */
    public static DdlPackBean packHqlAndonAlarmRoute(AndonAlarmRoute alarmRoute, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(alarmRoute, organizeCode);
        DdlPreparedPack.getStringLikerPack(alarmRoute.getRouteCode(), "routeCode", packBean);
        DdlPreparedPack.getStringLikerPack(alarmRoute.getAlarmCode(), "alarmCode", packBean);
        DdlPreparedPack.getNumEqualPack(alarmRoute.getRouteType(), "routeType", packBean);
        return packBean;
    }

    /**
     * 流程状态异常记录
     * @param routeStatusErrorRecord
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getAndonRouteStatusErrorRecord(AndonRouteStatusErrorRecord routeStatusErrorRecord, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(routeStatusErrorRecord, organizeCode);
        DdlPreparedPack.getStringLikerPack(routeStatusErrorRecord.getRouteCode(), "routeCode", packBean);
        DdlPreparedPack.getStringLikerPack(routeStatusErrorRecord.getStatusCode(), "statusCode", packBean);
        DdlPreparedPack.getStringLikerPack(routeStatusErrorRecord.getAndonOrderNo(), "andonOrderNo", packBean);
        DdlPreparedPack.getStringEqualPack(routeStatusErrorRecord.getAlarmCode(), "alarmCode", packBean);
        DdlPreparedPack.getStringEqualPack(routeStatusErrorRecord.getSourceType(), "sourceType", packBean);
        DdlPreparedPack.getNumEqualPack(routeStatusErrorRecord.getHandleStatus(), "handleStatus", packBean);
        return packBean;
    }

    public static DdlPackBean getAndonAreaAlarmType(AndonAreaAlarmType areaAlarmType, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(areaAlarmType, organizeCode);
        DdlPreparedPack.getStringLikerPack(areaAlarmType.getAreaCode(), "areaCode", packBean);
        DdlPreparedPack.getStringLikerPack(areaAlarmType.getAlarmCode(), "alarmCode", packBean);
        return packBean;
    }

    /**
     * 安灯 PLC三色灯控制信息查询条件封装
     * @param andonPlcColorCfg
     * @return
     */
    public static DdlPackBean getAndonPlcColorCfg(AndonPlcColorCfg andonPlcColorCfg) {
        DdlPackBean result = new DdlPackBean();
        DdlPreparedPack.getStringLikerPack(andonPlcColorCfg.getWorkCenterCode(), "workCenterCode", result);
        DdlPreparedPack.getStringLikerPack(andonPlcColorCfg.getWorkCellCode(), "workCellCode", result);
        getStringBuilderPack(andonPlcColorCfg, result);
        return result;
    }
}
