//package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.base.ep;
//
//import cn.estsh.i3plus.ext.mes.pcn.api.base.ep.IEpEquipmentCheckDetailService;
//import cn.estsh.i3plus.ext.mes.pcn.pojo.bean.MesEpEquipmentCheck;
//import cn.estsh.i3plus.ext.mes.pcn.pojo.bean.MesEpEquipmentCheckDetail;
//import cn.estsh.i3plus.ext.mes.pcn.pojo.bean.MesOrderJob;
//import cn.estsh.i3plus.ext.mes.pcn.pojo.bean.MesWorkCenterExt;
//import cn.estsh.i3plus.ext.mes.pcn.pojo.model.ep.EpEquipmentCheckDetailModel;
//import cn.estsh.i3plus.ext.mes.pcn.pojo.repository.MesEpEquipmentCheckDetailRepository;
//import cn.estsh.i3plus.ext.mes.pcn.pojo.repository.MesEpEquipmentCheckRepository;
//import cn.estsh.i3plus.ext.mes.pcn.pojo.repository.MesOrderJobRepository;
//import cn.estsh.i3plus.ext.mes.pcn.pojo.repository.MesWorkCenterExtRepository;
//import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
//import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtEnumUtil;
//import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService;
//import cn.estsh.i3plus.mes.pcn.util.DateUtil;
//import cn.estsh.i3plus.platform.common.convert.ConvertBean;
//import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
//import cn.estsh.i3plus.platform.common.tool.TimeTool;
//import cn.estsh.i3plus.platform.common.util.MesConstWords;
//import cn.estsh.i3plus.pojo.base.bean.BaseResultBean;
//import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
//import cn.estsh.i3plus.pojo.base.bean.ListPager;
//import cn.estsh.i3plus.pojo.base.common.Pager;
//import cn.estsh.i3plus.pojo.base.common.PagerHelper;
//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.model.GenSerialNoModel;
//import cn.estsh.i3plus.pojo.mes.sqlpack.MesHqlPack;
//import cn.estsh.impp.framework.boot.auth.AuthUtil;
//import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
//import org.springframework.beans.BeanUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.util.CollectionUtils;
//import org.springframework.util.ObjectUtils;
//import org.springframework.util.StringUtils;
//
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.List;
//import java.util.Map;
//import java.util.stream.Collectors;
//
///**
// * @PROJECT_NAME: i3plus-mes-panasonic-dev
// * @DESCRIPTION:
// * @USER: xinwang.yi
// * @DATE: 2021-12-14 10:32
// */
//@Service
//public class EpEquipmentCheckDetailService implements IEpEquipmentCheckDetailService {
//
//    @Autowired
//    private MesEpEquipmentCheckRepository epEquipmentCheckRepository;
//
//    @Autowired
//    private MesEpEquipmentCheckDetailRepository equDetailRepository;
//
//    @Autowired
//    private MesOrderJobRepository mesOrderJobRepository;
//    @Autowired
//    private MesWorkCenterExtRepository workCenterRepository;
//    @Autowired
//    private ISyncFuncService syncFuncService;
//
//    @Override
//    public ListPager<EpEquipmentCheckDetailModel> queryByPager(MesEpEquipmentCheckDetail equipmentCheck, Pager pager) {
//        String workCenterCode = equipmentCheck.getWorkCenterCode();
//        String organizeCode = equipmentCheck.getOrganizeCode();
//        DdlPackBean packBean = MesHqlPack.getMesAllData(organizeCode);
//        DdlPreparedPack.getStringEqualPack(equipmentCheck.getOrderJobNo(), MesPcnExtConstWords.ORDER_JOB_NO, packBean);
//        DdlPreparedPack.getStringEqualPack(equipmentCheck.getWorkCellCode(), "workCellCode", packBean);
//
//        DdlPreparedPack.getNumEqualPack(equipmentCheck.getIsValid(), MesPcnExtConstWords.IS_VALID, packBean);
//        DdlPreparedPack.getStringEqualPack(workCenterCode, MesPcnExtConstWords.WORK_CENTER_CODE, packBean);
//        pager = PagerHelper.getPager(pager, equDetailRepository.findByHqlWhereCount(packBean));
//        List<MesEpEquipmentCheckDetail> equipmentCheckDetails = equDetailRepository.findByHqlWherePage(packBean, pager);
//        List<EpEquipmentCheckDetailModel> epEquipmentCheckDetailModels = new ArrayList<>();
//        for(MesEpEquipmentCheckDetail epEquipmentCheckDetail: equipmentCheckDetails){
//            EpEquipmentCheckDetailModel epEquipmentCheckDetailModel = new EpEquipmentCheckDetailModel();
//            BeanUtils.copyProperties(epEquipmentCheckDetail, epEquipmentCheckDetailModel);
//            epEquipmentCheckDetailModel.setResutlTypeName(MesPcnExtEnumUtil.EP_EQUIPMENT_CHECK_RESULT_TYPE.valueOfDescription(epEquipmentCheckDetailModel.getResultType()));
//            epEquipmentCheckDetailModels.add(epEquipmentCheckDetailModel);
//        }
//        return new ListPager(epEquipmentCheckDetailModels, pager);
//    }
//
//    /**
//     * 新增
//     *
//     * @param equipmentCheck
//     * @return
//     */
//    @Override
//    public MesEpEquipmentCheckDetail insert(MesEpEquipmentCheckDetail equipmentCheck) {
//        ConvertBean.modelInitialize(equipmentCheck, AuthUtil.getSessionUser());
//        equipmentCheck.setOrganizeCode(AuthUtil.getOrganize().getOrganizeCode());
//        return equDetailRepository.insert(equipmentCheck);
//    }
//
//    /**
//     * 修改
//     *
//     * @param equipmentCheck
//     * @return
//     */
//    @Override
//    public void update(MesEpEquipmentCheckDetail equipmentCheck) {
//        //1、判断单据是否存在
//        Long id = equipmentCheck.getId();
//        MesEpEquipmentCheckDetail equipmentCheckMeta = equDetailRepository.getById(id);
//        if (ObjectUtils.isEmpty(equipmentCheckMeta)) {
//            throwImppException(CommonEnumUtil.SOFT_TYPE.MES_PCN.getCode(), ImppExceptionEnum.VARIFY_EXCEPTION_DATA_NOT_EXIT.getCode(), "点检信息不存在");
//        }
//
//        ConvertBean.serviceModelUpdate(equipmentCheckMeta, equipmentCheck.getModifyUser());
//        equipmentCheckMeta.setSpotCheckTime(equipmentCheckMeta.getModifyDatetime());
//        equipmentCheckMeta.setSpotCheckUser(equipmentCheckMeta.getModifyUser());
//
//        //根据单号查询任务主表信息
//        String orderJobNo = equipmentCheckMeta.getOrderJobNo();
//        DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(equipmentCheck.getOrganizeCode());
//        DdlPreparedPack.getStringEqualPack(orderJobNo, MesPcnExtConstWords.ORDER_NO, ddlPackBean);
//        MesOrderJob mesOrderJob = mesOrderJobRepository.getByProperty(ddlPackBean);
//
//        if(null == mesOrderJob){
//            throw ImppExceptionBuilder.newInstance()
//                    .setSystemID(CommonEnumUtil.SOFT_TYPE.MES_PCN.getCode())
//                    .setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
//                    .setErrorDetail("单据【%s】不存在",orderJobNo)
//                    .build();
//        }
//
//        switch (MesPcnExtEnumUtil.EP_EQUIPMENT_CHECK_RESULT_TYPE.valueOfDescription(equipmentCheck.getResultType())){
//            case MesPcnExtConstWords.COMPARE_TYPE:
//                if(StringUtils.isEmpty(equipmentCheck.getResultValue())){
//                    equipmentCheckMeta.setRemark(equipmentCheck.getRemark());
//                    equipmentCheckMeta.setCheckResult(equipmentCheck.getCheckResult());
//                    equipmentCheckMeta.setResultValue("");
//                }else{
//                    try{
//                        Double.valueOf(equipmentCheck.getResultValue());
//                    }catch (Exception e){
//                        throwImppException(CommonEnumUtil.SOFT_TYPE.MES_PCN.getCode(), ImppExceptionEnum.VARIFY_EXCEPTION.getCode(), "实际值不是数值型");
//                    }
//                    //如果上限值和下限值为空
//                    if(StringUtils.isEmpty(equipmentCheckMeta.getUpLimit()) && StringUtils.isEmpty(equipmentCheckMeta.getDownLimit())){
//                        equipmentCheckMeta.setRemark(equipmentCheck.getRemark());
//                        equipmentCheckMeta.setCheckResult(equipmentCheck.getCheckResult());
//                        equipmentCheckMeta.setResultValue(equipmentCheck.getResultValue());
//                    }else if(!StringUtils.isEmpty(equipmentCheckMeta.getDownLimit()) && !StringUtils.isEmpty(equipmentCheckMeta.getUpLimit())){
//                        Double downLimit = Double.valueOf(equipmentCheckMeta.getDownLimit());
//                        Double upLimit = Double.valueOf(equipmentCheckMeta.getUpLimit());
//                        Double resultValue = Double.valueOf(equipmentCheck.getResultValue());
//                        //如果实际值在规定范围之内
//                        if(resultValue>= downLimit && resultValue<= upLimit){
//                            equipmentCheckMeta.setRemark(equipmentCheck.getRemark());
//                            equipmentCheckMeta.setResultValue(equipmentCheck.getResultValue());
//
//                            if(StringUtils.isEmpty(equipmentCheck.getCheckResult())){
//                                equipmentCheckMeta.setCheckResult(MesPcnExtConstWords.OK);
//                            }else if(equipmentCheck.getCheckResult() == MesPcnExtConstWords.NG){
//                                equipmentCheckMeta.setCheckResult(MesPcnExtConstWords.OK);
//                            } else {
//                                equipmentCheckMeta.setCheckResult(equipmentCheck.getCheckResult());
//                            }
//
//                        }else{
//                            //实际值不在范围之内
//                            //如果点检结果是空的
//                            if(StringUtils.isEmpty(equipmentCheck.getCheckResult())){
//                                equipmentCheckMeta.setRemark(equipmentCheck.getRemark());
//                                equipmentCheckMeta.setResultValue(equipmentCheck.getResultValue());
//                                equipmentCheckMeta.setCheckResult(MesPcnExtConstWords.NG);
//                            }else{
//                                //如果点检结果是10
//                                if(equipmentCheck.getCheckResult() == MesPcnExtConstWords.OK && !MesPcnExtConstWords.INCONFORMITY.equals(equipmentCheck.getRemark())){
//                                    equipmentCheckMeta.setCheckResult(MesPcnExtConstWords.NG);
//                                    equipmentCheckMeta.setRemark(equipmentCheck.getRemark());
//                                    equipmentCheckMeta.setResultValue(equipmentCheck.getResultValue());
//                                }else{
//                                    //20 40 原值保存
//                                    equipmentCheckMeta.setRemark(equipmentCheck.getRemark());
//                                    equipmentCheckMeta.setResultValue(equipmentCheck.getResultValue());
//                                    equipmentCheckMeta.setCheckResult(equipmentCheck.getCheckResult());
//                                }
//                            }
//                        }
//                    } else if(!StringUtils.isEmpty(equipmentCheckMeta.getDownLimit())){
//                        equipmentCheckMeta.setRemark(equipmentCheck.getRemark());
//                        equipmentCheckMeta.setResultValue(equipmentCheck.getResultValue());
//                        if(Double.valueOf(equipmentCheck.getResultValue()) < Double.valueOf(equipmentCheckMeta.getDownLimit())){
//                            if(equipmentCheck.getCheckResult() == MesPcnExtConstWords.OK && !MesPcnExtConstWords.INCONFORMITY.equals(equipmentCheck.getRemark())){
//                                equipmentCheckMeta.setCheckResult(MesPcnExtConstWords.NG);
//                            }else{
//                                equipmentCheckMeta.setCheckResult(equipmentCheck.getCheckResult());
//                            }
//                        }else{
//                            if(equipmentCheck.getCheckResult() == MesPcnExtConstWords.NG){
//                                equipmentCheckMeta.setCheckResult(MesPcnExtConstWords.OK);
//                            }else{
//                                equipmentCheckMeta.setCheckResult(equipmentCheck.getCheckResult());
//                            }
//                        }
//                    }else if(!StringUtils.isEmpty(equipmentCheckMeta.getUpLimit())){
//                        equipmentCheckMeta.setRemark(equipmentCheck.getRemark());
//                        equipmentCheckMeta.setResultValue(equipmentCheck.getResultValue());
//                        if(Double.valueOf(equipmentCheck.getResultValue()) > Double.valueOf(equipmentCheckMeta.getUpLimit())){
//                            if(equipmentCheck.getCheckResult() == MesPcnExtConstWords.OK && !MesPcnExtConstWords.INCONFORMITY.equals(equipmentCheck.getRemark())){
//                                equipmentCheckMeta.setCheckResult(MesPcnExtConstWords.NG);
//                            }else{
//                                equipmentCheckMeta.setCheckResult(equipmentCheck.getCheckResult());
//                            }
//                        }else{
//                            if(equipmentCheck.getCheckResult() == MesPcnExtConstWords.NG){
//                                equipmentCheckMeta.setCheckResult(MesPcnExtConstWords.OK);
//                            }else{
//                                equipmentCheckMeta.setCheckResult(equipmentCheck.getCheckResult());
//                            }
//                        }
//                    }
//                }
//                break;
//            case MesPcnExtConstWords.RESULT_TYPE:
//                equipmentCheckMeta.setRemark(equipmentCheck.getRemark());
//                equipmentCheckMeta.setResultValue(equipmentCheck.getResultValue());
//                equipmentCheckMeta.setCheckResult(equipmentCheck.getCheckResult());
//                break;
//            case MesPcnExtConstWords.EQUAL_TYPE:
//                //点检结果为空的时候
//                if(StringUtils.isEmpty(equipmentCheckMeta.getStandardValue()) && StringUtils.isEmpty(equipmentCheck.getCheckResult())){
//                    equipmentCheckMeta.setRemark(equipmentCheck.getRemark());
//                    equipmentCheckMeta.setResultValue(equipmentCheck.getResultValue());
//                }else{
//                    //结果不为空
//                    equipmentCheckMeta.setRemark(equipmentCheck.getRemark());
//                    equipmentCheckMeta.setResultValue(equipmentCheck.getResultValue());
//                    //标准值不为空
//                    if(!StringUtils.isEmpty(equipmentCheckMeta.getStandardValue())){
//                        //用户输入的标准值和之前设定的标准值都不为空
//                        if(equipmentCheckMeta.getStandardValue().equals(equipmentCheck.getResultValue())){
//                            if(!StringUtils.isEmpty(equipmentCheck.getCheckResult())){
//                                //当标准值一致，但点检结果为30时
//                                if(equipmentCheck.getCheckResult() == MesPcnExtConstWords.NG){
//                                    equipmentCheckMeta.setCheckResult(MesPcnExtConstWords.OK);
//                                }else{
//                                    // 20 & 40 原值保存
//                                    equipmentCheckMeta.setCheckResult(equipmentCheck.getCheckResult());
//                                }
//                            }else{
//                                // 标准值一致，点检结果为空
//                                equipmentCheckMeta.setCheckResult(MesPcnExtConstWords.OK);
//                            }
//                        }else{
//                            //如果点检结果为空
//                            if(equipmentCheck.getCheckResult()==MesPcnExtConstWords.OK && !MesPcnExtConstWords.INCONFORMITY.equals(equipmentCheck.getRemark())){
//                                equipmentCheckMeta.setCheckResult(MesPcnExtConstWords.NG);
//                            }else{
//                                equipmentCheckMeta.setCheckResult(equipmentCheck.getCheckResult());
//                            }
//                        }
//                    }else{
//                        // 标准值为空 保存备注和结果
//                        equipmentCheckMeta.setCheckResult(equipmentCheck.getCheckResult());
//                    }
//                }
//                break;
//        }
//
//        mesOrderJob.setOrderStatus(MesPcnExtEnumUtil.MES_ORJ_ORDER_STATUS.CHECKING.getValue());
//        ConvertBean.serviceModelUpdate(mesOrderJob,equipmentCheck.getCreateUser());
//        mesOrderJobRepository.save(mesOrderJob);
//        ConvertBean.serviceModelUpdate(equipmentCheckMeta,equipmentCheck.getCreateUser());
//        equipmentCheckMeta.setSystemSyncStatus(MesPcnExtEnumUtil.IF_SYNC_STATUS.NO_SYNC.getValue());
//        equDetailRepository.save(equipmentCheckMeta);
//
//    }
//
//    private MesWorkCenterExt getWorkCenter(String workCenterCode, String organizeCode) {
//        return workCenterRepository.getByProperty(
//                new String[]{MesPcnExtConstWords.WORK_CENTER_CODE, MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.IS_DELETED},
//                new Object[]{workCenterCode, organizeCode,
//                        CommonEnumUtil.IS_VAILD.VAILD.getValue(),
//                        CommonEnumUtil.IS_DEAL.NO.getValue()});
//    }
//
//    /**
//     * 根据
//     *
//     * @param id
//     * @param status
//     * @return
//     */
//    @Override
//    public int updateIsValidById(long id, Integer status) {
//        //1、判断单据是否存在
//        MesEpEquipmentCheckDetail equipmentCheck = equDetailRepository.getById(id);
//        if (ObjectUtils.isEmpty(equipmentCheck)) {
//            throwImppException(CommonEnumUtil.SOFT_TYPE.MES_PCN.getCode(), ImppExceptionEnum.VARIFY_EXCEPTION_DATA_NOT_EXIT.getCode(), "自动配置不存在");
//        }
//
//        return equDetailRepository.updateByProperties(new String[]{ MesPcnExtConstWords.ID}, new Object[]{id},
//                new String[]{MesConstWords.IS_VALID, MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME},
//                new Object[]{status, AuthUtil.getSessionUser().getUserName(), TimeTool.getNowTime(true)});
//    }
//
//    @Override
//    public List<String> queryCell(MesEpEquipmentCheckDetail detail) {
//        DdlPackBean packBean = MesHqlPack.getMesAllData(detail.getOrganizeCode());
//        DdlPreparedPack.getStringEqualPack(detail.getWorkCellCode(), "workCellCode", packBean);
//        DdlPreparedPack.getStringEqualPack(detail.getWorkCenterCode(), "workCenterCode", packBean);
//        DdlPreparedPack.getStringEqualPack(detail.getOrderJobNo(), "orderJobNo", packBean);
//        List<MesEpEquipmentCheckDetail> details = equDetailRepository.findByHqlWhere(packBean);
//        return details.stream().map(MesEpEquipmentCheckDetail::getWorkCellCode).distinct().collect(Collectors.toList());
//    }
//
//    @Override
//    public void generateWeekCheck(String organizeCode,String workCenterCode) {
//        generateOrderJob(organizeCode,workCenterCode,MesPcnExtEnumUtil.MES_EQUIPMENT_CHECK_TYPE.WEEK_CHECK.getValue());
//    }
//
//    @Override
//    public void generateMonthCheck(String organizeCode,String workCenterCode) {
//        generateOrderJob(organizeCode,workCenterCode,MesPcnExtEnumUtil.MES_EQUIPMENT_CHECK_TYPE.MONTH_CHECK.getValue());
//    }
//
//    //生产单据作业
//    private void generateOrderJob(String organizeCode, String workCenterCode, String checkType) {
//        List<MesEpEquipmentCheck> mesEquipmentChecks = findEquByCenterCode(organizeCode, workCenterCode, checkType);
//        if (!CollectionUtils.isEmpty(mesEquipmentChecks)) {
//            MesWorkCenterExt workCenter = getWorkCenter(workCenterCode, organizeCode);
//            //根据设备编号来进行分组
//            Map<String, List<MesEpEquipmentCheck>> resultMap = mesEquipmentChecks.stream().filter(mesEquipmentCheck -> mesEquipmentCheck.getEquNo() != null && !StringUtils.isEmpty(mesEquipmentCheck.getEquNo())).collect(Collectors.groupingBy(MesEpEquipmentCheck::getEquNo));
//            for (String key: resultMap.keySet()){
//                MesOrderJob newOrderJob = new MesOrderJob();
//                newOrderJob.setTaskType(MesPcnExtEnumUtil.MES_OR_TASK_TYPE.PREPARE_TASK.getValue());
//                newOrderJob.setOrderType(MesPcnExtEnumUtil.MES_OR_ORDER_TYPE.EP_EQU_CHECK.getValue());
//                newOrderJob.setOrderNo(getOrderNo(organizeCode));
//                newOrderJob.setWorkCenterCode(workCenterCode);
//                newOrderJob.setOrderStatus(MesPcnExtEnumUtil.MES_ORJ_ORDER_STATUS.CREATE.getValue());
//                newOrderJob.setOrderDate(DateUtil.formatDate("yyyy-MM-dd", new Date()));
//                newOrderJob.setWorkTime(DateUtil.formatDate("yyyy-MM-dd", new Date()));
//                newOrderJob.setGenerateTime(DateUtil.formatDate("yyyy-MM-dd", new Date()));
//                newOrderJob.setOrganizeCode(organizeCode);
//                newOrderJob.setIsValid(MesPcnExtEnumUtil.IS_VAILD.VAILD.getValue());
//                newOrderJob.setIsDeleted(MesEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
//                newOrderJob.setCreateDatetime(DateUtil.formatDate());
//                newOrderJob.setModifyDatetime(DateUtil.formatDate());
//                newOrderJob.setCheckType(checkType);
//                newOrderJob.setHandlerMethod(MesPcnExtEnumUtil.HANDLER_METHOD.MANUALLY_CREATE.getValue());
//                newOrderJob.setShiftCode(workCenter.getShiftCode());
//
//                MesOrderJob job = mesOrderJobRepository.save(newOrderJob);
//
//                List<MesEpEquipmentCheck> epEquipmentChecks = resultMap.get(key);
//
//                for (MesEpEquipmentCheck mesEquipmentCheck : epEquipmentChecks) {
//                    MesEpEquipmentCheckDetail mesEquipmentCheckDetail = new MesEpEquipmentCheckDetail();
//                    mesEquipmentCheckDetail.setOrderJobNo(job.getOrderNo());
//                    BeanUtils.copyProperties(mesEquipmentCheck, mesEquipmentCheckDetail, MesPcnExtConstWords.ID);
//                    mesEquipmentCheckDetail.setCheckType(checkType);
//                    mesEquipmentCheckDetail.setEquNo(mesEquipmentCheck.getEquNo());
//                    mesEquipmentCheckDetail.setResultType(mesEquipmentCheck.getResultType());
//                    mesEquipmentCheckDetail.setEquName(mesEquipmentCheck.getEquName());
//                    mesEquipmentCheckDetail.setShiftCode(workCenter.getShiftCode());
//                    mesEquipmentCheckDetail.setStandardValue(mesEquipmentCheck.getStandardValue());
//                    mesEquipmentCheckDetail.setDownLimit(mesEquipmentCheck.getDownLimit());
//                    mesEquipmentCheckDetail.setUpLimit(mesEquipmentCheck.getUpLimit());
//                    mesEquipmentCheckDetail.setSystemSyncStatus(MesPcnExtEnumUtil.IF_SYNC_STATUS.NO_SYNC.getValue());
//                    equDetailRepository.save(mesEquipmentCheckDetail);
//                }
//            }
//        }
//
//
//    }
//
//    public List<MesEpEquipmentCheck> findEquByCenterCode(String organizeCode, String workCenterCode, String checkType) {
//        DdlPackBean ddlPackBean2 = DdlPackBean.getDdlPackBean(organizeCode);
//        DdlPreparedPack.getStringEqualPack(checkType, "checkType", ddlPackBean2);
//        DdlPreparedPack.getStringEqualPack(workCenterCode, "workCenterCode", ddlPackBean2);
//        return epEquipmentCheckRepository.findByHqlWhere(ddlPackBean2);
//
//    }
//
//    private String getOrderNo(String organizeCode) {
//        String orderNo = "";
//        BaseResultBean oneCodeResult = syncFuncService.syncSerialNo(new GenSerialNoModel(MesPcnExtConstWords.ORDER_NO_RULE), null, organizeCode, 1);
//        if (oneCodeResult != null && oneCodeResult.isSuccess()) {
//            orderNo = oneCodeResult.getResultList().get(0).toString();
//        } else {
//            throwImppException(CommonEnumUtil.SOFT_TYPE.MES_PCN.getCode(),ImppExceptionEnum.SYSTEM_EXCEPTION.getCode(),"生成唯一工单号失败");
//        }
//        return orderNo;
//    }
//
//
//    /**
//     * 异常
//     *
//     * @param softTypeCode          softTypeCode
//     * @param errorDetailString     错误消息字符串
//     * @param imppExceptionEnumCode 异常代码
//     * @param args                  参数
//     */
//    private void throwImppException(String softTypeCode, String errorDetailString, String imppExceptionEnumCode, Object... args) {
//        throw ImppExceptionBuilder.newInstance()
//                .setSystemID(softTypeCode)
//                .setErrorCode(imppExceptionEnumCode)
//                .setErrorDetail(errorDetailString, args)
//                .build();
//    }
//}
