package com.sw.mes.wms.service.impl;

import com.sw.mes.core.annotation.ServiceLogs;
import com.sw.mes.wms.dto.FbRatingResultDto;
import com.sw.mes.wms.dto.SendFinshOrderDto;
import com.sw.mes.wms.service.RatingResultService;
import com.sw.mes.wms.utils.RequestWmsDto;
import com.sw.mes.wms.utils.RequestWmsUtils;
import com.sw.mes.wms.utils.ResultWmsDto;
import lombok.extern.slf4j.Slf4j;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: GaoXinJian
 * @Date: 2022-03-08 16:28
 */
@Slf4j
@Service
public class RatingResultServiceImpl implements RatingResultService {
    @Autowired
    ModelMapper modelMapper;
    @Autowired
    private RequestWmsUtils requestUtilsWms;

    private final String finshOrder="/closeOrder";
    private final String ratingResultUrl="/ratingResult";

    @Override
    @ServiceLogs(description = "方棒评级结果下发wms")
    public ResultWmsDto ratingResult(FbRatingResultDto ratingResultDto) {
        ResultWmsDto resultWmsDto = requestUtilsWms.postForWms(new RequestWmsDto(ratingResultUrl, ratingResultDto));
        return resultWmsDto;
    }
    @Override
    @ServiceLogs(description = "关闭订单下发wms")
    public ResultWmsDto sendFinshOrder(SendFinshOrderDto sendFinshOrderDto) {
        return requestUtilsWms.postForWms(new RequestWmsDto(finshOrder,sendFinshOrderDto));
    }

}
