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/Shipping/SeaExportInfoBlissueSurPutS...

237 lines
11 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
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.Text;
using DSWeb.DataAccess;
using System.Data.SqlClient;
using DSWeb.Models;
using DSWeb.EntityDA;
using System.Web.Script.Serialization;
namespace DSWeb.Shipping
{
public partial class SeaExportInfoBlissueSurPutSingle : System.Web.UI.Page
{
public string sSQL = String.Empty;
public string gvid = String.Empty;
RangeDA RangeDA = new RangeDA();
public string strUserID;//用户GID
public string sRMB = String.Empty;
public string sUSD = String.Empty;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString().Trim();
}
else
{
Server.Transfer("~/Error/FriendError.aspx");
return;
//strUserID = "";
}
this.hdUserID.Value = strUserID;
//
if (!IsPostBack)
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
if (Request.QueryString["handle"] != null)
{
this.hdHandle.Value = Request.QueryString["handle"].ToString().Trim();
}
if (Request.QueryString["id"] != null)
{
this.hdGID.Value = Request.QueryString["id"].ToString();
}
if (Request.QueryString["bsno"] != null)
{
this.hdBSNO.Value = Request.QueryString["bsno"].ToString();
//
TopSeaeEntity TopSeaeEntity = new TopSeaeEntity();
SeaExportInfoDA SeaExportInfoDA = new SeaExportInfoDA();
TopSeaeEntity = SeaExportInfoDA.GetID(this.hdBSNO.Value.Trim());
if (TopSeaeEntity.BSNO != null)
{
lbVESSELVOYNO.Text = TopSeaeEntity.VESSEL.ToString().Trim()+" "+TopSeaeEntity.VOYNO.ToString().Trim();
lbETD.Text = TopSeaeEntity.ETD.ToString("yyyy-MM-dd").Trim();
lbMBLNO.Text = TopSeaeEntity.MBLNO.ToString().Trim();
lbCUSTOMERNAME.Text = TopSeaeEntity.CUSTOMERNAME.ToString().Trim();
this.hdSALE.Value = TopSeaeEntity.SALE.ToString().Trim();
this.hdISSUETYPE.Value = TopSeaeEntity.ISSUETYPE.ToString().Trim();
}
}
//
if (this.hdHandle.Value.Trim() == "edit")
{
if (this.hdGID.Value.Trim() != "")
{
OpBlissueEntity OpBlissueEntity=new OpBlissueEntity();
OpBlissueDA OpBlissueDA = new OpBlissueDA();
OpBlissueEntity = OpBlissueDA.GetOpBlissueID(this.hdGID.Value.Trim());
tbPUTSINGLETIME.Text=OpBlissueEntity.PUTSINGLETIME.ToString("yyyy-MM-dd").Trim();
tbPUTSINGLE.Text = OpBlissueEntity.PUTSINGLE.ToString().Trim();
tbPAYTIME.Text = OpBlissueEntity.PAYTIME.ToString("yyyy-MM-dd").Trim();
tbPAYRMB.Text = OpBlissueEntity.PAYRMB.ToString().Trim();
tbPAYUSD.Text = OpBlissueEntity.PAYUSD.ToString().Trim();
}
//权限可视范围
string strV = RangeDA.GetVISIBLERANGE(strUserID.Trim(), "modOrderManagement");
string strO = RangeDA.GetOPERATERANGE(strUserID.Trim(), "modOrderManagement");
//页面是否只读
if (Request.QueryString["hdenabled"] != null)
{
if (Request.QueryString["hdenabled"].ToString() == "false")
{
strO = "4";
}
}
//
string alt = "";
if (strV.Trim() != strO.Trim())
{
if (strO.Trim().Equals("0"))//全部
{
}
else if (strO.Trim().Equals("1"))//分公司
{
alt = RangeDA.GetOrderManagementCompany(strUserID.Trim(), ViewState["GID"].ToString().Trim());
if (alt == "")
{
getEnabled();
}
}
else if (strO.Trim().Equals("2"))//部门
{
alt = RangeDA.GetOrderManagementDEPT(strUserID.Trim(), ViewState["GID"].ToString().Trim());
if (alt == "")
{
getEnabled();
}
}
else if (strO.Trim().Equals("3"))//个人
{
alt = RangeDA.GetOrderManagementPerson(strUserID.Trim(), ViewState["GID"].ToString().Trim());
if (alt == "")
{
getEnabled();
}
}
else if (strO.Trim().Equals("4"))//无
{
getEnabled();
}
}
}
else
{
tbPUTSINGLETIME.Text = "";
tbPUTSINGLE.Text ="";
tbPAYTIME.Text = "";
tbPAYRMB.Text = T_ALL_DA.GetStrSQL("hjRMB", "select isnull((select sum(AMOUNT) from ch_fee where FEETYPE=1 and CURRENCY='RMB' and FEESTATUS<8 and bsno='" + this.hdBSNO.Value + "' and CUSTOMERNAME=(select CUSTOMERNAME from op_seae where BSNO = '" + this.hdBSNO.Value + "')),0) + isnull((select sum(AMOUNT-SETTLEMENT) from ch_fee where FEETYPE=1 and CURRENCY='RMB' and FEESTATUS=8 and bsno='" + this.hdBSNO.Value + "' and CUSTOMERNAME=(select CUSTOMERNAME from op_seae where BSNO = '" + this.hdBSNO.Value + "')),0) as hjRMB");
tbPAYUSD.Text = T_ALL_DA.GetStrSQL("hjUSD", "select isnull((select sum(AMOUNT) from ch_fee where FEETYPE=1 and CURRENCY='USD' and FEESTATUS<8 and bsno='" + this.hdBSNO.Value + "' and CUSTOMERNAME=(select CUSTOMERNAME from op_seae where BSNO = '" + this.hdBSNO.Value + "')),0) + isnull((select sum(AMOUNT-SETTLEMENT) from ch_fee where FEETYPE=1 and CURRENCY='USD' and FEESTATUS=8 and bsno='" + this.hdBSNO.Value + "' and CUSTOMERNAME=(select CUSTOMERNAME from op_seae where BSNO = '" + this.hdBSNO.Value + "')),0) as hjUSD");
}
//如果不是本业务的销售,则不允许操作!
string sshowname = T_ALL_DA.GetSHOWNAME(strUserID);
if (this.hdSALE.Value.Trim() != sshowname.Trim() && sshowname.Trim() != "系统管理员")
{
getEnabled();
}
else
{
//本业务已有放单操作,不允许重复操作!
DataSet ds = T_ALL_DA.GetAllSQL("select * from op_blissue where bsno='" + this.hdBSNO.Value.Trim() + "' 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("提单签出"))
{
getEnabled();
return;
}
}
}
}
//
}
}
//
if (this.hdEnter.Value == "1")
{
getEnter();
}
}
protected void getEnabled()
{
this.imgEnter.Disabled = true;
//
this.hdEnabled.Value = "false";
//
tbPUTSINGLETIME.Enabled = false;
tbPUTSINGLE.Enabled = false;
tbPAYTIME.Enabled = false;
tbPAYRMB.Enabled = false;
tbPAYUSD.Enabled = false;
}
protected void getEnter()
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
if (this.hdHandle.Value.Trim() != null && this.hdHandle.Value.Trim() == "edit")
{
if (this.hdGID.Value.Trim() != null && this.hdGID.Value.Trim() != "")
{
string alt = T_ALL_DA.GetBlissueSurPutSingleUpdate(this.hdGID.Value.Trim(), tbPUTSINGLETIME.Text.Trim(), tbPUTSINGLE.Text.Trim(), tbPAYTIME.Text.Trim(), this.hdISSUETYPE.Value.Trim(), strUserID.Trim(), tbPAYRMB.Text.Trim(), tbPAYUSD.Text.Trim());
if (alt == "")
{
this.hdEnter.Value = "0";
Page.ClientScript.RegisterStartupScript(this.GetType(), "key0", "<script>alert('更改成功!');window.opener.location.reload();history.back();</script>");
return;
}
else
{
this.hdEnter.Value = "0";
Page.ClientScript.RegisterStartupScript(this.GetType(), "key3", "<script>alert('" + alt + "');history.back();</script>");
return;
}
}
}
else
{
this.hdGID.Value = T_ALL_DA.getSQLID("Put");
string alt = T_ALL_DA.GetBlissueSurPutSingleInsert(this.hdGID.Value.Trim(), this.hdBSNO.Value.Trim(), lbMBLNO.Text.Trim(), tbPUTSINGLETIME.Text.Trim(), tbPUTSINGLE.Text.Trim(), tbPAYTIME.Text.Trim(), this.hdISSUETYPE.Value.Trim(), strUserID.Trim(), tbPAYRMB.Text.Trim(), tbPAYUSD.Text.Trim());
if (alt == "")
{
this.hdEnter.Value = "0";
this.hdHandle.Value = "edit";
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>reloadParent('" + this.hdBSNO.Value.Trim() + "','" + this.hdGID.Value.Trim() + "');</script>");
return;
}
else
{
this.hdEnter.Value = "0";
Page.ClientScript.RegisterStartupScript(this.GetType(), "key2", "<script>alert('" + alt + "');history.back();</script>");
return;
}
}
//
}
}
}