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

import com.alibaba.fastjson.JSON;
import com.prolog.cs.biz.inbound.model.SupervisionCode;
import com.prolog.cs.biz.outbound.Application;
import com.prolog.cs.biz.outbound.dao.WaveBillMapper;
import com.prolog.cs.biz.outbound.resource.ItemClient;
import lombok.extern.slf4j.Slf4j;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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;


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

    @Autowired
    WebApplicationContext webApplicationContext;
    @Autowired
    PickTaskAppServiceImpl PickTaskAppServiceImpl;
    @Autowired
    WorkStageServiceImpl WorkStageServiceImpl;
    @Autowired
    MoveTaskServiceImpl MoveTaskServiceImpl;
    @Autowired
    com.prolog.cs.biz.outbound.service.impl.WavesServiceImpl WavesServiceImpl;

    protected MockMvc mockMvc;

    @Autowired
    private WaveBillMapper billMapper;

    @Autowired
    private ItemClient itemClient;

    @Autowired
    private com.prolog.cs.biz.outbound.controller.SupervisionCodeController SupervisionCodeController;

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

    @Before
    public void initDatabase(){
    }

    private static Logger logger = LoggerFactory.getLogger(IsSupervisedOutTest.class);
    
    @Test
    public void addMoveTask() throws Exception {
        String s="[{\"refBillId\":\"699363680541872128\",\"refBillLineId\":\"701499766890172416\",\"warehouseId\":\"599581702716788736\",\"billType\":\"1\",\"itemId\":\"0021264341\",\"consignorId\":\"E23A4BUUPPW\",\"shipperId\":\"C2PB2H4Z77S\",\"minSu\":\"1\",\"middleSu\":\"1\",\"maxSu\":\"80\",\"isSupervise\":1,\"itemCode\":\"YHXYYY0357\",\"itemName\":\"葡萄糖注射液\",\"itemSpecs\":\"20ml:10g*5支\",\"conversionRate\":60,\"uom\":\"盒\",\"manufacturerLotNum\":\"B2111040\",\"batchNum\":null,\"warehouseAreaCode\":null,\"locatorCode\":\"1ZJ07-03\",\"manufacturer\":\"湖北科伦药业有限公司\",\"qty\":2100,\"uomQty\":35,\"oddPieceQty\":0,\"lclNo\":null,\"shipperName\":null,\"expiredDate\":\"2023-10-25 00:00:00\",\"productionDate\":\"2021-11-04 00:00:00\",\"outerAskDate\":\"2022-03-18 15:55:54\",\"srcCode\":\"_cusId8402.89433161726\",\"pickUomQty\":35,\"pickOddPieceQty\":0,\"pickQty\":2100,\"pickerName\":\"昆中药WMS管理员\",\"barcode\":\"699363680541872128\",\"barcodeDId\":\"701499766890172416\",\"consignorName\":\"曲靖市康桥医药有限责任公司\",\"consignorCode\":null,\"itemHealthIsDouble\":0,\"itemHealthApprovalNbr\":\"国药准字H42021188\",\"isCaseOrPiece\":1,\"itemHealthSuperviseflag\":1,\"isBacteria\":0,\"isDelegate\":0,\"isHosted\":0,\"itemHealthCategoryCode\":\"001\",\"manufacturerName\":\"湖北科伦药业有限公司\",\"itemHealthListedLicensor\":\"湖北科伦药业有限公司\",\"itemHealthProduceLicense\":null,\"itemHealthRegisterNbr\":\"2020R001679\",\"itemHealthRecordNbr\":null,\"volume\":35937,\"weight\":0,\"_row_count\":1}]";
        s="[{\"uomQty\":1,\"oddPieceQty\":0,\"qty\":60,\"pickQty\":60,\"pickTaskId\":\"701123996120961024\",\"pickOrderId\":\"701125104381333504\",\"containerCode\":\"61\",\"itemId\":\"0021264341\",\"manufacturerLotNum\":\"B2111040\",\"locatorCode\":\"1ZJ07-03\",\"warehouseId\":\"599581702716788736\",\"bldgId\":\"599581810778836992\",\"redReason\":\"\"}]";

        System.out.println(JSON.toJSONString(SupervisionCodeController.isSupervisedOut(JSON.parseArray(s, SupervisionCode.class))));
    }

}
