package com.steering.pss.sale.base;

import java.sql.SQLException;
import java.util.ArrayList;

import CoreFS.SA06.CoreReturnObject;
import CoreFS.SA08.CoreXmlSqlParsersFactory;
import CoreFS.SC01.CoreConstantData;

import com.steering.comm.db.DBCommon;

public class CoreBuyerOrder extends DBCommon {
	/**
	 * 查询销售区域信息
	 * 
	 * @return CoreReturnObject
	 */
	public CoreReturnObject GetQueryOrder(String name) {
		Object[] params = new Object[] { name };
		return this.getDataBySqlID("CoreBuyerOrder.doQuery", params);
	}

	/**
	 * 查询客户信息
	 * 
	 * @return CoreReturnObject
	 */
	public CoreReturnObject GetQueryBaseInfo(String name) {
		Object[] params = new Object[] { name };
		return this.getDataBySqlID("CoreBuyerOrder.doQueryBaseInfo", params);
	}

	/**
	 * 查询客户货运地址信息
	 * 
	 * @return CoreReturnObject
	 */
	public CoreReturnObject GetQueryFreight(String name,String ordsed) {
		Object[] params = new Object[] { name,ordsed };
		return this.getDataBySqlID("CoreBuyerOrder.doQueryFreight", params);
	}

	/**
	 * 查询客户定结算信息
	 * 
	 * @return CoreReturnObject
	 */
	public CoreReturnObject GetQueryOrderunitDj(String customer_no,
			String sale_org, String custm_use) {
		Object[] params = new Object[] { customer_no, sale_org, custm_use };
		return this.getDataBySqlID("CoreBuyerOrder.doQueryOrderunit", params);
	}

	/**
	 * 新增订结客户
	 * 
	 * @return CoreReturnObject 。
	 */
	public CoreReturnObject SetInsertOrderunit(ArrayList<Object> parm) {
		CoreReturnObject cro = new CoreReturnObject();
		String strSql = CoreXmlSqlParsersFactory
				.getSql("CoreBuyerOrder.doInsertOrderunit");
		try {
			cro = this.getDao(CoreConstantData.sysbeanstr).ExcuteNonQuery(
					strSql, parm.toArray());
		} catch (SQLException e) {
			cro = cro.SetErrInfo(e.getMessage());
		}
		return cro;
	}

	/**
	 * 新增运输客户
	 * 
	 * @return CoreReturnObject 。
	 */
	public CoreReturnObject SetInsertCustmFreight(ArrayList<Object> parm) {
		CoreReturnObject cro = new CoreReturnObject();
		String strSql = CoreXmlSqlParsersFactory
				.getSql("CoreBuyerOrder.doInsertCustmFreight");
		try {
			cro = this.getDao(CoreConstantData.sysbeanstr).ExcuteNonQuery(
					strSql, parm.toArray());
		} catch (SQLException e) {
			cro = cro.SetErrInfo(e.getMessage());
		}
		return cro;
	}
	
//	public CoreReturnObject saveBuyerOrder(ArrayList<String> listCustmFreight, ArrayList<String> ){
//		事务保存，暂时不改。
//	}

	/**
	 * 更新订结单位
	 * 
	 * @return CoreReturnObject 。
	 */
	public CoreReturnObject SetUpdateCustmFreight(ArrayList<Object> parm) {
		CoreReturnObject cro = new CoreReturnObject();
		String strSql = CoreXmlSqlParsersFactory
				.getSql("CoreBuyerOrder.doUpdateCustmFreight");
		try {
			cro = this.getDao(CoreConstantData.sysbeanstr).ExcuteNonQuery(
					strSql, parm.toArray());
		} catch (SQLException e) {
			cro = cro.SetErrInfo(e.getMessage());
		}
		return cro;
	}

	/**
	 * 删除运货地址
	 * 
	 * @return CoreReturnObject 。
	 */
	public CoreReturnObject GetDeleteFreight(ArrayList<Object> parm) {
		CoreReturnObject cro = new CoreReturnObject();
		String strSql = CoreXmlSqlParsersFactory
				.getSql("CoreBuyerOrder.doDeleteFreight");
		try {
			cro = this.getDao(CoreConstantData.sysbeanstr).ExcuteNonQuery(
					strSql, parm.toArray());
		} catch (SQLException e) {
			cro = cro.SetErrInfo(e.getMessage());
		}
		return cro;
	}

	/**
	 * 查询运货地址
	 * 
	 * @return CoreReturnObject 。
	 */
	public CoreReturnObject GetQueryCustmFreightAll() {
		return this.getDataBySqlID("CoreBuyerOrder.doQueryCustmFreightAll");
	}

	/**
	 * 查询到站地址
	 * 
	 * @return CoreReturnObject 。
	 */
	public CoreReturnObject GetSlmBaseStation() {
		return this.getDataBySqlID("CoreBuyerOrder.doSlmBaseStation");
	}

	/**
	 * 查询专用线地址
	 * 
	 * @return CoreReturnObject 。
	 */
	public CoreReturnObject GetSlmBasesPclLn() {
		return this.getDataBySqlID("CoreBuyerOrder.doSlmBasesPclLn");
	}

	/**
	 * 查询用途类型信息
	 * 
	 * @return CoreReturnObject
	 */
	public CoreReturnObject GetSlmCustMuseCount(String CUSTOMER_NO,
			String SALE_ORG, String CUSTM_USE) {
		Object[] params = new Object[] { CUSTOMER_NO, SALE_ORG, CUSTM_USE };
		return this.getDataBySqlID("CoreBuyerOrder.doSlmCustMuseCount", params);
	}
}
