package cn.estsh.i3plus.ext.mes.apiservice.controller.busi.ep;

import cn.estsh.i3plus.ext.mes.api.busi.ep.IEpWorkCenterRunningStateService;
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.impp.framework.boot.util.ResultBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 产线运行状态看板
 *
 * @author yumingxing
 * @version 1.0
 * @date 2021/6/8 14:18
 **/
@Api(tags = "看板")
@RestController
@RequestMapping(CommonConstWords.BASE_URL_MES + "/sx/border")
public class SxEpWorkCenterRunningStatusController {

    @Autowired
    private IEpWorkCenterRunningStateService workCenterRunningStateService;


    @GetMapping(value = "/work-center-state/query")
    @ApiOperation(value = "产线状态")
    public ResultBean getAllWorkCenterState(String organizeCode) {
        try {
            return ResultBean.success("查询成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode())
                    .setResultObject(workCenterRunningStateService.getWorkCenterState(organizeCode));
        } catch (ImppBusiException busExcep) {
            return ResultBean.fail(busExcep);
        } catch (Exception e) {
            return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
        }
    }

}
