package cn.estsh.i3plus.ext.mes.apiservice.controller.base.bu3;

import cn.estsh.i3plus.ext.mes.api.busi.bu3.ISxUnbindProduceSnService;
import cn.estsh.i3plus.ext.mes.pojo.bean.MesUnbindProduceSnTravel;
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
import cn.estsh.i3plus.pojo.base.common.Pager;
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;

/**
 * @PROJECT_NAME: i3plus-mes-panasonic-dev
 * @DESCRIPTION:
 * @USER: xinwang.yi
 * @DATE: 2023-08-04 10:07
 */
@RestController
@RequestMapping(CommonConstWords.BASE_URL_MES + "/ext/unbind-produce-sn")
@Api(tags = "Bu条码解绑")
public class SxBuUnbindProduceSnController {

    @Autowired
    private ISxUnbindProduceSnService unbindProduceSnService;

    @GetMapping(value = "/travel/query-pager")
    @ApiOperation(value = "按条件分页查询解绑条码履历信息")
    public ResultBean queryProduceSnExtByPager(MesUnbindProduceSnTravel unbindProduceSnTravel, Pager pager) {
        try {
            return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode())
                    .setListPager(unbindProduceSnService.queryUnbindProduceSnTravelByPager(unbindProduceSnTravel, pager));
        } catch (ImppBusiException busExcep) {
            return ResultBean.fail(busExcep);
        } catch (Exception e) {
            return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
        }
    }
}
