package com.sw.mes.yb.production.service.impl;

import com.sw.mes.core.base.BaseServiceImpl;
import com.sw.mes.yb.production.dao.ProductionAbnormalDao;
import com.sw.mes.yb.production.entity.ProductionAbnormal;
import com.sw.mes.yb.production.service.ProductionAbnormalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;


/**
 * @author lf
 * @description
 * @date 2024/1/12 11:06
 */
@Service
@Transactional
public class ProductionAbnormalServiceImpl extends BaseServiceImpl<ProductionAbnormal> implements ProductionAbnormalService {

    ProductionAbnormalDao dao;

    @Autowired
    public void setDao(ProductionAbnormalDao dao) {
        super.setBaseDao(dao);
        this.dao = dao;
    }

    @Override
    public void save(ProductionAbnormal productionAbnormal) {
        Assert.notNull(productionAbnormal, "生产异常对象不能为空");
        Assert.notNull(productionAbnormal.getEquipmentCode(), "设备号不能为空");
        super.saveOrUpdate(productionAbnormal);
    }
}
