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

import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesEmergencyLocationLogService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.pojo.mes.bean.MesEmergencyLocation;
import cn.estsh.i3plus.pojo.mes.bean.MesEmergencyLocationLog;
import cn.estsh.i3plus.pojo.mes.repository.MesEmergencyLocationLogRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.UUID;

/**
 * @Description : 应急件库位管理记录
 * @Reference :
 * @Author : junsheng.li
 * @CreateDate 2024/10/17 16:23
 * @Modify:
 **/
@Slf4j
@Service
public class MesEmergencyLocationLogServiceImpl implements IMesEmergencyLocationLogService {

    @Autowired
    private MesEmergencyLocationLogRepository mesEmergencyLocationLogRepository;

    @Override
    public void insertMesEmergencyLocationLog(MesEmergencyLocation location) {
        MesEmergencyLocationLog log = new MesEmergencyLocationLog();
        BeanUtils.copyProperties(location,log, MesPcnExtConstWords.BASE_BEAN_FIELDS);
        log.setFid(UUID.randomUUID().toString());
        ConvertBean.serviceModelInitialize(log,location.getModifyUser());
        mesEmergencyLocationLogRepository.insert(log);
    }
}
