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

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.enumutil.MesEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.mes.bean.*;
import org.springframework.util.StringUtils;

/**
 * @Description:
 * @Reference: Mes 条件封装
 * @Author: Crish
 * @CreateDate:2019-04-22-14:58
 * @Modify:
 **/
public class MesHqlPack {

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

    public static DdlPackBean getMesPcnByCondition(MesPcn mesPcn, String organizeCode) {
        DdlPackBean packBean = getAllBaseData(organizeCode);
        if (!StringUtils.isEmpty(mesPcn.getConnectIp())) {
            DdlPreparedPack.getStringLikerPack(mesPcn.getConnectIp(), "connectIp", packBean);
        }
        if (!StringUtils.isEmpty(mesPcn.getPcnName())) {
            DdlPreparedPack.getStringLikerPack(mesPcn.getPcnName(), "pcnName", packBean);
        }
        if (!StringUtils.isEmpty(mesPcn.getPcnCode())) {
            DdlPreparedPack.getStringLikerPack(mesPcn.getPcnCode(), "pcnCode", packBean);
        }
        if (!StringUtils.isEmpty(mesPcn.getAreaCode())) {
            DdlPreparedPack.getStringLikerPack(mesPcn.getAreaCode(), "areaCode", packBean);
        }
        if (mesPcn.getIsValid() != null) {
            DdlPreparedPack.getNumEqualPack(mesPcn.getIsValid(), "isValid", packBean);
        }
        return packBean;
    }

    /**
     * 生产计划查询条件封装
     *
     * @param mesPlanOrder
     * @return
     */
    public static DdlPackBean getPlanOrderCondition(MesPlanOrder mesPlanOrder, String organizeCode) {
        DdlPackBean packBean = new DdlPackBean();
        DdlPreparedPack.getStringEqualPack(organizeCode, "organizeCode", packBean);
        DdlPreparedPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(), "isValid", packBean);
        DdlPreparedPack.getNumEqualPack(CommonEnumUtil.IS_DEAL.NO.getValue(), "isDeleted", packBean);

        if (!StringUtils.isEmpty(mesPlanOrder.getOrderNo())) {
            DdlPreparedPack.getStringLikerPack(mesPlanOrder.getOrderNo(), "orderNo", packBean);
        }
        if (!StringUtils.isEmpty(mesPlanOrder.getPartNo())) {
            DdlPreparedPack.getStringLikerPack(mesPlanOrder.getPartNo(), "partNo", packBean);
        }
        if (!StringUtils.isEmpty(mesPlanOrder.getPlanType() + "") && mesPlanOrder.getPlanTypeVal() != 0) {
            DdlPreparedPack.getNumEqualPack(mesPlanOrder.getPlanType(), "planType", packBean);
        }
        if (!StringUtils.isEmpty(mesPlanOrder.getStatus() + "") && mesPlanOrder.getStatusVal() != 0) {
            DdlPreparedPack.getNumEqualPack(mesPlanOrder.getStatus(), "status", packBean);
        }

        if (!StringUtils.isEmpty(mesPlanOrder.getCreateUser())) {
            DdlPreparedPack.getStringLikerPack(mesPlanOrder.getCreateUser(), "createUser", packBean);
        }
        if (!StringUtils.isEmpty(mesPlanOrder.getCustOrderNo())) {
            DdlPreparedPack.getStringLikerPack(mesPlanOrder.getCustOrderNo(), "custOrderNo", packBean);
        }

        // 时间段查询
        DdlPreparedPack.timeBuilder(
                mesPlanOrder.getStartTimeStart(),
                mesPlanOrder.getStartTimeEnd(),
                "startTime", packBean, true);
        DdlPreparedPack.timeBuilder(
                mesPlanOrder.getEndTimeStart(),
                mesPlanOrder.getEndTimeEnd(),
                "endTime", packBean, true);
        DdlPreparedPack.timeBuilder(
                mesPlanOrder.getCreateDateTimeStart(),
                mesPlanOrder.getCreateDateTimeEnd(),
                "createDatetime", packBean, true);

