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

import com.alibaba.fastjson.JSON;
import com.netflix.hystrix.strategy.concurrency.HystrixRequestContext;
import com.prolog.cs.biz.inbound.model.SupervisionCode;
import com.prolog.framework.authority.util.HystrixVarUtil;
import org.junit.After;
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.data.redis.core.RedisTemplate;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

@RunWith(SpringRunner.class)
@SpringBootTest
@WebAppConfiguration 
public class SupervisionCodeServiceImplTest { 

    @Autowired
    private SupervisionCodeServiceImpl SupervisionCodeServiceImpl;

    @Autowired
    private RedisTemplate redisTemplate;

    @Before
    public void before() throws Exception { 
        HystrixRequestContext context = HystrixRequestContext.initializeContext();
        HystrixVarUtil.setUserKey("kzywms-admin");
    } 
    
    @After
    public void after() throws Exception { 
    } 

    @Test//System.out.println(JSON.toJSONString(SupervisionCodeServiceImpl.addSupervisionCode()));
    public void testAddSupervisionCode() throws Exception {
        String s="{\"supervisionCode\":\"81526210242119776022\",\"warehouseId\":\"599581702716788736\",\"billType\":\"1\",\"itemId\":\"0021266968\",\"consignorId\":\"E23A4BUUPPW\",\"shipperId\":null,\"minSu\":\"1\",\"middleSu\":\"1\",\"maxSu\":\"300\",\"isSupervise\":1,\"noSuperviseReason\":null,\"taskRqcId\":\"705848952389505024\",\"mtlOwnerId\":\"E23A4BUUPPW\",\"srcBillType\":null,\"srcHeaderId\":null,\"srcLineId\":null,\"asnHeaderId\":\"JGM100002\",\"asnLineId\":\"JGM100002\",\"rcvHeaderId\":\"705848950900527104\",\"rcvLineId\":\"705848952066543616\",\"qty\":\"0.01\",\"uom\":\"盒\",\"conversionRate\":300,\"pieceQty\":\"3\",\"batchId\":\"647850900894912516\",\"batchNum\":\"647850900894912517\",\"vendorBatchNum\":null,\"activeFlag\":\"1\",\"remainQty\":null,\"comments\":null,\"result\":\"0\",\"reason\":null,\"manufacturerLotNum\":\"2107261\",\"executor\":null,\"containerCode\":\"N/A\",\"goodsCaseCode\":\"N/A\",\"status\":\"1\",\"times\":0,\"rcvLinesProfilesDTO\":null,\"rcvLinesDTO\":null,\"dataVersion\":0,\"oddPieceQty\":3,\"caseQty\":0,\"oddCaseQty\":0,\"itemBarcode\":null,\"itemVolume\":0,\"itemWeight\":0,\"itemHealthTwovoflag\":null,\"warehouseName\":\"曲靖仓\",\"itemNum\":\"YCYXN0942\",\"itemName\":\"非洛地平缓释片\",\"categoryName\":\"普通药品\",\"qcResult2\":null,\"qcReason2\":null,\"qcOpcode2\":null,\"qcDate2\":null,\"enterpriseId\":\"106\",\"gmtCreate\":\"\",\"creator\":\"599299328393220096\",\"creatorName\":\"kzywms-admin\",\"gmtModified\":\"\",\"modifier\":\"599299328393220096\",\"modifierName\":\"kzywms-admin\",\"isLock\":0,\"spilterName\":null,\"isSpilt\":null,\"batchProductionDate\":\"2021-07-26\",\"batchExpiredDate\":\"2023-07-16\",\"categoryId\":\"001\",\"warehouseCode\":\"C002\",\"vendorId\":null,\"orgId\":\"K23LYW6FBF0\",\"erpBatchNum\":null,\"productionPlace\":\"莱阳市经济开发区隆茂街中段\",\"piecePriceTi\":0.52,\"piecePriceTe\":1,\"taxRate\":192.3,\"warehouseAreaCodes\":null,\"itemIsPieceOrCase\":\"1\",\"warehouseAreaCategorys\":null,\"rcvType\":\"1\",\"specification\":\"5mg*10片*2板\",\"itemHealthListedLicensor\":\"莱阳市江波制药有限责任公司\",\"itemHealthProduceLicense\":null,\"itemIsImported\":0,\"itemIsRecheck\":0,\"isInstrument\":0,\"itemHealthCommonName\":\"*\",\"itemIsLock\":0,\"isHosted\":0,\"manufacturerId\":null,\"manufacturerCode\":null,\"manufacturerName\":\"莱阳市江波制药有限责任公司\",\"inStoreDay\":null,\"shelfLifeDays\":720,\"shelfLifeUnit\":\"日\",\"itemIsSpecial\":0,\"isBacteria\":0,\"returnInfo\":null,\"returnColdQuality\":null,\"returnExplain\":null,\"isRechecked\":0,\"isSpotCheck\":null,\"warehouseAreaName\":null,\"warehouseAreaId\":null,\"warehouseAreaCode\":null,\"bldgId\":null,\"bldgName\":\"曲靖康桥仓\",\"bldgCode\":\"001\",\"delegationPartyId\":null,\"delegationPartyName\":\"云南楚雄天利药业有限公司\",\"isDelegate\":1,\"showProductionDate\":\"20210726\",\"showExpiredDate\":\"20230716\",\"pieceConversionRate\":300,\"warehouseRoomCodes\":null,\"asnLineRemark\":null,\"itemZjm\":\"SLFSNLDKYZSY\",\"refLineId\":\"705848952066543616\",\"refType\":0,\"handlingSuggestion\":null,\"storeTemperature\":\"YLZG\",\"palletStdQuantity\":null,\"shouldScanQty\":null,\"reCheckResult\":\"N/A\",\"itemHealthIsDouble\":0,\"isRetrospect\":1,\"rcvReason1\":null,\"rcvReason2\":null,\"rcvReason3\":null,\"rcvRtReason\":null,\"itemHealthStoreCategory\":\"整散分开\",\"itemHealthRegisterNbr\":\"2020R002325\",\"approvalNumber\":\"国药准字H20103190\",\"manufacturerRegisterNo\":\"N/A\",\"handlingReason\":null,\"defReasonExt\":null,\"defReason\":null,\"handlingMeasure\":null,\"stockStatus\":\"0\",\"sourceType\":\"收货\",\"preNodeLineId\":null,\"rqcReportNo\":\"20211019026\",\"allowDecimal\":\"-\",\"itemCondition\":null,\"whLocatorId\":null,\"whLocatorCode\":null,\"whAreaCode\":null,\"whAreaCategoryCode\":\"\",\"hostLocatorId\":null,\"_row_count\":1,\"qcOpcode1\":\"昆中药WMS管理员\",\"qcOddCaseActQty\":0,\"qcOddPieceActQty\":3,\"oldPieceQty\":3,\"qcResult1\":\"0\",\"rqcReportNoNew\":\"20211019026\",\"rqcTemperature\":null,\"returnType\":null,\"whAreaCategory\":null,\"operation\":null,\"mtlOwnerName\":null,\"srcAutoBillNum\":null,\"srcBillTyp\":null,\"shipperZjm\":null,\"itemBarCode\":null,\"needDept\":null,\"rcvUser\":null,\"lineRemark\":null,\"refBillId\":\"705848950900527104\",\"refBillLineId\":\"705848952066543616\",\"packLevel\":\"2\",\"businessType\":0,\"packSize\":\"1\",\"stage\":0}";
        SupervisionCode dto=JSON.parseObject(s,SupervisionCode.class);
        System.out.println(JSON.toJSONString(SupervisionCodeServiceImpl.addSupervisionCode(dto)));
    } 
    @Test//System.out.println(JSON.toJSONString(SupervisionCodeServiceImpl.addSupervisionCodeAppendList()));
    public void testAddSupervisionCodeAppendList() throws Exception {
        Set<String> keys = redisTemplate.keys("scanCode_" + "*");
        redisTemplate.delete(keys);
    }
    @Test//System.out.println(JSON.toJSONString(SupervisionCodeServiceImpl.addSupervisionCodeCoreAppend()));
    public void testAddSupervisionCodeCoreAppend() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(SupervisionCodeServiceImpl.addSupervisionCodeCore()));
    public void testAddSupervisionCodeCore() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(SupervisionCodeServiceImpl.itemsByBill()));
    public void testItemsByBill() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(SupervisionCodeServiceImpl.isSupervised()));
    public void testIsSupervised() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(SupervisionCodeServiceImpl.isSupervise()));
    public void testIsSupervise() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(SupervisionCodeServiceImpl.page()));
    public void testPage() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(SupervisionCodeServiceImpl.findCargoChangeList()));
    public void testFindCargoChangeList() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(SupervisionCodeServiceImpl.findCargoChangeDetail()));
    public void testFindCargoChangeDetail() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(SupervisionCodeServiceImpl.addSupervisionCodeCargoChange()));
    public void testAddSupervisionCodeCargoChange() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(SupervisionCodeServiceImpl.querySupervisionCodedList()));
    public void testQuerySupervisionCodedList() throws Exception { 
        
    } 
        
} 
