package com.prolog.cs.biz.outbound.service.impl;

import com.alibaba.fastjson.JSON;
import com.prolog.cs.biz.outbound.Application;
import com.prolog.cs.biz.outbound.dao.WaveBillMapper;
import com.prolog.cs.biz.outbound.resource.EisAgvResource;
import com.prolog.cs.biz.outbound.resource.OperateResource;
import com.prolog.framework.common.message.RestMessage;
import com.prolog.framework.core.exception.BizException;
import com.prolog.upcloud.base.wh.operate.vo.ReplenishCancelVO;
import lombok.extern.slf4j.Slf4j;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;

import java.math.BigDecimal;


/**
 * 基础测试类
 *
 * @author stylefeng
 * @Date 2017/5/21 16:10
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
@WebAppConfiguration
@Slf4j
//@Transactional //打开的话测试之后数据可自动回滚
public class EisAgvResourceTest {

    @Autowired
    WebApplicationContext webApplicationContext;
    
    @Autowired
    EisAgvResource EisAgvResource;
    

    protected MockMvc mockMvc;

    @Autowired
    private WaveBillMapper billMapper;
    
    @Before
    public void setupMockMvc(){
        mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
    }

    @Before
    public void initDatabase(){
    }

    
    @Test
    public void containerOffShelf() throws Exception {
        RestMessage restMessage1 = EisAgvResource.containerOffShelf("80");
        System.out.println(JSON.toJSONString(restMessage1));
        if (!restMessage1.isSuccess()) {
            throw new BizException("调用库内补货取消接口出错: " + restMessage1.getMessage());
        }
    }

    public static void main(String[] args) {
//        List list= Arrays.asList(new Integer[]{1,2,3,4});
//        list.forEach(x -> {
//            if((Integer) x==2){
//                return;
//            }
//            System.out.println(x);
//        });

        System.out.println(new BigDecimal(51).divide(new BigDecimal(10),0,BigDecimal.ROUND_UP));
    }
}
