package cn.net.test;

import java.io.IOException;
import java.net.BindException;
import java.net.ConnectException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;

import cn.net.cpzslibs.prot.Prot02Logout;
import cn.net.cpzslibs.prot.Prot10046Label;
import cn.net.cpzslibs.prot.SocketCreate;
import cn.net.cpzslibs.prot.bean.req.Prot10001LoginBean;
import cn.net.cpzslibs.prot.bean.req.Prot10046LabelBean;

public class CheckNewPortProductTest {
	public static void main(String[] args) {
		String ip = "218.245.0.109";//218.245.0.109    192.168.0.46
		int port = 8898;
		SocketCreate create = new SocketCreate(ip, port,"863985026541738");//863985026541738
		try {
			create.createLoginCpzsCheck(358000020);
			System.err.println("---" + create.getErrMsg() +"   " + create.isResult());
			/*Prot10001Login login = new Prot10001Login();
			create.createLoginCpzsCheck(login,getTestLoginBean());*/
			Prot10046Label label = new Prot10046Label();
			label.dealLabelList(create, getTestLabelBean());
			System.err.println("  label:" + label.getLabelResult().toString());
//			Prot10001Login login = new Prot10001Login();
//			create.createLoginCpzsCheck(login,getTestLoginBean());
			//获取窜货信息
			/*Prot11DownConflictInfo conflictInfo = new Prot11DownConflictInfo();
			conflictInfo.dealDownConflictInfo(create, 1);*/
//			conflictInfo.dealAllConflictInfo(create, 10000);
			
		} catch (BindException e) {
			System.err.println("BindException:" + e.getLocalizedMessage());
			e.printStackTrace();
		} catch (ConnectException e) {
			System.err.println("ConnectException:" + e.getLocalizedMessage());
			e.printStackTrace();
		} catch (SocketTimeoutException e) {
			System.err.println("SocketTimeoutException:" + e.getLocalizedMessage());
			e.printStackTrace();
		} catch (UnknownHostException e) {
			System.err.println("UnknownHostException:" + e.getLocalizedMessage());
			e.printStackTrace();
		} catch (IOException e) {
			System.err.println("IOException:" + e.getLocalizedMessage());
			e.printStackTrace();
		}finally {
			new Prot02Logout().dealLogout(create);
		}
		
		//{"errcode":65494,"errmsg":"","result":1}
		
		
	}
	
	private static Prot10046LabelBean getTestLabelBean() {
		Prot10046LabelBean labelBean = new Prot10046LabelBean();
//		labelBean.setProduct_id("100001");
//		labelBean.setDate_start("2016-06-20");
//		labelBean.setDate_end("2014-06-20");
		return labelBean;
	}

	private static Prot10001LoginBean getTestLoginBean() {
		Prot10001LoginBean bean = new Prot10001LoginBean();
		bean.setCompanyID("358000020");//358000020
		bean.setMobile("15011350272");
		bean.setMobile_pwd("0272");
//		bean.setInspectorID("863985026541738");
		bean.setUserType(1);
		return bean;
	}

}
