|
|
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 DSWeb.Models;
|
|
|
using DSWeb.EntityDA;
|
|
|
using System.Text;
|
|
|
|
|
|
namespace DSWeb.FeeCodes
|
|
|
{
|
|
|
public partial class FeeUnitService : System.Web.UI.Page
|
|
|
{
|
|
|
private string strHandle;
|
|
|
private string strUserID;
|
|
|
private string strBSNO;
|
|
|
private string strCompanyID;//公司GID
|
|
|
private int iUnitType;
|
|
|
private int iType;
|
|
|
private string strCtn;
|
|
|
private string stroplb = "";//业务类别
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
{
|
|
|
if (Session["USERID"] != null)
|
|
|
{
|
|
|
strUserID = Session["USERID"].ToString();
|
|
|
}
|
|
|
if (Session["COMPANYID"] != null)
|
|
|
{
|
|
|
strCompanyID = Session["COMPANYID"].ToString();
|
|
|
}
|
|
|
if (Request.QueryString["handle"] != null)
|
|
|
{
|
|
|
strHandle = Request.QueryString["handle"].ToString();
|
|
|
}
|
|
|
if (Request.QueryString["oplb"] != null)
|
|
|
{
|
|
|
stroplb = Request.QueryString["oplb"].ToString();
|
|
|
}
|
|
|
if (Request.QueryString["bsno"] != null)
|
|
|
{
|
|
|
strBSNO = Request.QueryString["bsno"].ToString();
|
|
|
}
|
|
|
|
|
|
if (Request.QueryString["unittype"] != null)
|
|
|
{
|
|
|
iUnitType = int.Parse(Request.QueryString["unittype"].ToString());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
iUnitType = -1;
|
|
|
}
|
|
|
|
|
|
if (Request.QueryString["type"] != null)
|
|
|
{
|
|
|
iType = int.Parse(Request.QueryString["type"].ToString());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
iType = -1;
|
|
|
}
|
|
|
|
|
|
if (Request.QueryString["ctn"] != null)
|
|
|
{
|
|
|
strCtn = Request.QueryString["ctn"].ToString();
|
|
|
}
|
|
|
if (strHandle != null)
|
|
|
{
|
|
|
if (strHandle == "quantity" && iUnitType >= 0 && iType > 0)
|
|
|
{
|
|
|
if (iType == 1)//委托计费标准
|
|
|
{ //获取委托(op_seae)费用计费标准信息,返回JSON数据
|
|
|
Response.Write(GetUnitOpSeaeQuantity());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//销售订舱(crm_seaeorder)计费标准,返回JSON数据
|
|
|
Response.Write(GetUnitCrmOrder0uantity());
|
|
|
}
|
|
|
}
|
|
|
else if (strHandle == "quantityseai" && iUnitType >= 0 && iType > 0)
|
|
|
{
|
|
|
//获取委托(op_seai)费用计费标准信息,返回JSON数据
|
|
|
Response.Write(GetUnitOpSeaiQuantity());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#region 获取委托(op_seae)费用计费标准信息,返回JSON数据
|
|
|
/// <summary>
|
|
|
/// 获取委托(op_seae)费用计费标准信息,返回JSON数据
|
|
|
/// </summary>
|
|
|
/// <returns>返回JSON数据</returns>
|
|
|
private string GetUnitOpSeaeQuantity()
|
|
|
{
|
|
|
FeeCodeDA feeCodeDA = new FeeCodeDA();
|
|
|
DataTable sourceTable;
|
|
|
string strSql = "";
|
|
|
string strTypeName = "";
|
|
|
int iQuantityCount = 0;
|
|
|
switch (iUnitType)
|
|
|
{
|
|
|
case 1://单票
|
|
|
iQuantityCount = 1;
|
|
|
strTypeName = "单票";
|
|
|
break;
|
|
|
case 2://毛重
|
|
|
if (stroplb == "op_Seae")
|
|
|
{
|
|
|
strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "KGS", strBSNO, stroplb);//毛重
|
|
|
}
|
|
|
else if (stroplb == "op_Seai")
|
|
|
{
|
|
|
T_ALL_DA tallda = new T_ALL_DA();
|
|
|
string kgsvalue = tallda.GetStrSQL("KGS", "SELECT KGS FROM dbo.subcomp_seae_def WHERE CORPID='" + strCompanyID.ToString() + "'");
|
|
|
if (kgsvalue.Trim() == "净重")
|
|
|
{
|
|
|
strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "NETWEIGHT", strBSNO, stroplb);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "KGS", strBSNO, stroplb);
|
|
|
}
|
|
|
}
|
|
|
strTypeName = "重量";
|
|
|
break;
|
|
|
case 3://尺码
|
|
|
strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "CBM", strBSNO, stroplb);
|
|
|
strTypeName = "尺码";
|
|
|
break;
|
|
|
case 4://计费吨
|
|
|
strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "CBM", strBSNO, stroplb);
|
|
|
strTypeName = "计费吨";
|
|
|
break;
|
|
|
case 5://TEU
|
|
|
strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "TEU", strBSNO, stroplb);
|
|
|
strTypeName = "TEU";
|
|
|
break;
|
|
|
//case 6://净重
|
|
|
// if (stroplb == "op_Seae")
|
|
|
// {
|
|
|
// }
|
|
|
// else if (stroplb == "op_Seai")
|
|
|
// {
|
|
|
// strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "NETWEIGHT", strBSNO, stroplb);
|
|
|
// }
|
|
|
// strTypeName = "净重";
|
|
|
// break;
|
|
|
case 7://总价
|
|
|
strTypeName = "总价";
|
|
|
break;
|
|
|
case 8://计价重量
|
|
|
strTypeName = "计价重量";
|
|
|
break;
|
|
|
case 9://箱型
|
|
|
strTypeName = "箱型";
|
|
|
strSql = String.Format("SELECT TOP 1 {0} FROM op_ctn WHERE BSNO = '{1}' GROUP BY CTNALL ORDER BY CTNALL ASC ", "SUM(CTNNUM),CTNALL", strBSNO);
|
|
|
break;
|
|
|
case 10://CBM
|
|
|
strTypeName = "CBM";
|
|
|
break;
|
|
|
case 11://单票
|
|
|
iQuantityCount = 1;
|
|
|
strTypeName = "BILL";
|
|
|
break;
|
|
|
default :
|
|
|
strTypeName = strCtn;
|
|
|
strSql = String.Format("SELECT {0} FROM op_ctn WHERE BSNO = '{1}' AND CTNALL = '{2}'", "ISNULL(SUM(CTNNUM),0)", strBSNO,strCtn);
|
|
|
break;
|
|
|
}
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
sourceBuilder.Append("{");
|
|
|
sourceBuilder.Append("quantity:[");
|
|
|
if (iQuantityCount == 1)
|
|
|
{
|
|
|
sourceBuilder.Append("{value:1,");
|
|
|
sourceBuilder.Append("name:\"" + strTypeName + "\"");
|
|
|
sourceBuilder.Append("}");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceTable = feeCodeDA.GetExcuteSql(strSql).Tables[0];
|
|
|
|
|
|
if (sourceTable.Rows.Count > 0 && !sourceTable.Rows[0][0].ToString().Trim().Equals(""))
|
|
|
{
|
|
|
if (strTypeName == "箱型")
|
|
|
{
|
|
|
sourceBuilder.Append("{value:" + sourceTable.Rows[0][0].ToString() + ",");
|
|
|
sourceBuilder.Append("name:\"" + sourceTable.Rows[0][1].ToString() + "\"");
|
|
|
sourceBuilder.Append("}");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("{value:" + sourceTable.Rows[0][0].ToString() + ",");
|
|
|
sourceBuilder.Append("name:\"" + strTypeName + "\"");
|
|
|
sourceBuilder.Append("}");
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("{value:0,");
|
|
|
sourceBuilder.Append("name:\"" + strTypeName + "\"");
|
|
|
sourceBuilder.Append("}");
|
|
|
}
|
|
|
}
|
|
|
sourceBuilder.Append("]");
|
|
|
sourceBuilder.Append("}");
|
|
|
return sourceBuilder.ToString();
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 销售订舱(crm_seaeorder)计费标准,返回JSON数据
|
|
|
/// <summary>
|
|
|
/// 销售订舱(crm_seaeorder)计费标准,返回JSON数据
|
|
|
/// </summary>
|
|
|
/// <returns>返回JSON数据</returns>
|
|
|
private string GetUnitCrmOrder0uantity()
|
|
|
{
|
|
|
FeeCodeDA feeCodeDA = new FeeCodeDA();
|
|
|
DataTable sourceTable;
|
|
|
string strSql = "";
|
|
|
string strTypeName = "";
|
|
|
int iQuantityCount = 0;
|
|
|
switch (iUnitType)
|
|
|
{
|
|
|
case 1://单票
|
|
|
iQuantityCount = 1;
|
|
|
strTypeName = "单票";
|
|
|
break;
|
|
|
case 2://毛重
|
|
|
if (stroplb == "op_Seae")
|
|
|
{
|
|
|
strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "KGS", strBSNO, stroplb);//毛重
|
|
|
}
|
|
|
else if (stroplb == "op_Seai")
|
|
|
{
|
|
|
strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "NETWEIGHT", strBSNO, stroplb);//净重
|
|
|
}
|
|
|
strTypeName = "重量";
|
|
|
break;
|
|
|
case 3://尺码
|
|
|
strSql = String.Format("SELECT {0} FROM crm_seaeorder WHERE BSNO = '{1}'", "CBM", strBSNO);
|
|
|
strTypeName = "尺码";
|
|
|
break;
|
|
|
case 4://计费吨
|
|
|
strSql = String.Format("SELECT {0} FROM crm_seaeorder WHERE BSNO = '{1}'", "CBM", strBSNO);
|
|
|
strTypeName = "计费吨";
|
|
|
break;
|
|
|
case 5://TEU
|
|
|
strTypeName = "TEU";
|
|
|
strSql = String.Format("SELECT SUM(CASE WHEN CAST(SUBSTRING(CTNALL,0,3) as INT) > 20 THEN CTNNUM * 2 ELSE CTNNUM END) as TOTAL FROM crm_seaeorderctn WHERE ORDNO = '{0}' ", strBSNO);
|
|
|
break;
|
|
|
//case 6://净重
|
|
|
// if (stroplb == "op_Seae")
|
|
|
// {
|
|
|
// }
|
|
|
// else if (stroplb == "op_Seai")
|
|
|
// {
|
|
|
// strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "NETWEIGHT", strBSNO, stroplb);
|
|
|
// }
|
|
|
// strTypeName = "净重";
|
|
|
// break;
|
|
|
case 7://总价
|
|
|
strTypeName = "总价";
|
|
|
break;
|
|
|
case 8://计价重量
|
|
|
strTypeName = "计价重量";
|
|
|
break;
|
|
|
case 9://箱型
|
|
|
strTypeName = "箱型";
|
|
|
strSql = String.Format("SELECT TOP 1 {0} FROM crm_seaeorderctn WHERE ORDNO = '{1}' ORDER BY CTNALL ASC ", "CTNNUM,CTNALL", strBSNO);
|
|
|
break;
|
|
|
case 10://CBM
|
|
|
strTypeName = "CBM";
|
|
|
break;
|
|
|
case 11://单票
|
|
|
iQuantityCount = 1;
|
|
|
strTypeName = "BILL";
|
|
|
break;
|
|
|
default:
|
|
|
strTypeName = strCtn;
|
|
|
strSql = String.Format("SELECT {0} FROM crm_seaeorderctn WHERE ORDNO = '{1}' AND CTNALL = '{2}'", "CTNNUM", strBSNO, strCtn);
|
|
|
break;
|
|
|
}
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
sourceBuilder.Append("{");
|
|
|
sourceBuilder.Append("quantity:[");
|
|
|
if (iQuantityCount == 1)
|
|
|
{
|
|
|
sourceBuilder.Append("{value:1,");
|
|
|
sourceBuilder.Append("name:\"" + strTypeName + "\"");
|
|
|
sourceBuilder.Append("}");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (strSql.Trim() != "")
|
|
|
{
|
|
|
sourceTable = feeCodeDA.GetExcuteSql(strSql).Tables[0];
|
|
|
|
|
|
if (sourceTable.Rows.Count > 0)
|
|
|
{
|
|
|
if (strTypeName == "箱型")
|
|
|
{
|
|
|
sourceBuilder.Append("{value:" + sourceTable.Rows[0][0].ToString() + ",");
|
|
|
sourceBuilder.Append("name:\"" + sourceTable.Rows[0][1].ToString() + "\"");
|
|
|
sourceBuilder.Append("}");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("{value:" + sourceTable.Rows[0][0].ToString() + ",");
|
|
|
sourceBuilder.Append("name:\"" + strTypeName + "\"");
|
|
|
sourceBuilder.Append("}");
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("{value:0,");
|
|
|
sourceBuilder.Append("name:\"" + strTypeName + "\"");
|
|
|
sourceBuilder.Append("}");
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("{value:0,");
|
|
|
sourceBuilder.Append("name:\"" + strTypeName + "\"");
|
|
|
sourceBuilder.Append("}");
|
|
|
}
|
|
|
}
|
|
|
sourceBuilder.Append("]");
|
|
|
sourceBuilder.Append("}");
|
|
|
return sourceBuilder.ToString();
|
|
|
}
|
|
|
#endregion
|
|
|
#region 获取委托(op_seai)费用计费标准信息,返回JSON数据
|
|
|
/// <summary>
|
|
|
/// 获取委托(op_seai)费用计费标准信息,返回JSON数据
|
|
|
/// </summary>
|
|
|
/// <returns>返回JSON数据</returns>
|
|
|
private string GetUnitOpSeaiQuantity()
|
|
|
{
|
|
|
FeeCodeDA feeCodeDA = new FeeCodeDA();
|
|
|
DataTable sourceTable;
|
|
|
string strSql = "";
|
|
|
string strTypeName = "";
|
|
|
int iQuantityCount = 0;
|
|
|
switch (iUnitType)
|
|
|
{
|
|
|
case 1://单票
|
|
|
iQuantityCount = 1;
|
|
|
strTypeName = "单票";
|
|
|
break;
|
|
|
case 2://毛重
|
|
|
if (stroplb == "op_Seae")
|
|
|
{
|
|
|
strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "KGS", strBSNO, stroplb);
|
|
|
}
|
|
|
else if (stroplb == "op_Seai")
|
|
|
{
|
|
|
strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "NETWEIGHT", strBSNO, stroplb);
|
|
|
}
|
|
|
strTypeName = "重量";
|
|
|
break;
|
|
|
case 3://尺码
|
|
|
strSql = String.Format("SELECT {0} FROM op_seai WHERE BSNO = '{1}'", "CBM", strBSNO);
|
|
|
strTypeName = "尺码";
|
|
|
break;
|
|
|
case 4://计费吨
|
|
|
strSql = String.Format("SELECT {0} FROM op_seai WHERE BSNO = '{1}'", "CBM", strBSNO);
|
|
|
strTypeName = "计费吨";
|
|
|
break;
|
|
|
case 5://TEU
|
|
|
strSql = String.Format("SELECT {0} FROM op_seai WHERE BSNO = '{1}'", "TEU", strBSNO);
|
|
|
strTypeName = "TEU";
|
|
|
break;
|
|
|
//case 6://净重
|
|
|
// if (stroplb == "op_Seae")
|
|
|
// {
|
|
|
// }
|
|
|
// else if (stroplb == "op_Seai")
|
|
|
// {
|
|
|
// strSql = String.Format("SELECT {0} FROM {2} WHERE BSNO = '{1}'", "NETWEIGHT", strBSNO, stroplb);
|
|
|
// }
|
|
|
// strTypeName = "净重";
|
|
|
// break;
|
|
|
case 7://总价
|
|
|
strTypeName = "总价";
|
|
|
break;
|
|
|
case 8://计价重量
|
|
|
strTypeName = "计价重量";
|
|
|
break;
|
|
|
case 9://箱型
|
|
|
strTypeName = "箱型";
|
|
|
strSql = String.Format("SELECT TOP 1 {0} FROM op_ctn WHERE BSNO = '{1}' GROUP BY CTNALL ORDER BY CTNALL ASC ", "SUM(CTNNUM),CTNALL", strBSNO);
|
|
|
break;
|
|
|
case 10://CBM
|
|
|
strTypeName = "CBM";
|
|
|
break;
|
|
|
case 11://单票
|
|
|
iQuantityCount = 1;
|
|
|
strTypeName = "BILL";
|
|
|
break;
|
|
|
default:
|
|
|
strTypeName = strCtn;
|
|
|
strSql = String.Format("SELECT {0} FROM op_ctn WHERE BSNO = '{1}' AND CTNALL = '{2}'", "ISNULL(SUM(CTNNUM),0)", strBSNO, strCtn);
|
|
|
break;
|
|
|
}
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
sourceBuilder.Append("{");
|
|
|
sourceBuilder.Append("quantity:[");
|
|
|
if (iQuantityCount == 1)
|
|
|
{
|
|
|
sourceBuilder.Append("{value:1,");
|
|
|
sourceBuilder.Append("name:\"" + strTypeName + "\"");
|
|
|
sourceBuilder.Append("}");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceTable = feeCodeDA.GetExcuteSql(strSql).Tables[0];
|
|
|
|
|
|
if (sourceTable.Rows.Count > 0)
|
|
|
{
|
|
|
if (strTypeName == "箱型")
|
|
|
{
|
|
|
sourceBuilder.Append("{value:" + sourceTable.Rows[0][0].ToString() + ",");
|
|
|
sourceBuilder.Append("name:\"" + sourceTable.Rows[0][1].ToString() + "\"");
|
|
|
sourceBuilder.Append("}");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("{value:" + sourceTable.Rows[0][0].ToString() + ",");
|
|
|
sourceBuilder.Append("name:\"" + strTypeName + "\"");
|
|
|
sourceBuilder.Append("}");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("{value:0,");
|
|
|
sourceBuilder.Append("name:\"" + strTypeName + "\"");
|
|
|
sourceBuilder.Append("}");
|
|
|
}
|
|
|
}
|
|
|
sourceBuilder.Append("]");
|
|
|
sourceBuilder.Append("}");
|
|
|
return sourceBuilder.ToString();
|
|
|
}
|
|
|
#endregion
|
|
|
}
|
|
|
}
|