package com.prolog.eis.service.feign.impl;

import com.prolog.eis.feign.DismantleFeign;
import com.prolog.eis.model.inbound.BizInboundTask;
import com.prolog.eis.service.feign.DismantleFeignService;
import com.prolog.framework.common.message.RestMessage;
import com.prolog.framework.core.exception.PrologException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @desc:
 * @author: zhangJie
 * @date: 2023/9/18 12:18
 */

@Service
@RequiredArgsConstructor
@Slf4j
public class DismantleFeignServiceImpl implements DismantleFeignService {

    private final DismantleFeign dismantleFeign;

    @Override
    public boolean callShelves(BizInboundTask inboundTask) throws Exception {
        RestMessage restMessage = dismantleFeign.callShelves(inboundTask);
        if (!restMessage.isSuccess()) {
            log.error("拆零上架调用失败：" + restMessage.getMessage());
            throw new PrologException(String.format("拆零上架调用失败:" + restMessage.getMessage()));
        }
        return true;
    }
}
