package com.weaver.seconddev.interfaces.srmoa;

import com.weaver.seconddev.interfaces.prop.ConfigProp;
import org.apache.axis2.AxisFault;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.rmi.RemoteException;
import java.security.MessageDigest;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Set;
import com.weaver.common.i18n.tool.util.I18nContextUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import java.lang.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.weaver.verupgrade.general.Util;
import com.weaver.verupgrade.general.BaseBean;
import org.springframework.stereotype.Component;

@Component
public class CallSrmCheckPriceServices extends BaseBean {

	private static final org.slf4j.Logger logger_dac3f14b = LoggerFactory.getLogger(CallSrmCheckPriceServices.class);

	private RfqCheckPriceHandlerServiceServiceStub.CheckPriceResultIn resultin = null;

	public void setOainput(RfqCheckPriceHandlerServiceServiceStub.CheckPriceResultIn oasrm) {
		this.resultin = oasrm;
	}
	@Autowired
	private ConfigProp configProp;
	public String[] call() throws RemoteException {
		logger_dac3f14b.error(String.valueOf("调用接口------------------------开始"));
		RfqCheckPriceHandlerServiceServiceStub stub = null;
		String wsdlLocation = "";
		// wsdlLocation = "http://10.6.6.151:8088/srm/services/OaSrmCheckPriceService?wsdl";
//		wsdlLocation = Util.null2String(I18nContextUtilcus.getBean(Environment.class).getProperty("htsrmoasync.bjdsp")).trim();
		wsdlLocation = configProp.getBjdsp();

		stub = new RfqCheckPriceHandlerServiceServiceStub(wsdlLocation);
		stub._getServiceClient().getOptions().setProperty("__CHUNKED__", Boolean.FALSE);
		// 设置传入参数
		RfqCheckPriceHandlerServiceServiceStub.SRM_OA_CHECK_PRICE_RESULTE createRequest = new RfqCheckPriceHandlerServiceServiceStub.SRM_OA_CHECK_PRICE_RESULTE();
		RfqCheckPriceHandlerServiceServiceStub.SRM_OA_CHECK_PRICE_RESULT oasrmresult = new RfqCheckPriceHandlerServiceServiceStub.SRM_OA_CHECK_PRICE_RESULT();
		oasrmresult.setInputTab(resultin);
		createRequest.setSRM_OA_CHECK_PRICE_RESULT(oasrmresult);
		RfqCheckPriceHandlerServiceServiceStub.SRM_OA_CHECK_PRICE_RESULTResponseE resp = null;
		resp = stub.sRM_OA_CHECK_PRICE_RESULT(createRequest);
		logger_dac3f14b.error(String.valueOf("调用接口------------------------完成"));
		RfqCheckPriceHandlerServiceServiceStub.CheckPriceResulOut resultout = resp.getSRM_OA_CHECK_PRICE_RESULTResponse().getOutputTab();
		// 封装返回
		String[] rtInfo = new String[3];
		rtInfo[0] = resultout.getEnquiryNo();
		rtInfo[1] = resultout.getIstat();
		rtInfo[2] = resultout.getSrmsage();
		return rtInfo;
	}
}
