You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

362 lines
15 KiB
C#

11 months ago
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Text;
using DSWeb.Models;
using DSWeb.EntityDA;
namespace DSWeb.FeeCodes
{
public partial class FeeDebitService : System.Web.UI.Page
{
private string strHandle;
private string strBSNO;
private int iDebitType;
private int iType;
private string stroplb;//业务类别
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["handle"] != null)
{
strHandle = Request.QueryString["handle"].ToString().Trim().ToLower();
}
if (Request.QueryString["oplb"] != null)
{
stroplb = Request.QueryString["oplb"].ToString();
}
if (Request.QueryString["bsno"] != null)
{
strBSNO = Request.QueryString["bsno"].ToString();
}
if (Request.QueryString["debittype"] != null)
{
iDebitType = int.Parse(Request.QueryString["debittype"].ToString());
}
else
{
iDebitType = 0;
}
if (Request.QueryString["type"] != null)
{
iType = int.Parse(Request.QueryString["type"].ToString());
}
else
{
iType = 0;
}
if (strHandle != null)
{
if (strHandle == "debit" )
{
if (strBSNO != null && iDebitType > 0)
{
if (iType == 1)
{ // 获取委托信息(op_seae)默认收费客户信息返回JSON数据源
Response.Write(getSeaeDebitCustomerName());
}
else if(iType == 2)
{ //获取销售订舱信息(crm_seaeorder)默认收费客户信息返回JSON数据源
Response.Write(getCrmOrderDebitCustomerName());
}
}
}
else if (strHandle == "debitseai")
{
if (strBSNO != null && iDebitType > 0)
{
if (iType == 1)
{ // 获取委托信息(op_seai)默认收费客户信息返回JSON数据源
Response.Write(getSeaiDebitCustomerName());
}
}
}
}
}
#region 获取销售订舱信息(crm_seaeorder)默认收费客户信息返回JSON数据源
/// <summary>
/// 获取销售订舱信息(crm_seaeorder)默认收费客户信息返回JSON数据源
/// </summary>
/// <returns>返回JSON数据源</returns>
private string getCrmOrderDebitCustomerName()
{
FeeCodeDA feeCodeDA = new FeeCodeDA();
DataTable sourceTable;
string strSql = "";
string strDebitTypeName = "";
switch (iDebitType)
{
case 1://船公司
strDebitTypeName = "船公司";
strSql = String.Format("SELECT {0} FROM crm_seaeorder WHERE BSNO = '{1}'", "CARRIER", strBSNO);
break;
case 2://订舱代理
strDebitTypeName = "订舱代理";
strSql = String.Format("SELECT {0} FROM crm_seaeorder WHERE BSNO = '{1}'", "FORWARDER", strBSNO);
break;
case 3://场站
strDebitTypeName = "场站";
//strSql = String.Format("SELECT {0} FROM crm_seaeorder WHERE BSNO = '{1}'", "YARD", strBSNO);
break;
case 4://车队
strDebitTypeName = "车队";
//strSql = String.Format("SELECT {0} FROM crm_seaeorder WHERE BSNO = '{1}'", "TRUCKER", strBSNO);
break;
case 5://委托单位
strDebitTypeName = "委托单位";
strSql = String.Format("SELECT {0} FROM crm_seaeorder WHERE BSNO = '{1}'", "CUSTOMERNAME", strBSNO);
break;
case 6://报关行
strDebitTypeName = "报关行";
//strSql = String.Format("SELECT {0} FROM crm_seaeorder WHERE BSNO = '{1}'", "CUSTOMSER", strBSNO);
break;
case 7://代理
strDebitTypeName = "代理";
// strSql = String.Format("SELECT {0} FROM crm_seaeorder WHERE BSNO = '{1}'", "AGENT", strBSNO);
break;
case 8://航空公司
strDebitTypeName = "航空公司";
break;
case 9://发货人
strDebitTypeName = "发货人";
strSql = String.Format("SELECT {0} FROM crm_seaeorder WHERE BSNO = '{1}'", "SHIPPERID", strBSNO);
break;
case 10://收货人
strDebitTypeName = "收货人";
strSql = String.Format("SELECT {0} FROM crm_seaeorder WHERE BSNO = '{1}'", "CONSIGNEEID", strBSNO);
break;
case 11://通知人
strDebitTypeName = "通知人";
strSql = String.Format("SELECT {0} FROM crm_seaeorder WHERE BSNO = '{1}'", "NOTIFYPARTYID", strBSNO);
break;
}
StringBuilder sourceBuilder = new StringBuilder();
sourceBuilder.Append("{");
sourceBuilder.Append("debit:[");
if (strSql.Trim() != "")
{
sourceTable = feeCodeDA.GetExcuteSql(strSql).Tables[0];
if (sourceTable.Rows.Count > 0)
{
sourceBuilder.Append("{value:\"" + sourceTable.Rows[0][0].ToString() + "\",");
sourceBuilder.Append("name:\"" + strDebitTypeName + "\"");
sourceBuilder.Append("}");
}
else
{
sourceBuilder.Append("{value:\"\",");
sourceBuilder.Append("name:\"" + strDebitTypeName + "\"");
sourceBuilder.Append("}");
}
}
else
{
sourceBuilder.Append("{value:\"\",");
sourceBuilder.Append("name:\"" + strDebitTypeName + "\"");
sourceBuilder.Append("}");
}
sourceBuilder.Append("]");
sourceBuilder.Append("}");
return sourceBuilder.ToString();
}
#endregion
#region 获取委托信息(op_seae)默认收费客户信息返回JSON数据源
/// <summary>
/// 获取委托信息默认收费客户信息(op_seae)
/// </summary>
/// <returns>返回JSON数据源</returns>
private string getSeaeDebitCustomerName()
{
FeeCodeDA feeCodeDA = new FeeCodeDA();
DataTable sourceTable;
string strSql = "";
string strDebitTypeName = "";
switch (iDebitType)
{
case 1://船公司
strDebitTypeName = "船公司";
strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "CUSTOMERNAME", strBSNO, stroplb);
break;
case 2://订舱代理
strDebitTypeName = "订舱代理";
strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "FORWARDER", strBSNO, stroplb);
break;
case 3://场站
strDebitTypeName = "场站";
strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "YARD", strBSNO, stroplb);
break;
case 4://车队
strDebitTypeName = "车队";
strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "TRUCKER", strBSNO, stroplb);
break;
case 5://委托单位
strDebitTypeName = "委托单位";
strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "CUSTOMERNAME", strBSNO, stroplb);
break;
case 6://报关行
strDebitTypeName = "报关行";
strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "CUSTOMSER", strBSNO, stroplb);
break;
case 7://代理
strDebitTypeName = "代理";
strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "AGENT", strBSNO, stroplb);
break;
case 8://航空公司
strDebitTypeName = "航空公司";
break;
case 9://发货人
strDebitTypeName = "发货人";
strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "SHIPPERID", strBSNO, stroplb);
break;
case 10://收货人
strDebitTypeName = "收货人";
strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "CONSIGNEEID", strBSNO, stroplb);
break;
case 11://通知人
strDebitTypeName = "通知人";
strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "NOTIFYPARTYID", strBSNO, stroplb);
break;
}
StringBuilder sourceBuilder = new StringBuilder();
sourceBuilder.Append("{");
sourceBuilder.Append("debit:[");
if (strSql.Trim() != "")
{
sourceTable = feeCodeDA.GetExcuteSql(strSql).Tables[0];
if (sourceTable.Rows.Count > 0)
{
sourceBuilder.Append("{value:\"" + sourceTable.Rows[0][0].ToString() + "\",");
sourceBuilder.Append("name:\"" + strDebitTypeName + "\"");
sourceBuilder.Append("}");
}
else
{
sourceBuilder.Append("{value:\"\",");
sourceBuilder.Append("name:\"" + strDebitTypeName + "\"");
sourceBuilder.Append("}");
}
}
else
{
sourceBuilder.Append("{value:\"\",");
sourceBuilder.Append("name:\"" + strDebitTypeName + "\"");
sourceBuilder.Append("}");
}
sourceBuilder.Append("]");
sourceBuilder.Append("}");
return sourceBuilder.ToString();
}
#endregion
#region 获取委托信息(op_seai)默认收费客户信息返回JSON数据源
/// <summary>
/// 获取委托信息默认收费客户信息(op_seai)
/// </summary>
/// <returns>返回JSON数据源</returns>
private string getSeaiDebitCustomerName()
{
FeeCodeDA feeCodeDA = new FeeCodeDA();
DataTable sourceTable;
string strSql = "";
string strDebitTypeName = "";
switch (iDebitType)
{
case 1://船公司
strDebitTypeName = "船公司";
strSql = String.Format("SELECT {0} FROM op_seai WHERE BSNO = '{1}'", "CARRIER", strBSNO);
break;
case 2://订舱代理
strDebitTypeName = "订舱代理";
strSql = String.Format("SELECT {0} FROM op_seai WHERE BSNO = '{1}'", "FORWARDER", strBSNO);
break;
case 3://场站
strDebitTypeName = "场站";
strSql = String.Format("SELECT {0} FROM op_seai WHERE BSNO = '{1}'", "YARD", strBSNO);
break;
case 4://车队
strDebitTypeName = "车队";
strSql = String.Format("SELECT {0} FROM op_seai WHERE BSNO = '{1}'", "TRUCKER", strBSNO);
break;
case 5://委托单位
strDebitTypeName = "委托单位";
strSql = String.Format("SELECT {0} FROM op_seai WHERE BSNO = '{1}'", "CUSTOMERNAME", strBSNO);
break;
case 6://报关行
strDebitTypeName = "报关行";
strSql = String.Format("SELECT {0} FROM op_seai WHERE BSNO = '{1}'", "CUSTOMSER", strBSNO);
break;
case 7://代理
strDebitTypeName = "代理";
strSql = String.Format("SELECT {0} FROM op_seai WHERE BSNO = '{1}'", "AGENT", strBSNO);
break;
case 8://航空公司
strDebitTypeName = "航空公司";
break;
case 9://发货人
strDebitTypeName = "发货人";
strSql = String.Format("SELECT {0} FROM op_seai WHERE BSNO = '{1}'", "SHIPPERID", strBSNO);
break;
case 10://收货人
strDebitTypeName = "收货人";
strSql = String.Format("SELECT {0} FROM op_seai WHERE BSNO = '{1}'", "CONSIGNEEID", strBSNO);
break;
case 11://通知人
strDebitTypeName = "通知人";
strSql = String.Format("SELECT {0} FROM op_seai WHERE BSNO = '{1}'", "NOTIFYPARTYID", strBSNO);
break;
}
StringBuilder sourceBuilder = new StringBuilder();
sourceBuilder.Append("{");
sourceBuilder.Append("debit:[");
if (strSql.Trim() != "")
{
sourceTable = feeCodeDA.GetExcuteSql(strSql).Tables[0];
if (sourceTable.Rows.Count > 0)
{
sourceBuilder.Append("{value:\"" + sourceTable.Rows[0][0].ToString() + "\",");
sourceBuilder.Append("name:\"" + strDebitTypeName + "\"");
sourceBuilder.Append("}");
}
else
{
sourceBuilder.Append("{value:\"\",");
sourceBuilder.Append("name:\"" + strDebitTypeName + "\"");
sourceBuilder.Append("}");
}
}
else
{
sourceBuilder.Append("{value:\"\",");
sourceBuilder.Append("name:\"" + strDebitTypeName + "\"");
sourceBuilder.Append("}");
}
sourceBuilder.Append("]");
sourceBuilder.Append("}");
return sourceBuilder.ToString();
}
#endregion
}
}