package nc.bs.pu.wgpt.process;

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.util.Set;

import nc.bcmanage.bs.IBusiCenterManageService;
import nc.bs.dao.BaseDAO;
import nc.bs.framework.common.InvocationInfoProxy;
import nc.bs.framework.common.NCLocator;
import nc.bs.framework.comn.NetStreamContext;
import nc.bs.framework.server.ISecurityTokenCallback;
import nc.bs.pu.wgpt.bp.WuYeWgpt;
import nc.bs.pu.wgpt.bp.WuYeWgptBP;
import nc.bs.uap.tools.formula.ExtFormulaParser;
import nc.impl.pubapp.pattern.data.bill.BillQuery;
import nc.impl.pubapp.pattern.data.vo.VOQuery;
import nc.itf.pu.m21.IOrderQuery;
import nc.itf.wgpt.process.IWuYeWgptBusiService;
import nc.jdbc.framework.SQLParameter;
import nc.jdbc.framework.processor.BeanListProcessor;
import nc.jdbc.framework.processor.ColumnListProcessor;
import nc.jdbc.framework.processor.ColumnProcessor;
import nc.jdbc.framework.processor.MapProcessor;
import nc.net.servlet.IReturnStatus;
import nc.net.servlet.SapToNcEsbJsonServlet;
import nc.pub.sap.constant.SapConstants;
import nc.pubitf.org.ICloseAccQryPubServicer;
import nc.pubitf.para.SysInitQuery;
import nc.util.uap.wgpt.WuYeWgptUtil;
import nc.vo.cache.CacheManager;
import nc.vo.cache.ICache;
import nc.vo.cache.config.CacheConfig;
import nc.vo.esb.ResultEsbVO;
import nc.vo.esb.ResultVO;
import nc.vo.ia.pub.util.IAScaleUtil;
import nc.vo.ic.m45.entity.PurchaseInBodyVO;
import nc.vo.ic.m45.entity.PurchaseInHeadVO;
import nc.vo.ic.m45.entity.PurchaseInVO;
import nc.vo.ic.m4d.entity.MaterialOutBodyVO;
import nc.vo.ic.m4d.entity.MaterialOutVO;
import nc.vo.pf.pub.BusitypeVO;
import nc.vo.pu.m21.entity.OrderItemVO;
import nc.vo.pu.m21.entity.OrderVO;
import nc.vo.pub.AggregatedValueObject;
import nc.vo.pub.BusinessException;
import nc.vo.pub.CircularlyAccessibleValueObject;
import nc.vo.pub.VOStatus;
import nc.vo.pub.lang.UFBoolean;
import nc.vo.pub.lang.UFDate;
import nc.vo.pub.lang.UFDouble;
import nc.vo.pubapp.AppContext;
import nc.vo.pubapp.pattern.data.ValueUtils;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
import nc.vo.pubapp.pattern.pub.MathTool;
import nc.vo.tmpub.util.DateUtil;
import nc.vo.tmpub.util.MathUtil;
import nc.vo.tmpub.util.SqlUtil;
import nc.vo.wgpt.log.WuYeWgptLogVO;
import ncc.bs.wy.tools.WyWGPTJsonTools;
import ncc.pub.wywgpt.utils.WyWGPTUtils;
import nccloud.commons.lang.ArrayUtils;
import uap.json.JSONArray;
import uap.json.JSONObject;
/**
 * 二开新加的类，物业网购平台协同采购入库单/退库
 * @author 符耀铭
 * @time 2019年7月15日
 */
public class WritePurchaseinInfoProcessForNC extends SapToNcEsbJsonServlet{

	@SuppressWarnings("restriction")
	@Override
	public void execFunction(HttpServletRequest request, HttpServletResponse response) {
		// TODO Auto-generated method stub
		WuYeWgpt bp = new WuYeWgpt();
		String jsondata = bp.writePurchaseinInfo(request);
		sendResponse(response, jsondata);
		
	}
	
	/**
	 * 发送响应信息
	 * @param response
	 * @param esb
	 */
	private void sendResponse(final HttpServletResponse response, String jsondata) {
		PrintWriter out = null;
		try {
			response.setHeader("Content-type", "application/json;charset=UTF-8");
			out = new PrintWriter(new OutputStreamWriter(response.getOutputStream(), "UTF-8"));
			out.write(jsondata);
			out.flush();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (out != null) {
				out.close();
			}
		}
	}
}