        // 排序
        DdlPreparedPack.getOrderDefault(mesPlanOrder);
        DdlPreparedPack.getOrderByPack(new Object[]{"2"}, new String[]{mesPlanOrder.getOrderByParam()}, packBean);
        return packBean;
    }

    /**
     * 物料信息查询条件封装
     *
     * @param mesPart
     * @return
     */
    public static DdlPackBean getPartCondition(MesPart mesPart, String organizeCode) {
        DdlPackBean packBean = new DdlPackBean();
        DdlPreparedPack.getStringEqualPack(organizeCode, "organizeCode", packBean);
        DdlPreparedPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(), "isValid", packBean);
        DdlPreparedPack.getNumEqualPack(CommonEnumUtil.IS_DEAL.NO.getValue(), "isDeleted", packBean);

        if (!StringUtils.isEmpty(mesPart.getPartNo())) {
            DdlPreparedPack.getStringLikerPack(mesPart.getPartNo(), "partNo", packBean);
        }
        if (!StringUtils.isEmpty(mesPart.getPartName())) {
            DdlPreparedPack.getStringLikerPack(mesPart.getPartName(), "partName", packBean);
        }
        if (!StringUtils.isEmpty(mesPart.getCategoryCode1())) {
            DdlPreparedPack.getStringEqualPack(mesPart.getCategoryCode1(), "categoryCode1", packBean);
        }
        if (!StringUtils.isEmpty(mesPart.getCategoryCode2())) {
            DdlPreparedPack.getStringEqualPack(mesPart.getCategoryCode2(), "categoryCode2", packBean);
        }
        if (!StringUtils.isEmpty(mesPart.getCategoryCode3())) {
            DdlPreparedPack.getStringEqualPack(mesPart.getCategoryCode3(), "categoryCode3", packBean);
        }
        if (!StringUtils.isEmpty(mesPart.getProduceCategoryCode()) && mesPart.getProduceCategoryCode().toUpperCase().equals("WXJ")) {
            DdlPreparedPack.getStringEqualPack("WXJ", "produceCategoryCode", packBean);
        } else {
            DdlPreparedPack.getStringNoEqualPack("WXJ", "produceCategoryCode", packBean);
        }
        DdlPreparedPack.getOrderDefault(mesPart);
        DdlPreparedPack.getOrderByPack(new Object[]{"2"}, new String[]{mesPart.getOrderByParam()}, packBean);
        return packBean;
    }

    /**
     * 生产工单查询条件封装
     *
     * @param mesWorkOrder
     * @return
     */
    public static DdlPackBean getWorkOrderCondition(MesWorkOrder mesWorkOrder, String organizeCode) {
        DdlPackBean packBean = getAllBaseData(organizeCode);
        if (!StringUtils.isEmpty(mesWorkOrder.getOrderNo())) {
            DdlPreparedPack.getStringLikerPack(mesWorkOrder.getOrderNo(), "orderNo", packBean);
        }
        if (!StringUtils.isEmpty(mesWorkOrder.getPartNo())) {
            DdlPreparedPack.getStringLikerPack(mesWorkOrder.getPartNo(), "partNo", packBean);
        }
        if (!StringUtils.isEmpty(mesWorkOrder.getWorkOrderStatus() + "") && mesWorkOrder.getWorkOrderStatusVal() != 0) {
            DdlPreparedPack.getNumEqualPack(mesWorkOrder.getWorkOrderStatus(), "workOrderStatus", packBean);
        }
        if (!StringUtils.isEmpty(mesWorkOrder.getWorkCenterCode())) {
            DdlPreparedPack.getStringEqualPack(mesWorkOrder.getWorkCenterCode(), "workCenterCode", packBean);
        }
        if (mesWorkOrder.getApprovalStatus() != null) {
            DdlPreparedPack.getNumEqualPack(mesWorkOrder.getApprovalStatus(), "approvalStatus", packBean);
        }
        if (!StringUtils.isEmpty(mesWorkOrder.getWorkOrderType() + "") && mesWorkOrder.getWorkOrderTypeVal() != 0) {
            DdlPreparedPack.getNumEqualPack(mesWorkOrder.getWorkOrderType(), "workOrderType", packBean);
        }
        if (!StringUtils.isEmpty(mesWorkOrder.getCustOrderNo())) {
            DdlPreparedPack.getStringLikerPack(mesWorkOrder.getCustOrderNo(), "custOrderNo", packBean);
        }
        if (!StringUtils.isEmpty(mesWorkOrder.getPlanOrderNo())) {
            DdlPreparedPack.getStringLikerPack(mesWorkOrder.getPlanOrderNo(), "planOrderNo", packBean);
        }
        if (!StringUtils.isEmpty(mesWorkOrder.getCreateUser())) {
            DdlPreparedPack.getStringLikerPack(mesWorkOrder.getCreateUser(), "createUser", packBean);
        }
        if (mesWorkOrder.getIsValid() != null) {
            DdlPreparedPack.getNumEqualPack(mesWorkOrder.getIsValid(), "isValid", packBean);
        }

        // 时间段查询
        DdlPreparedPack.timeBuilder(
                mesWorkOrder.getStartTimeStart(),
                mesWorkOrder.getStartTimeEnd(),
                "startTime", packBean, true);
        DdlPreparedPack.timeBuilder(
                mesWorkOrder.getEndTimeStart(),
                mesWorkOrder.getEndTimeEnd(),
                "endTime", packBean, true);
        DdlPreparedPack.timeBuilder(
                mesWorkOrder.getCreateDateTimeStart(),
                mesWorkOrder.getCreateDateTimeEnd(),
                "createDatetime", packBean, true);
        DdlPreparedPack.getOrderDefault(mesWorkOrder);
        DdlPreparedPack.getOrderByPack(new Object[]{"2"}, new String[]{mesWorkOrder.getOrderByParam()}, packBean);
        return packBean;
    }

    /**
     * 生产队列查询条件封装
     *
     * @param mesQueueOrder
     * @return
     */
    public static DdlPackBean getQueueOrder(MesQueueOrder mesQueueOrder, String organizeCode) {
        DdlPackBean packBean = getAllBaseData(organizeCode);
        if (!StringUtils.isEmpty(mesQueueOrder.getCustFlagNoStart())) {
            DdlPreparedPack.getStringBiggerPack(mesQueueOrder.getCustFlagNoStart(), "custFlagNo", packBean);
        }

        if (!StringUtils.isEmpty(mesQueueOrder.getCustFlagNoEnd() + "")) {
            DdlPreparedPack.getStringSmallerPack(mesQueueOrder.getCustFlagNoEnd(), "custFlagNo", packBean);
        }

        if (!StringUtils.isEmpty(mesQueueOrder.getOrderNo() + "")) {
            DdlPreparedPack.getStringLikerPack(mesQueueOrder.getOrderNo(), "orderNo", packBean);
        }

        if (mesQueueOrder.getIsValid() != null) {
            DdlPreparedPack.getNumEqualPack(mesQueueOrder.getIsValid(), "isValid", packBean);
        }

        // 只查询创建状态的队列
        DdlPreparedPack.getNumEqualPack(MesEnumUtil.QUEUE_ORDER_STATUS.NORMAL.getValue(), "status", packBean);

        // 时间段查询
        DdlPreparedPack.timeBuilder(
                mesQueueOrder.getCreateDateTimeStart(),
                mesQueueOrder.getCreateDateTimeEnd(),
                "createDatetime", packBean, true);

        // DdlPreparedPack.getOrderDefault(mesQueueOrder);
        // 按照队列序列号倒序
        DdlPreparedPack.getOrderByPack(new Object[]{"2"}, new String[]{"seq"}, packBean);
        return packBean;
    }

    /**
     * 通用查询条件
     *
     * @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);
        if (!StringUtils.isEmpty(mesArea.getAreaCode())) {
            DdlPreparedPack.getStringEqualPack(mesArea.getAreaCode(), "areaCode", packBean);
        }

        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);
        return packBean;
    }

    /**
     * MES工作单元信息查询条件封装
     *
     * @param mesWorkCell
     * @return
     */
    public static DdlPackBean getMesWorkCell(MesWorkCell mesWorkCell, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesWorkCell, organizeCode);
        if (!StringUtils.isEmpty(mesWorkCell.getWorkCenterCode())) {
            DdlPreparedPack.getStringEqualPack(mesWorkCell.getWorkCenterCode(), "workCenterCode", packBean);
        }
        if (!StringUtils.isEmpty(mesWorkCell.getAreaCode())) {
            DdlPreparedPack.getStringEqualPack(mesWorkCell.getAreaCode(), "areaCode", packBean);
        }
        if (!StringUtils.isEmpty(mesWorkCell.getWorkCellCode())) {
            DdlPreparedPack.getStringEqualPack(mesWorkCell.getWorkCellCode(), "workCellCode", packBean);
        }

        return packBean;
    }

    /**
     * 流程查询条件封装
     *
     * @param mesRoute
     * @return
     */
    public static DdlPackBean packHqlMesRoute(MesRoute mesRoute, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesRoute, organizeCode);
        DdlPreparedPack.getStringLikerPack(mesRoute.getRouteCode(), "routeCode", packBean);
        DdlPreparedPack.getStringLikerPack(mesRoute.getRouteName(), "routeName", packBean);
        packBean.setOrderByStr(mesRoute.orderBy());
        return packBean;
    }

    /**
     * 产品流程配置查询条件封装
     *
     * @param mesProdRouteCfg
     * @param organizeCode
     * @return
     */
    public static DdlPackBean packHqlMesProdRouteCfg(MesProdRouteCfg mesProdRouteCfg, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesProdRouteCfg, organizeCode);
        DdlPreparedPack.getStringEqualPack(mesProdRouteCfg.getPartNo(), "partNo", packBean);
        DdlPreparedPack.getStringEqualPack(mesProdRouteCfg.getWorkCenterCode(), "workCenterCode", packBean);
        DdlPreparedPack.getStringEqualPack(mesProdRouteCfg.getRouteCode(), "routeCode", packBean);
        packBean.setOrderByStr(mesProdRouteCfg.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.getStringLikerPack(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;
    }

    /**
     * MES班组信息查询条件封装
     *
     * @param shiftGroup
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getMesShiftGroup(MesShiftGroup shiftGroup, String organizeCode) {

        DdlPackBean packBean = getAllBaseDataByNormalPro(shiftGroup, organizeCode);
        if (!StringUtils.isEmpty(shiftGroup.getGroupCode())) {
            DdlPreparedPack.getStringLikerPack(shiftGroup.getGroupCode(), "groupCode", packBean);
        }
        if (!StringUtils.isEmpty(shiftGroup.getGroupName())) {
            DdlPreparedPack.getStringLikerPack(shiftGroup.getGroupName(), "groupName", packBean);
        }
        return packBean;
    }

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

        return packBean;
    }

    /**
     * MES 报废信息查询
     *
     * @param mesScrap
     * @return
     */
    public static DdlPackBean getMesScrap(MesScrap mesScrap, String organizeCode) {
        DdlPackBean packBean = getAllBaseData(organizeCode);
        if (!StringUtils.isEmpty(mesScrap.getScrapCode())) {
            DdlPreparedPack.getStringLikerPack(mesScrap.getScrapCode(), "scrapCode", packBean);
        }
        if (!StringUtils.isEmpty(mesScrap.getScrapName())) {
            DdlPreparedPack.getStringLikerPack(mesScrap.getScrapName(), "scrapName", packBean);
        }
        if (mesScrap.getIsValid() != null) {
            DdlPreparedPack.getNumEqualPack(mesScrap.getIsValid(), "isValid", packBean);
        }
        return packBean;
    }


    /**
     * MES 开线管控
     *
     * @param mesWcCheck
     * @return
     */
    public static DdlPackBean getMesWcCheck(MesWcCheck mesWcCheck, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesWcCheck,organizeCode);
//        DdlPreparedPack.getNumEqualPack(mesWcCheck.getIsValid(),"isValid",packBean);
        DdlPreparedPack.getStringLikerPack(mesWcCheck.getWorkCenterCode(), "workCenterCode", packBean);
        DdlPreparedPack.getStringLikerPack(mesWcCheck.getPartNo(), "partNo", packBean);
        DdlPreparedPack.getStringEqualPack(mesWcCheck.getCheckType(), "checkType", packBean);
        DdlPreparedPack.getStringLikerPack(mesWcCheck.getCheckObj(), "checkObj", packBean);
        DdlPreparedPack.getStringLikerPack(mesWcCheck.getCheckItem(), "checkItem", packBean);
        return packBean;
    }

    /**
     * MES PCN系统配置信息条件查询
     *
     * @param mesConfig
     * @return
     */
    public static DdlPackBean getMesConfig(MesConfig mesConfig, String organizeCode) {
        DdlPackBean packBean = getAllBaseData(organizeCode);
        if (!StringUtils.isEmpty(mesConfig.getCfgCode())) {
            DdlPreparedPack.getStringLikerPack(mesConfig.getCfgCode(), "cfgCode", packBean);
        }
        if (!StringUtils.isEmpty(mesConfig.getCfgName())) {
            DdlPreparedPack.getStringLikerPack(mesConfig.getCfgName(), "cfgName", packBean);
        }
        if (mesConfig.getIsValid() != null) {
            DdlPreparedPack.getNumEqualPack(mesConfig.getIsValid(), "isValid", packBean);
        }
        return packBean;
    }

    /**
     * MES 维修信息条件查询
     *
     * @param mesRepair
     * @return
     */
    public static DdlPackBean getMesRepair(MesRepair mesRepair, String organizeCode) {
        DdlPackBean packBean = getAllBaseData(organizeCode);
        if (!StringUtils.isEmpty(mesRepair.getRepairCode())) {
            DdlPreparedPack.getStringLikerPack(mesRepair.getRepairCode(), "repairCode", packBean);
        }
        if (!StringUtils.isEmpty(mesRepair.getRepairName())) {
            DdlPreparedPack.getStringLikerPack(mesRepair.getRepairName(), "repairName", packBean);
        }
        if (mesRepair.getRepairType() != null) {
            DdlPreparedPack.getNumEqualPack(mesRepair.getRepairType(), "repairType", packBean);
        }
        if (mesRepair.getIsValid() != null) {
            DdlPreparedPack.getNumEqualPack(mesRepair.getIsValid(), "isValid", packBean);
        }

        return packBean;
    }

    /**
     * MES 上传文件FastDfs封装
     *
     * @param mesESOP
     * @return
     */
    public static DdlPackBean getMesESOPExcludeById(MesESOP mesESOP, String org) {
        DdlPackBean packBean = getAllBaseData(org);
        DdlPreparedPack.getStringEqualPack(mesESOP.getPartNo(), "partNo", packBean);
        DdlPreparedPack.getStringEqualPack(mesESOP.getRouteCode(), "routeCode", packBean);
        DdlPreparedPack.getStringEqualPack(mesESOP.getProcessCode(), "processCode", packBean);
        DdlPreparedPack.getStringEqualPack(mesESOP.getStepCode(), "stepCode", packBean);
        DdlPreparedPack.getNumEqualPack(mesESOP.getStepSeq(), "stepSeq", packBean);
        DdlPreparedPack.getStringEqualPack(mesESOP.getWorkCenterCode(), "workCenterCode", packBean);
        DdlPreparedPack.getStringEqualPack(mesESOP.getWorkCellCode(), "workCellCode", packBean);
        DdlPreparedPack.getNumNOEqualPack(mesESOP.getId(), "id", packBean);
        return packBean;
    }

    public static DdlPackBean getMesESOP(MesESOP mesESOP, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesESOP, organizeCode);
        if (!StringUtils.isEmpty(mesESOP.getWorkCenterCode())) {
            DdlPreparedPack.getStringEqualPack(mesESOP.getWorkCenterCode(), "workCenterCode", packBean);
        }
        if (!StringUtils.isEmpty(mesESOP.getPartNo())) {
            DdlPreparedPack.getStringLikerPack(mesESOP.getPartNo(), "partNo", packBean);
        }

        return packBean;
    }

    /**
     * 事件分页获取封装
     *
     * @param mesEvent
     * @param
     * @return
     */
    public static DdlPackBean getMesEvent(MesEvent mesEvent) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesEvent, mesEvent.getOrganizeCode());
        DdlPreparedPack.getStringLikerPack(mesEvent.getButtonCode(), "buttonCode", packBean);
        DdlPreparedPack.getStringLikerPack(mesEvent.getEventCode(), "eventCode", packBean);
        DdlPreparedPack.getStringLikerPack(mesEvent.getEventName(), "eventName", packBean);
        return packBean;
    }

    public static DdlPackBean getMesEventExcludeById(MesEvent mesEvent) {
        DdlPackBean packBean = getAllBaseData(mesEvent.getOrganizeCode());
        DdlPreparedPack.getStringEqualPack(mesEvent.getEventCode(), "eventCode", packBean);
        DdlPreparedPack.getNumNOEqualPack(mesEvent.getId(), "id", packBean);
        return packBean;
    }

    public static DdlPackBean getMesEventByButtonCode(String buttonCode, String org) {
        DdlPackBean packBean = getAllBaseData(org);
        DdlPreparedPack.getStringEqualPack(buttonCode, "buttonCode", packBean);
        DdlPreparedPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(), "isValid", packBean);
        return packBean;
    }

    public static DdlPackBean getMesEventByEventCode(MesEvent mesEvent) {
        DdlPackBean packBean = getAllBaseData(mesEvent.getOrganizeCode());
        DdlPreparedPack.getStringEqualPack(mesEvent.getEventCode(), "eventCode", packBean);
        DdlPreparedPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(), "isValid", packBean);
        return packBean;
    }

    public static DdlPackBean getMesEventByEventName(MesEvent mesEvent) {
        DdlPackBean packBean = getAllBaseData(mesEvent.getOrganizeCode());
        DdlPreparedPack.getStringEqualPack(mesEvent.getEventName(), "eventName", packBean);
        DdlPreparedPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(), "isValid", packBean);
        return packBean;
    }

    public static DdlPackBean getMesActionByActionCode(MesAction mesAction, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesAction, organizeCode);
        DdlPreparedPack.getStringEqualPack(mesAction.getActionCode(), "actionCode", packBean);
        return packBean;
    }

    public static DdlPackBean getMesActionByActionName(MesAction mesAction, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesAction, organizeCode);
        DdlPreparedPack.getStringEqualPack(mesAction.getActionName(), "actionName", packBean);
        return packBean;
    }

    public static DdlPackBean getMesActionExcludeById(MesAction mesAction) {
        DdlPackBean packBean = getAllBaseData(mesAction.getOrganizeCode());
        DdlPreparedPack.getStringEqualPack(mesAction.getActionCode(), "actionCode", packBean);
        DdlPreparedPack.getNumNOEqualPack(mesAction.getId(), "id", packBean);
        return packBean;
    }

    /**
     * 动作分页获取封装
     *
     * @param mesAction
     * @return
     */
    public static DdlPackBean getMesAction(MesAction mesAction) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesAction, mesAction.getOrganizeCode());
        DdlPreparedPack.getStringRightLikerPack(mesAction.getActionCode(), "actionCode", packBean);
        DdlPreparedPack.getStringLikerPack(mesAction.getActionName(), "actionName", packBean);
        DdlPreparedPack.getNumEqualPack(mesAction.getActionType(), "actionType", packBean);

        return packBean;
    }

    /**
     * 函数分页获取封装
     *
     * @param mesMethod
     * @return
     */
    public static DdlPackBean getMesMethod(MesMethod mesMethod) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesMethod, mesMethod.getOrganizeCode());
        DdlPreparedPack.getStringRightLikerPack(mesMethod.getMethodCode(), "methodCode", packBean);
        DdlPreparedPack.getStringLikerPack(mesMethod.getMethodName(), "methodName", packBean);
        DdlPreparedPack.getStringRightLikerPack(mesMethod.getCallClass(), "callClass", packBean);

        return packBean;
    }

    public static DdlPackBean getMesMethodByMethodCode(MesMethod mesMethod) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesMethod, mesMethod.getOrganizeCode());
        DdlPreparedPack.getStringEqualPack(mesMethod.getMethodCode(), "methodCode", packBean);
        return packBean;
    }

    public static DdlPackBean getMesMethodByMethodName(MesMethod mesMethod) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesMethod, mesMethod.getOrganizeCode());
        DdlPreparedPack.getStringEqualPack(mesMethod.getMethodName(), "methodName", packBean);
        return packBean;
    }

    /**
     * 事件动作分页获取封装
     *
     * @param mesActionMethod
     * @return
     */
    public static DdlPackBean getMesActionMethod(MesActionMethod mesActionMethod) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesActionMethod, mesActionMethod.getOrganizeCode());
        DdlPreparedPack.getStringLikerPack(mesActionMethod.getActionCode(), "actionCode", packBean);
        DdlPreparedPack.getStringLikerPack(mesActionMethod.getMethodCode(), "methodCode", packBean);
        return packBean;
    }

    /**
     * 事件动作分页获取封装
     *
     * @param mesEventAction
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getMesEventAction(MesEventAction mesEventAction, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesEventAction, organizeCode);
        if (!StringUtils.isEmpty(mesEventAction.getOrganizeCode())) {
            DdlPreparedPack.getStringEqualPack(mesEventAction.getOrganizeCode(), "organizeCode", packBean);
        }
        if (!StringUtils.isEmpty(mesEventAction.getEventCode())) {
            DdlPreparedPack.getStringLikerPack(mesEventAction.getEventCode(), "eventCode", packBean);
        }
        if (!StringUtils.isEmpty(mesEventAction.getActionCode())) {
            DdlPreparedPack.getStringLikerPack(mesEventAction.getActionCode(), "actionCode", packBean);
        }

        return packBean;
    }

    /******************created by wynne*************/
    /**
     * MES工序信息查询条件封装
     *
     * @param process
     * @return
     */
    public static DdlPackBean getMesProcess(MesProcess process, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(process, organizeCode);
        if (!StringUtils.isEmpty(process.getProcessCode())) {
            DdlPreparedPack.getStringLikerPack(process.getProcessCode(), "processCode", packBean);
        }
        if (!StringUtils.isEmpty(process.getProcessName())) {
            DdlPreparedPack.getStringLikerPack(process.getProcessName(), "processName", packBean);
        }

        return packBean;
    }

    /**
     * MES工步信息查询条件封装
     *
     * @param step
     * @return
     */
    public static DdlPackBean getMesStep(MesStep step, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(step, organizeCode);
        if (!StringUtils.isEmpty(step.getStepCode())) {
            DdlPreparedPack.getStringLikerPack(step.getStepCode(), "stepCode", packBean);
        }
        if (!StringUtils.isEmpty(step.getStepName())) {
            DdlPreparedPack.getStringLikerPack(step.getStepName(), "stepName", packBean);
        }
        if (!StringUtils.isEmpty(step.getStepType())) {
            DdlPreparedPack.getStringLikerPack(step.getStepType(), "stepType", packBean);
        }

        return packBean;
    }

    /**
     * MES工步参数信息查询条件封装
     *
     * @param stepParam
     * @return
     */
    public static DdlPackBean getMesStepParam(MesStepParam stepParam, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(stepParam, organizeCode);
        if (!StringUtils.isEmpty(stepParam.getStepCode())) {
            DdlPreparedPack.getStringEqualPack(stepParam.getStepCode(), "stepCode", packBean);
        }
        if (!StringUtils.isEmpty(stepParam.getParamCode())) {
            DdlPreparedPack.getStringLikerPack(stepParam.getParamCode(), "paramCode", packBean);
        }
        if (!StringUtils.isEmpty(stepParam.getParamName())) {
            DdlPreparedPack.getStringLikerPack(stepParam.getParamName(), "paramName", packBean);
        }

        return packBean;
    }

    /**
     * MES工序工作单元对应关系查询条件封装
     *
     * @param routeProcessCell
     * @return
     */
    public static DdlPackBean getMesRouteProcessCell(MesRouteProcessCell routeProcessCell, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(routeProcessCell, organizeCode);
        if (!StringUtils.isEmpty(routeProcessCell.getRouteCode())) {
            DdlPreparedPack.getStringEqualPack(routeProcessCell.getRouteCode(), "routeCode", packBean);
        }
        if (!StringUtils.isEmpty(routeProcessCell.getProcessCode())) {
            DdlPreparedPack.getStringEqualPack(routeProcessCell.getProcessCode(), "processCode", packBean);
        }
        if (!StringUtils.isEmpty(routeProcessCell.getWorkCellCode())) {
            DdlPreparedPack.getStringEqualPack(routeProcessCell.getWorkCellCode(), "workCellCode", packBean);
        }
        if (!StringUtils.isEmpty(routeProcessCell.getWorkCenterCode())) {
            DdlPreparedPack.getStringEqualPack(routeProcessCell.getWorkCenterCode(), "workCenterCode", packBean);
        }

        return packBean;
    }

    /**
     * MES BOM信息查询条件封装
     *
     * @param bom
     * @return
     */
    public static DdlPackBean getMesBom(MesBom bom, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(bom, organizeCode);
        if (!StringUtils.isEmpty(bom.getPartNo())) {
            DdlPreparedPack.getStringLikerPack(bom.getPartNo(), "partNo", packBean);
        }
        if (!StringUtils.isEmpty(bom.getItemPartNo())) {
            DdlPreparedPack.getStringLikerPack(bom.getItemPartNo(), "itemPartNo", packBean);
        }
        if (!StringUtils.isEmpty(bom.getBomVersion())) {
            DdlPreparedPack.getStringLikerPack(bom.getBomVersion(), "bomVersion", packBean);
        }

        return packBean;
    }

    /**
     * MES工序BOM信息查询条件封装
     *
     * @param processBom
     * @return
     */
    public static DdlPackBean getMesProcessBom(MesProcessBom processBom, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(processBom, organizeCode);
        DdlPreparedPack.getStringLikerPack(processBom.getPartNo(), "partNo", packBean);
        DdlPreparedPack.getStringLikerPack(processBom.getItemPartNo(), "itemPartNo", packBean);
        DdlPreparedPack.getStringLikerPack(processBom.getProcessCode(), "processCode", packBean);
        return packBean;
    }

    public static DdlPackBean getMesProcessBomExcludeById(MesProcessBom mesProcessBom, String org) {
        DdlPackBean packBean = getAllBaseData(org);
        DdlPreparedPack.getStringEqualPack(mesProcessBom.getPartNo(), "partNo", packBean);
        DdlPreparedPack.getStringEqualPack(mesProcessBom.getItemPartNo(), "itemPartNo", packBean);
        DdlPreparedPack.getStringEqualPack(mesProcessBom.getWorkCenterCode(), "workCenterCode", packBean);
        DdlPreparedPack.getStringEqualPack(mesProcessBom.getWorkCellCode(), "workCellCode", packBean);
        DdlPreparedPack.getNumEqualPack(mesProcessBom.getIsFeed(), "isFeed", packBean);
        DdlPreparedPack.getNumNOEqualPack(mesProcessBom.getId(), "id", packBean);
        return packBean;
    }

    /**
     * MES 客户信息查询条件封装
     *
     * @param customer
     * @return
     */
    public static DdlPackBean getMesCustomer(MesCustomer customer, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(customer, organizeCode);
        if (!StringUtils.isEmpty(customer.getCustomerCode())) {
            DdlPreparedPack.getStringLikerPack(customer.getCustomerCode(), "customerCode", packBean);
        }
        if (!StringUtils.isEmpty(customer.getCustomerName())) {
            DdlPreparedPack.getStringLikerPack(customer.getCustomerName(), "customerName", packBean);
        }

        return packBean;
    }

    /**
     * MES 客户产线信息查询条件封装
     *
     * @param custProdLine
     * @return
     */
    public static DdlPackBean getMesCustProdLine(MesCustProdLine custProdLine, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(custProdLine, organizeCode);
        if (!StringUtils.isEmpty(custProdLine.getCustProdLineCode())) {
            DdlPreparedPack.getStringLikerPack(custProdLine.getCustProdLineCode(), "custProdLineCode", packBean);
        }
        if (!StringUtils.isEmpty(custProdLine.getCustProdLineName())) {
            DdlPreparedPack.getStringLikerPack(custProdLine.getCustProdLineName(), "custProdLineName", packBean);
        }

        return packBean;
    }

    /**
     * MES 客户零件关系信息查询条件封装
     *
     * @param customerPart
     * @return
     */
    public static DdlPackBean getMesCustomerPart(MesCustomerPart customerPart, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(customerPart, organizeCode);
        if (!StringUtils.isEmpty(customerPart.getCustomerCode())) {
            DdlPreparedPack.getStringEqualPack(customerPart.getCustomerCode(), "customerCode", packBean);
        }
        if (!StringUtils.isEmpty(customerPart.getPartNo())) {
            DdlPreparedPack.getStringLikerPack(customerPart.getPartNo(), "partNo", packBean);
        }
        if (!StringUtils.isEmpty(customerPart.getCustomerPartNo())) {
            DdlPreparedPack.getStringLikerPack(customerPart.getCustomerPartNo(), "customerPartNo", packBean);
        }

        return packBean;
    }

    /**
     * MES 设备关键数据信息查询条件封装
     *
     * @param keyData
     * @return
     */
    public static DdlPackBean getMesKeyData(MesKeyData keyData, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(keyData, organizeCode);
        DdlPreparedPack.getStringLikerPack(keyData.getKeyDataCode(), "keyDataCode", packBean);
        DdlPreparedPack.getStringLikerPack(keyData.getKeyDataName(), "keyDataName", packBean);
        return packBean;
    }

    /**
     * MES 物料关键数据关系信息查询条件封装
     *
     * @param kpData
     * @return
     */
    public static DdlPackBean getMesKpData(MesKpData kpData, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(kpData, organizeCode);
        DdlPreparedPack.getStringLikerPack(kpData.getPartNo(), "partNo", packBean);
        DdlPreparedPack.getStringLikerPack(kpData.getKeyDataCode(), "keyDataCode", packBean);
        return packBean;
    }

    /**
     * MES 产品配置类型信息查询条件封装
     *
     * @param prodCfgType
     * @return
     */
    public static DdlPackBean getMesProdCfgType(MesProdCfgType prodCfgType, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(prodCfgType, organizeCode);
        if (!StringUtils.isEmpty(prodCfgType.getProdCfgTypeCode())) {
            DdlPreparedPack.getStringLikerPack(prodCfgType.getProdCfgTypeCode(), "prodCfgTypeCode", packBean);
        }
        if (!StringUtils.isEmpty(prodCfgType.getProdCfgTypeName())) {
            DdlPreparedPack.getStringLikerPack(prodCfgType.getProdCfgTypeName(), "prodCfgTypeName", packBean);
        }

        return packBean;
    }

    /**
     * MES 产品配置信息查询条件封装
     *
     * @param
     * @return
     */

    public static DdlPackBean getMesProdCfgExcludeById(MesProdRouteCfg mesProdRouteCfg, String org) {
        DdlPackBean packBean = getAllBaseData(org);
        DdlPreparedPack.getStringEqualPack(mesProdRouteCfg.getPartNo(), "partNo", packBean);
        DdlPreparedPack.getStringEqualPack(mesProdRouteCfg.getRouteCode(), "routeCode", packBean);
        DdlPreparedPack.getStringEqualPack(mesProdRouteCfg.getWorkCenterCode(), "workCenterCode", packBean);
        DdlPreparedPack.getNumNOEqualPack(mesProdRouteCfg.getId(), "id", packBean);
        return packBean;
    }

    public static DdlPackBean getMesProdCfg(MesProdCfg prodCfg, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(prodCfg, organizeCode);
        if (!StringUtils.isEmpty(prodCfg.getProdCfgCode())) {
            DdlPreparedPack.getStringLikerPack(prodCfg.getProdCfgCode(), "prodCfgCode", packBean);
        }
        if (!StringUtils.isEmpty(prodCfg.getProdCfgName())) {
            DdlPreparedPack.getStringLikerPack(prodCfg.getProdCfgName(), "prodCfgName", packBean);
        }
        if (!StringUtils.isEmpty(prodCfg.getProdCfgTypeCode())) {
            DdlPreparedPack.getStringEqualPack(prodCfg.getProdCfgTypeCode(), "prodCfgTypeCode", packBean);
        }

        return packBean;
    }

    /**
     * MES 产品配置关系信息查询条件封装
     *
     * @param prodCfgDetail
     * @return
     */
    public static DdlPackBean getMesProdCfgDetail(MesProdCfgDetail prodCfgDetail, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(prodCfgDetail, organizeCode);
        if (!StringUtils.isEmpty(prodCfgDetail.getProdCfgCode())) {
            DdlPreparedPack.getStringEqualPack(prodCfgDetail.getProdCfgCode(), "prodCfgCode", packBean);
        }
        if (!StringUtils.isEmpty(prodCfgDetail.getPartNo())) {
            DdlPreparedPack.getStringLikerPack(prodCfgDetail.getPartNo(), "partNo", packBean);
        }

        return packBean;
    }

    /**
     * MES 物料信息查询条件封装
     *
     * @param part
     * @return
     */
    public static DdlPackBean getMesPart(MesPart part, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(part, organizeCode);
        if (!StringUtils.isEmpty(part.getPartNo())) {
            DdlPreparedPack.getStringLikerPack(part.getPartNo(), "partNo", packBean);
        }
        if (!StringUtils.isEmpty(part.getPartName())) {
            DdlPreparedPack.getStringLikerPack(part.getPartName(), "partName", packBean);
        }
        if (!StringUtils.isEmpty(part.getCategoryCode1())) {
            DdlPreparedPack.getStringEqualPack(part.getCategoryCode1(), "categoryCode1", packBean);
        }
        if (!StringUtils.isEmpty(part.getCategoryCode2())) {
            DdlPreparedPack.getStringEqualPack(part.getCategoryCode2(), "categoryCode2", packBean);
        }
        if (!StringUtils.isEmpty(part.getCategoryCode3())) {
            DdlPreparedPack.getStringEqualPack(part.getCategoryCode3(), "categoryCode3", packBean);
        }

        return packBean;
    }

    /**
     * MES 物料分类信息查询条件封装
     *
     * @param partCategory
     * @return
     */
    public static DdlPackBean getMesPartCategory(MesPartCategory partCategory, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(partCategory, organizeCode);
        if (!StringUtils.isEmpty(partCategory.getCategoryCode())) {
            DdlPreparedPack.getStringLikerPack(partCategory.getCategoryCode(), "categoryCode", packBean);
        }
        if (!StringUtils.isEmpty(partCategory.getCategoryName())) {
            DdlPreparedPack.getStringLikerPack(partCategory.getCategoryName(), "categoryName", packBean);
        }

        return packBean;
    }

    /**
     * MES 包装规格信息查询条件封装
     *
     * @param packSpec
     * @return
     */
    public static DdlPackBean getMesPackSpec(MesPackSpec packSpec, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(packSpec, organizeCode);
        if (!StringUtils.isEmpty(packSpec.getSpecCode())) {
            DdlPreparedPack.getStringLikerPack(packSpec.getSpecCode(), "specCode", packBean);
        }
        if (!StringUtils.isEmpty(packSpec.getSpecName())) {
            DdlPreparedPack.getStringLikerPack(packSpec.getSpecName(), "specName", packBean);
        }
        if (!StringUtils.isEmpty(packSpec.getParentSpec())) {
            DdlPreparedPack.getStringEqualPack(packSpec.getParentSpec(), "parentSpec", packBean);
        }

        return packBean;
    }

    /**
     * MES 产品类型信息查询条件封装
     *
     * @param produceCategory
     * @return
     */
    public static DdlPackBean getMesProduceCategory(MesProduceCategory produceCategory, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(produceCategory, organizeCode);
        if (!StringUtils.isEmpty(produceCategory.getProduceCategoryCode())) {
            DdlPreparedPack.getStringLikerPack(produceCategory.getProduceCategoryCode(), "produceCategoryCode", packBean);
        }
        if (!StringUtils.isEmpty(produceCategory.getProduceCategoryName())) {
            DdlPreparedPack.getStringLikerPack(produceCategory.getProduceCategoryName(), "produceCategoryName", packBean);
        }

        return packBean;
    }

    /**
     * MES 关键件条码规则信息查询条件封装
     *
     * @param kpsnRule
     * @return
     */
    public static DdlPackBean getMesKpsnRule(MesKpsnRule kpsnRule, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(kpsnRule, organizeCode);
        if (!StringUtils.isEmpty(kpsnRule.getPartNo())) {
            DdlPreparedPack.getStringLikerPack(kpsnRule.getPartNo(), "partNo", packBean);
        }

        return packBean;
    }

    /**
     * MES 产品排程清单信息查询条件封装
     *
     * @param partScheduleBom
     * @return
     */
    public static DdlPackBean getMesPartScheduleBom(MesPartScheduleBom partScheduleBom, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(partScheduleBom, organizeCode);
        if (!StringUtils.isEmpty(partScheduleBom.getPartNo())) {
            DdlPreparedPack.getStringLikerPack(partScheduleBom.getPartNo(), "partNo", packBean);
        }
        if (!StringUtils.isEmpty(partScheduleBom.getItemPartNo())) {
            DdlPreparedPack.getStringLikerPack(partScheduleBom.getItemPartNo(), "itemPartNo", packBean);
        }

        return packBean;
    }

    /**
     * MES对象与dao对应关系查询条件封装
     *
     * @param objectDao
     * @return
     */
    public static DdlPackBean getMesObjectDao(MesObjectDao objectDao, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(objectDao, organizeCode);
        if (!StringUtils.isEmpty(objectDao.getObjectCode())) {
            DdlPreparedPack.getStringLikerPack(objectDao.getObjectCode(), "objectCode", packBean);
        }
        if (!StringUtils.isEmpty(objectDao.getDaoClass())) {
            DdlPreparedPack.getStringLikerPack(objectDao.getDaoClass(), "daoClass", packBean);
        }

        return packBean;
    }

    /**
     * MES-PCN同步配置查询条件封装
     *
     * @param pcnSyncCfg
     * @return
     */
    public static DdlPackBean getMesPcnSyncCfg(MesPcnSyncCfg pcnSyncCfg, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(pcnSyncCfg, organizeCode);
        if (!StringUtils.isEmpty(pcnSyncCfg.getObjectCode())) {
            DdlPreparedPack.getStringLikerPack(pcnSyncCfg.getObjectCode(), "objectCode", packBean);
        }
        if (!StringUtils.isEmpty(pcnSyncCfg.getPcnCode())) {
            DdlPreparedPack.getStringLikerPack(pcnSyncCfg.getPcnCode(), "pcnCode", packBean);
        }
        if (null != pcnSyncCfg.getSyncType()) {
            DdlPreparedPack.getNumEqualPack(pcnSyncCfg.getSyncType(), "syncType", packBean);
        }

        return packBean;
    }

    /**
     * MES工作单元参数配置查询条件封装
     *
     * @param workCellParamCfg
     * @return
     */
    public static DdlPackBean getMesWorkCellParamCfg(MesWorkCellParamCfg workCellParamCfg, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(workCellParamCfg, organizeCode);
        if (!StringUtils.isEmpty(workCellParamCfg.getWorkCellCode())) {
            DdlPreparedPack.getStringLikerPack(workCellParamCfg.getWorkCellCode(), "workCellCode", packBean);
        }
        if (!StringUtils.isEmpty(workCellParamCfg.getParamCode())) {
            DdlPreparedPack.getStringLikerPack(workCellParamCfg.getParamCode(), "paramCode", packBean);
        }

        return packBean;
    }

    /**
     * MES工作单元参数查询条件封装
     *
     * @param workCellParam
     * @return
     */
    public static DdlPackBean getMesWorkCellParam(MesWorkCellParam workCellParam, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(workCellParam, organizeCode);
        if (!StringUtils.isEmpty(workCellParam.getParamCode())) {
            DdlPreparedPack.getStringLikerPack(workCellParam.getParamCode(), "paramCode", packBean);
        }
        if (null != workCellParam.getParamType()) {
            DdlPreparedPack.getNumEqualPack(workCellParam.getParamType(), "paramType", packBean);
        }
        if (null != workCellParam.getParamModel()) {
            DdlPreparedPack.getNumEqualPack(workCellParam.getParamModel(), "paramModel", packBean);
        }
        return packBean;
    }


    /**
     * MES工作单元队列查询条件封装
     *
     * @param workCellPoint
     * @return
     */
    public static DdlPackBean getMesWorkCellPoint(MesWorkCellPoint workCellPoint, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(workCellPoint, organizeCode);
        if (!StringUtils.isEmpty(workCellPoint.getWorkCellCode())) {
            DdlPreparedPack.getStringEqualPack(workCellPoint.getWorkCellCode(), "workCellCode", packBean);
        }
        return packBean;
    }

    /**
     * PLC设备信息配置查询条件封装
     *
     * @param plcConfigure
     * @return
     */
    public static DdlPackBean getMesPLCConfigure(MesPLCConfigure plcConfigure, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(plcConfigure, organizeCode);
        if (!StringUtils.isEmpty(plcConfigure.getAreaCode())) {
            DdlPreparedPack.getStringEqualPack(plcConfigure.getAreaCode(), "areaCode", packBean);
        }
        if (!StringUtils.isEmpty(plcConfigure.getWorkCenterCode())) {
            DdlPreparedPack.getStringEqualPack(plcConfigure.getWorkCenterCode(), "workCenterCode", packBean);
        }
        if (!StringUtils.isEmpty(plcConfigure.getWorkCellCode())) {
            DdlPreparedPack.getStringEqualPack(plcConfigure.getWorkCellCode(), "workCellCode", packBean);
        }
        return packBean;
    }

    /**
     * Mes条码生成规则
     *
     * @param numberRule
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getMesNumberRule(MesNumberRule numberRule, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(numberRule, organizeCode);
        if (!StringUtils.isEmpty(numberRule.getRuleCode())) {
            DdlPreparedPack.getStringLikerPack(numberRule.getRuleCode(), "ruleCode", packBean);
        }
        if (!StringUtils.isEmpty(numberRule.getNumberRule())) {
            DdlPreparedPack.getStringLikerPack(numberRule.getNumberRule(), "numberRule", packBean);
        }
        if (!StringUtils.isEmpty(numberRule.getPrefix())) {
            DdlPreparedPack.getNumEqualPack(numberRule.getPrefix(), "prefix", packBean);
        }
        if (null != numberRule.getIsCycle()) {
            DdlPreparedPack.getNumEqualPack(numberRule.getIsCycle(), "isCycle", packBean);
        }

        packBean.setOrderByStr(numberRule.orderBy());
        return packBean;
    }

    /**
     * mes-pcn定时任务清单
     *
     * @param mesPcnTask
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getMesPcnTask(MesPcnTask mesPcnTask, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesPcnTask, organizeCode);
        DdlPreparedPack.getStringLikerPack(mesPcnTask.getTaskCode(), "taskCode", packBean);
        DdlPreparedPack.getStringLikerPack(mesPcnTask.getTaskName(), "taskName", packBean);
        packBean.setOrderByStr(mesPcnTask.orderBy());
        return packBean;
    }

    /**
     * 条码生成规则校验同一机构下条码规则唯一性
     *
     * @param numberRule
     * @param id
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getMesNumberRuleCheck(String numberRule, Long id, String organizeCode) {
        DdlPackBean packBean = new DdlPackBean();
        DdlPreparedPack.getStringEqualPack(organizeCode, "organizeCode", packBean);
        DdlPreparedPack.getStringEqualPack(numberRule, "numberRule", packBean);
        if (null != id) {
            DdlPreparedPack.getNumNOEqualPack(id, "id", packBean);
        }
        return packBean;
    }

    /**
     * 系统业务动作
     *
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getMesAllData(String organizeCode) {
        DdlPackBean packBean = new DdlPackBean();
        DdlPreparedPack.getStringEqualPack(organizeCode, "organizeCode", packBean);
        DdlPreparedPack.getNumEqualPack(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), "isDeleted", packBean);
        DdlPreparedPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(), "isValid", packBean);
        return packBean;
    }

    /**
     * 按钮条件配置
     *
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getMesButtonStatus(MesButtonStatus buttonStatus, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(buttonStatus, organizeCode);
        if (!StringUtils.isEmpty(buttonStatus.getButtonCode())) {
            DdlPreparedPack.getStringLikerPack(buttonStatus.getButtonCode(), "buttonCode", packBean);
        }
        packBean.setOrderByStr(buttonStatus.orderBy());
        return packBean;
    }

    /**
     * 工单审批查询
     * @param mesWorkOrder
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getApprovalData(MesWorkOrder mesWorkOrder, String organizeCode) {
        DdlPackBean packBean = MesHqlPack.getAllBaseData(organizeCode);
        DdlPreparedPack.getStringEqualPack(mesWorkOrder.getWorkCenterCode(), "workCenterCode", packBean);
        if (!StringUtils.isEmpty(mesWorkOrder.getOrderNo())) {
            DdlPreparedPack.getStringEqualPack(mesWorkOrder.getOrderNo(), "orderNo", packBean);
        }
        if (!StringUtils.isEmpty(mesWorkOrder.getPartNo())) {
            DdlPreparedPack.getStringEqualPack(mesWorkOrder.getPartNo(), "partNo", packBean);
        }
        DdlPreparedPack.getNumEqualPack(MesEnumUtil.WORK_ORDER_APPROVAL_STATUS.WAIT_APPROVAL.getValue(), "approvalStatus", packBean);
        DdlPreparedPack.getNumEqualPack(MesEnumUtil.WORK_ORDER_STATUS.CREATE.getValue(), "workOrderStatus", packBean);
        DdlPreparedPack.getOrderByPack(new String[]{String.valueOf(CommonEnumUtil.ASC_OR_DESC.ASC.getValue())}, new String[]{"startTime", "shiftCode"}, packBean);
        return packBean;
    }

    /**
     * MES Plc设备信息配置查询条件封装
     * @param mesPlc
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getMesPlc(MesPlc mesPlc, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesPlc, organizeCode);
        if (!StringUtils.isEmpty(mesPlc.getPlcCode())) {
            DdlPreparedPack.getStringLikerPack(mesPlc.getPlcCode(), "plcCode", packBean);
        }
        if (!StringUtils.isEmpty(mesPlc.getPlcName())) {
            DdlPreparedPack.getStringLikerPack(mesPlc.getPlcName(), "plcName", packBean);
        }
        if (!StringUtils.isEmpty(mesPlc.getChannel())) {
            DdlPreparedPack.getStringLikerPack(mesPlc.getChannel(), "channel", packBean);
        }
        if (!StringUtils.isEmpty(mesPlc.getTagAddress())) {
            DdlPreparedPack.getStringLikerPack(mesPlc.getTagAddress(), "tagAddress", packBean);
        }
        if (!StringUtils.isEmpty(mesPlc.getWorkCenterCode())) {
            DdlPreparedPack.getStringEqualPack(mesPlc.getWorkCenterCode(), "workCenterCode", packBean);
        }
        if (!StringUtils.isEmpty(mesPlc.getPlcCode())) {
            DdlPreparedPack.getStringEqualPack(mesPlc.getWorkCellCode(), "workCellCode", packBean);
        }
        return packBean;
    }

    /**
     * MES DB地址清单查询条件封装
     * @param mesDatasource
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getMesDatasource(MesDatasource mesDatasource, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesDatasource, organizeCode);
        if (!StringUtils.isEmpty(mesDatasource.getDsCode())) {
            DdlPreparedPack.getStringLikerPack(mesDatasource.getDsCode(), "dsCode", packBean);
        }
        if (!StringUtils.isEmpty(mesDatasource.getDsType())) {
            DdlPreparedPack.getStringLikerPack(mesDatasource.getDsType(), "dsType", packBean);
        }
        if (!StringUtils.isEmpty(mesDatasource.getDsDbName())) {
            DdlPreparedPack.getStringLikerPack(mesDatasource.getDsDbName(), "dsDbName", packBean);
        }
        return packBean;
    }

    /**
     * MES 设备故障处理方法查询条件封装
     * @param mesFaultMethod
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getMesFaultMethod(MesFaultMethod mesFaultMethod, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesFaultMethod, organizeCode);
        if (!StringUtils.isEmpty(mesFaultMethod.getFmCode())) {
            DdlPreparedPack.getStringLikerPack(mesFaultMethod.getFmCode(), "fmCode", packBean);
        }
        if (!StringUtils.isEmpty(mesFaultMethod.getFmName())) {
            DdlPreparedPack.getStringLikerPack(mesFaultMethod.getFmName(), "fmName", packBean);
        }
        if (!StringUtils.isEmpty(mesFaultMethod.getParentFmCode())) {
            DdlPreparedPack.getStringLikerPack(mesFaultMethod.getParentFmCode(), "parentFmCode", packBean);
        }
        return packBean;
    }

    /**
     * MES 设备故障原因查询条件封装
     * @param mesFaultCause
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getMesFaultCause(MesFaultCause mesFaultCause, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesFaultCause, organizeCode);
        if (!StringUtils.isEmpty(mesFaultCause.getFcCode())) {
            DdlPreparedPack.getStringLikerPack(mesFaultCause.getFcCode(), "fcCode", packBean);
        }
        if (!StringUtils.isEmpty(mesFaultCause.getFcName())) {
            DdlPreparedPack.getStringLikerPack(mesFaultCause.getFcName(), "fcName", packBean);
        }
        if (!StringUtils.isEmpty(mesFaultCause.getParentFcCode())) {
            DdlPreparedPack.getStringLikerPack(mesFaultCause.getParentFcCode(), "parentFcCode", packBean);
        }
        return packBean;
    }

    /**
     * MES 设备故障现象查询条件封装
     * @param mesFaultPhenomenon
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getMesFaultPhenomenon(MesFaultPhenomenon mesFaultPhenomenon, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesFaultPhenomenon, organizeCode);
        if (!StringUtils.isEmpty(mesFaultPhenomenon.getFpCode())) {
            DdlPreparedPack.getStringLikerPack(mesFaultPhenomenon.getFpCode(), "fpCode", packBean);
        }
        if (!StringUtils.isEmpty(mesFaultPhenomenon.getFpName())) {
            DdlPreparedPack.getStringLikerPack(mesFaultPhenomenon.getFpName(), "fpName", packBean);
        }
        if (!StringUtils.isEmpty(mesFaultPhenomenon.getParentFpCode())) {
            DdlPreparedPack.getStringLikerPack(mesFaultPhenomenon.getParentFpCode(), "parentFpCode", packBean);
        }
        return packBean;
    }

    /**
     * MES 过程质量检验查询条件封装
     * @param mesQcCheckStandard
     * @param organizeCode
     * @return
     */
    public static DdlPackBean getMesQcCheckStandard(MesQcCheckStandard mesQcCheckStandard, String organizeCode) {
        DdlPackBean packBean = getAllBaseDataByNormalPro(mesQcCheckStandard, organizeCode);
        if (!StringUtils.isEmpty(mesQcCheckStandard.getPartNo())) {
            DdlPreparedPack.getStringEqualPack(mesQcCheckStandard.getPartNo(), "partNo", packBean);
        }
        if (!StringUtils.isEmpty(mesQcCheckStandard.getWorkCellCode())) {
            DdlPreparedPack.getStringEqualPack(mesQcCheckStandard.getWorkCellCode(), "workCellCode", packBean);
        }
        if (!StringUtils.isEmpty(mesQcCheckStandard.getWorkCenterCode())) {
            DdlPreparedPack.getStringEqualPack(mesQcCheckStandard.getWorkCenterCode(), "workCenterCode", packBean);
        }
        if (null == mesQcCheckStandard.getCheckType()) {
            DdlPreparedPack.getNumberBiggerEqualPack(mesQcCheckStandard.getCheckType(), "checkType", packBean);
        }
        if (!StringUtils.isEmpty(mesQcCheckStandard.getCheckItem())) {
            DdlPreparedPack.getStringLikerPack(mesQcCheckStandard.getCheckItem(), "checkItem", packBean);
        }
        return packBean;
    }
}
