package com.sw.mes.yb.mcs.event;

import com.sw.mes.yb.fls.service.MesToFlsService;
import com.sw.mes.yb.fls.utils.FlsResultDto;
import com.sw.mes.yb.mcs.service.YbMesToMcsService;
import com.sw.mes.yb.plan.dto.PlanWaterLineManageToWmsDto;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.event.SmartApplicationListener;
import org.springframework.stereotype.Component;


/**
 * @author zhaoyayun
 * 订单水位信息下发事件监听
 **/
@Log4j2
@Component
public class PlanWaterLineManageToWmsEventListener implements SmartApplicationListener {
    @Autowired
    YbMesToMcsService mesToMcsService;
    @Autowired
    MesToFlsService mesToFlsService;
    @Override
    public boolean supportsEventType(Class<? extends ApplicationEvent> eventType) {
        return eventType == PlanWaterLineManageToWmsEvent.class;
    }
    @Override
    public boolean supportsSourceType(Class<?> sourceType) {
        return true;
    }
    @Override
    public int getOrder() {
        return 0;
    }
    @Override
    public void onApplicationEvent(ApplicationEvent applicationEvent) {
        PlanWaterLineManageToWmsEvent planWaterLineManageToWmsEvent=(PlanWaterLineManageToWmsEvent) applicationEvent;
        PlanWaterLineManageToWmsDto planWaterLineManageToWmsDto = planWaterLineManageToWmsEvent.getPlanWaterLineManageToWmsDto();
       // mesToMcsService.planWaterLineManageToWmsDto(planWaterLineManageToWmsDto);
         mesToFlsService.planWaterLineManageToWmsDto(planWaterLineManageToWmsDto);

    }
}
