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.
D7QUANTAI/DSWeb/FeeCodes/OpBlissueAdapter.aspx.cs

232 lines
8.1 KiB
C#

10 months ago
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
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.Xml.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Xml;
using DSWeb.Models;
using DSWeb.EntityDA;
namespace DSWeb.FeeCodes
{
public partial class OpBlissueAdapter : System.Web.UI.Page
{
private string strMark;
private string strPos;
private int iPos = 0;
public string strPortName = "";
public string strBSNO = "";
public string strUserID;//用户GID
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString().Trim();
}
else
{
Server.Transfer("~/Error/FriendError.aspx");
return;
}
if (!IsPostBack)
{
string strPost = Request.Url.ToString();
if (Request.QueryString["mask"] != null)
{
strMark = Request.QueryString["mask"].ToString();
}
if (Request.QueryString["pos"] != null)
{
strPos = Request.QueryString["pos"].ToString();
iPos = int.Parse(strPos);
}
if (Request.QueryString["BSNO"] != null)
{
strBSNO = Request.QueryString["BSNO"].ToString();
}
if (Request.QueryString["handle"] != null)
{
strPortName="";
string fs = Request.QueryString["handle"].ToString();
if (fs.Trim().Equals("feestatus"))
{
strPortName = GetByTYPE().ToString();
strPortName += "," + GetByPUT().ToString();
strPortName += "," + GetFeeByBSNODF().ToString();
strPortName += "," + GetFeeByBSNOFEESTATUS().ToString();
}
if (fs.Trim().Equals("put"))
{
strPortName = "";
strPortName = GetPut();
}
Response.Write(strPortName);
return;
}
strPortName = getBSNO();
Response.Write(strPortName);
}
}
private string GetPut()
{
string alt = "";
//如果不是本业务的销售,则不允许操作!
T_ALL_DA T_ALL_DA = new T_ALL_DA();
string sshowname = T_ALL_DA.GetSHOWNAME(strUserID);
//
string strSALE = "";
TopSeaeEntity TopSeaeEntity = new TopSeaeEntity();
SeaExportInfoDA SeaExportInfoDA = new SeaExportInfoDA();
TopSeaeEntity = SeaExportInfoDA.GetID(strBSNO.Trim());
if (TopSeaeEntity.BSNO != null)
{
strSALE = TopSeaeEntity.SALE.ToString().Trim();
}
//
if (strSALE.Trim() != sshowname.Trim() && sshowname.Trim() != "系统管理员")
{
alt = "如果不是本业务的销售,则不允许操作!";
return alt;
}
//
DataSet ds = T_ALL_DA.GetAllSQL("select * from op_blissue where bsno='" + strBSNO + "' order by BLSTATUS");
if(ds!=null)
{
if(ds.Tables[0].Rows.Count>0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
string sBLSTATUS = ds.Tables[0].Rows[i]["BLSTATUS"].ToString().Trim();
if (sBLSTATUS.Equals("放单申请") || sBLSTATUS.Equals("批准放单") || sBLSTATUS.Equals("批准电放") || sBLSTATUS.Equals("提单签出"))
{
alt = "本业务已有放单操作,不允许重复操作!";
return alt;
}
}
}
}
//
return alt;
}
private int GetByPUT()
{
int iResult = 0;
strPortName = "";
T_ALL_DA T_ALL_DA = new T_ALL_DA();
strPortName = T_ALL_DA.GetStrSQL("snum", "select count(*) as snum from op_blissue where (BLSTATUS='放单申请' or BLSTATUS='批准放单') and bsno='" + strBSNO.Trim() + "'");
if (strPortName.Trim() == "2")
{
iResult = 2;//放单申请批准通过,则无需再做电放申请,可以直接提单电放。
}
else if (strPortName.Trim() == "1")
{
iResult = 1;//放单申请
}
else
{
iResult = 0;//没有放单申请
}
return iResult;
}
private int GetByTYPE()
{
int iResult = 0;
SeaExportInfoDA SeaExportInfoDA = new SeaExportInfoDA();
TopSeaeEntity TopSeaeEntity = SeaExportInfoDA.GetID(strBSNO);
iResult = 0;//提单类型为正本或无提单类型
if (TopSeaeEntity != null)
{
if (TopSeaeEntity.ISSUETYPE.ToString().Trim().Equals("电放"))
{
iResult = 1;//提单类型为电放
}
}
return iResult;
}
private int GetFeeByBSNODF()
{
int iResult = 0;
OpBlissueDA OpBlissueDA = new OpBlissueDA();
OpBlissueEntity OpBlissueEntity = OpBlissueDA.GetOpBlissueBSNODF1(strBSNO);
if (OpBlissueEntity != null)
{
iResult = 1;//已有提单电放
}
else
{
OpBlissueEntity = OpBlissueDA.GetOpBlissueBSNODF2(strBSNO);
if (OpBlissueEntity != null)
{
iResult = 2;//已有申请提单电放
}
}
return iResult;
}
private int GetFeeByBSNOFEESTATUS()
{
int iResult = 0;
OpBlissueDA OpBlissueDA = new OpBlissueDA();
OpBlissueEntity OpBlissueEntity = OpBlissueDA.GetOpBlissueBSNODF3(strBSNO);
if (OpBlissueEntity != null)
{
iResult = 0;//已批准提单电放
}
else
{
FeeDA feeDA = new FeeDA();
IList<FeeEntity> feeEntities = feeDA.GetFeeByBSNOFEESTATUS(strBSNO);
if (feeEntities.Count > 0)//有未结算的费用信息
{
iResult = 1;//有未结算的费用信息
}
else
{
feeEntities = feeDA.GetFeeByBSNOFEESTATUS1(strBSNO);
if (feeEntities.Count > 0)//有结算的费用信息
{
iResult = 0;//有结算的费用信息,且已经结算完毕的
}
else
{
iResult = 1;//没有结算的费用信息,既是没有与委托单位有关的费用信息,不允许电放
}
}
}
return iResult;
}
public string getBSNO()
{
OpBlissueDA OpBlissueDA = new OpBlissueDA();
OpBlissueEntity OpBlissueEntity = new OpBlissueEntity();
OpBlissueEntity = OpBlissueDA.GetOpBlissueBSNOSH(strBSNO);
strPortName = "";
if (OpBlissueEntity != null)
{
if (OpBlissueEntity.ID != null)
{
strPortName = OpBlissueEntity.ISSUETYPE.ToString().Trim();
}
}
return strPortName;
}
}
}