package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;

import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesPartPullService;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.base.util.StringUtil;
import cn.estsh.i3plus.pojo.mes.bean.MesPartPull;
import cn.estsh.i3plus.pojo.mes.repository.*;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
@Slf4j
public class MesPartPullService implements IMesPartPullService {
    public static final Logger LOGGER = LoggerFactory.getLogger(MesPartPullService.class);

    @Autowired
    private MesPartPullRepository mesPartPullRDao;
    @Autowired
    private MesPartPullDetailRepository mesPartPullDetailRDao;
    @Autowired
    private MesWorkOrderPartRepository workOrderPartRepository;
    @Autowired
    private MesWorkCenterRepository mesWorkCenterRepository;

    @Override
    public List<MesPartPull> queryMesPartPull(MesPartPull bean) {
        DdlPackBean packBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
        DdlPreparedPack.getStringEqualPack(bean.getWorkCenterCode(), "workCenterCode", packBean);
        DdlPreparedPack.getStringEqualPack(bean.getPullCode(), "pullCode", packBean);

        packBean.setOrderByStr(bean.orderBy());

        return mesPartPullRDao.findByHqlWhere(packBean);

    }
}
