package com.fuzamei.web;

import java.util.Map;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.fastjson.JSON;
import com.fuzamei.baseTest.BaseJunit4Test;
import com.fuzamei.constant.Role;
import com.fuzamei.entity.Params;
import com.fuzamei.entity.UserDetail;
import com.fuzamei.service.UserAuthoricationService;

public class OrdersIssueActionTest extends BaseJunit4Test{
	
	@Autowired
	private UserAuthoricationService userAuthoricationService;
	
	@Autowired
	private OrdersIssueAction ordersIssueAction;
	
	@Test//测试添加订单功能
	public void test01(){
		Params Params=new Params();
		Params.setUserId(9001);
		Params.setOrderId(100000004);
		Params.setSupplierId(9003);
		Params.setPartNo("partNo1");
		Params.setBoxNo("FCIU4615791");
		Params.setInboxQty(20);
		Map<String, Object> result = ordersIssueAction.addOrder(Params);
		String jsonString = JSON.toJSONString(result,true);
		System.out.println(jsonString);
	}
	
	@Test//测试【计划员】查看订单功能
	public void test02(){
		Params Params=new Params();
		Params.setUserId(9001);
		Params.setPage(-1);
//		Params.setSupplierName("chb供应商");
		Params.setBoxNo(null);
		Params.setStartTime(null);
		Params.setEndTime(null);
		Map<String, Object> result = ordersIssueAction.queryOrdersByPlanner(Params);
		String jsonString = JSON.toJSONString(result,true);
		System.out.println(jsonString);
	}
	
	@Test//测试【供应商】查看订单功能
	public void test03(){
		Params Params=new Params();
		Params.setUserId(9003);
		Params.setPage(-1);
		Params.setOrderId(null);
		Params.setBoxNo(null);
		Params.setStatusId(null);
		Params.setStartTime(null);
		Params.setEndTime(null);
		Map<String, Object> result = ordersIssueAction.queryOrdersBySupplier(Params);
		String jsonString = JSON.toJSONString(result,true);
		System.out.println(jsonString);
	}
	
	@Test//测试显示计划员下的所有供应商
	public void test04(){
		Params Params=new Params();
		Params.setUserId(9001);
		Map<String, Object> result = ordersIssueAction.showSuppliersUnderPlanner();
		String jsonString = JSON.toJSONString(result,true);
		System.out.println(jsonString);
	}
	
	@Test//测试显示所有零件号
	public void test05(){
		Params Params=new Params();
		Params.setUserId(9001);
		Map<String, Object> result = ordersIssueAction.showAllPartNo();
		String jsonString = JSON.toJSONString(result,true);
		System.out.println(jsonString);
	}
	
	@Test//测试订单跟踪信息
	public void test06(){
		Params Params=new Params();
		Params.setUserId(9001);
		Params.setOrderId(100000002);
		Map<String, Object> result = ordersIssueAction.orderTracking(Params);
		String jsonString = JSON.toJSONString(result,true);
		System.out.println(jsonString);
	}
	
	@Test//测试订单发货
	public void test07(){
		Params Params=new Params();
		Params.setUserId(9003);
		Params.setOrderId(100000004);
		Params.setCarrierId(9007);
		Map<String, Object> result = ordersIssueAction.consignment(Params);
		String jsonString = JSON.toJSONString(result,true);
		System.out.println(jsonString);
	}
	
	/*@Test//测试正则
	public void test08(){
		System.out.println(OrdersIssueAction.ORDER_ID_PATTERN);
		System.out.println("12345678".matches(OrdersIssueAction.ORDER_ID_PATTERN));
		System.out.println(CargoConsignAction.CARNO_PATTERN);
		System.out.println("浙A9819Y".matches(CargoConsignAction.CARNO_PATTERN));
	}*/
	
}
