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.
DS7/DSWeb/Shipping/SeaExportInfoBusinessIntoGo...

451 lines
25 KiB
C#

3 years ago
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 SeaExportInfoBusinessIntoGoods : PageBase
{
public string sSQL = String.Empty;
public string gvid = String.Empty;
T_ALL_DA T_ALL_DA = new T_ALL_DA();
UserDA UserDA = new UserDA();
UserEntity UserEntity = new UserEntity();
MoneyConvert MoneyConvert = new MoneyConvert();
TopSeaeEntity TopSeaeEntity = new TopSeaeEntity();
SeaExportInfoDA SeaExportInfoDA = new SeaExportInfoDA();
TopSeaeBillmanageEntity TopSeaeBillmanageEntity = new TopSeaeBillmanageEntity();
TopSeaeBillmanageDA TopSeaeBillmanageDA = new TopSeaeBillmanageDA();
RangeDA RangeDA = new RangeDA();
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;
//strUserID = "";
}
this.hdUserID.Value = strUserID;
//
if (!IsPostBack)
{
if (Request.QueryString["handle"] != null)
{
Session["handle"] = Request.QueryString["handle"].ToString().Trim();
}
if (Request.QueryString["leid"] != null)
{
Session["leid"] = Request.QueryString["leid"].ToString();
this.hdGid.Value=Request.QueryString["leid"].ToString();
}
if (Request.QueryString["id"] != null)
{
ViewState["GID"] = Request.QueryString["id"].ToString();
this.hdBSNO.Value = Request.QueryString["id"].ToString();
}
//
if (Session["handle"].ToString().Trim() == "edit")
{
if (Session["leid"].ToString().Trim() != "")
{
DataSet ds = T_ALL_DA.GetTopLetter(Session["leid"].ToString().Trim());
if (ds != null)
{
//TO
tbTO.Text = ds.Tables[0].Rows[0]["HEAD_TO"].ToString().Trim();
//ATTN
this.hd_comboATTN.Value = ds.Tables[0].Rows[0]["HEAD_ATTN"].ToString().Trim();
tbATTNTEL.Text = ds.Tables[0].Rows[0]["HEAD_ATTNTEL"].ToString().Trim();
tbATTNFAX.Text = ds.Tables[0].Rows[0]["HEAD_ATTNFAX"].ToString().Trim();
//FM
tbFM.Text = ds.Tables[0].Rows[0]["INPUTBY"].ToString().Trim();
tbFMTEL.Text = ds.Tables[0].Rows[0]["HEAD_FMTEL"].ToString().Trim();
tbFMFAX.Text = ds.Tables[0].Rows[0]["HEAD_FMFAX"].ToString().Trim();
tbFMEMAIL.Text = ds.Tables[0].Rows[0]["HEAD_FMEMAIL"].ToString().Trim();
//
ds = T_ALL_DA.GetTopLetterYard(Request.QueryString["leid"].ToString().Trim());
if (ds != null)
{
//主提单号
tbMBLNO.Text = ds.Tables[0].Rows[0]["MBLNO"].ToString().Trim();
//卸货港
tbPORTDISCHARGE.Text = ds.Tables[0].Rows[0]["PORTDISCHARGE"].ToString().Trim();
//船名/航次
tbVESSELVOYNO.Text = ds.Tables[0].Rows[0]["VESSELVOYNO"].ToString().Trim();
//开船日期
if (ds.Tables[0].Rows[0]["ETD"].ToString().Trim() == "")
{
tbETD.Text = "";
}
else
{
tbETD.Text = DateTime.Parse(ds.Tables[0].Rows[0]["ETD"].ToString().Trim()).ToString("yyyy-MM-dd").Trim();
}
//件重尺
tbPKC.Text = ds.Tables[0].Rows[0]["PKC"].ToString().Trim();
//箱型箱量
tbCNTR.Text = ds.Tables[0].Rows[0]["CNTR"].ToString().Trim();
//货物描述
tbDESCRIPTION.Text = ds.Tables[0].Rows[0]["DESCRIPTION"].ToString().Trim();
//提箱场站
this.hd_comboYARD.Value = ds.Tables[0].Rows[0]["YARD"].ToString().Trim();
//提箱场站地址
tbAddress.Text = ds.Tables[0].Rows[0]["Address"].ToString().Trim();
//提箱场站联系人
this.hd_comboCHIEF.Value = ds.Tables[0].Rows[0]["CHIEF"].ToString().Trim();
//提箱场站电话
string stel=ds.Tables[0].Rows[0]["Tel"].ToString().Trim();
tbTel.Text = stel.Replace("--", "");
//入货场站
this.hd_comboYARD2.Value = ds.Tables[0].Rows[0]["YARD2"].ToString().Trim();
//入货场站地址
tbAddress2.Text = ds.Tables[0].Rows[0]["Address2"].ToString().Trim();
//入货场站联系人
this.hd_comboCHIEF2.Value = ds.Tables[0].Rows[0]["CHIEF2"].ToString().Trim();
//入货场站电话
string stel2 =ds.Tables[0].Rows[0]["Tel2"].ToString().Trim();
tbTel2.Text = stel2.Replace("--", "");
//截港日期
if (ds.Tables[0].Rows[0]["CLOSINGDATE"].ToString().Trim() == "")
{
tbCLOSINGDATE.Text = "";
}
else
{
tbCLOSINGDATE.Text = DateTime.Parse(ds.Tables[0].Rows[0]["CLOSINGDATE"].ToString().Trim()).ToString("yyyy-MM-dd hh:mm").Trim();
}
//截单日期
if (ds.Tables[0].Rows[0]["CLOSEDOCDATE"].ToString().Trim() == "")
{
tbCLOSEDOCDATE.Text = "";
}
else
{
tbCLOSEDOCDATE.Text = DateTime.Parse(ds.Tables[0].Rows[0]["CLOSEDOCDATE"].ToString().Trim()).ToString("yyyy-MM-dd hh:mm").Trim();
}
//出口海关
tbExportCustoms.Text = ds.Tables[0].Rows[0]["ExportCustoms"].ToString().Trim();
//海关代码
tbCustomsCode.Text = ds.Tables[0].Rows[0]["CustomsCode"].ToString().Trim();
//报关代码
tbDeclarationCode.Text = ds.Tables[0].Rows[0]["DeclarationCode"].ToString().Trim();
//备注
tbREMARK.Text = ds.Tables[0].Rows[0]["REMARK"].ToString().Trim();
//
this.hd_comboDOC.Value = ds.Tables[0].Rows[0]["DOC"].ToString().Trim();
//
tbDOCTEL.Text = ds.Tables[0].Rows[0]["DOCTEL"].ToString().Trim();
//
tbDOCFAX.Text = ds.Tables[0].Rows[0]["DOCFAX"].ToString().Trim();
//
tbDOCEMAIL.Text = ds.Tables[0].Rows[0]["DOCEMAIL"].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
{
if (ViewState["GID"].ToString().Trim() != "")
{
TopSeaeEntity = SeaExportInfoDA.GetID(ViewState["GID"].ToString().Trim());
if (TopSeaeEntity.BSNO != null)
{
tbTO.Text = T_ALL_DA.GetStrSQL("DESCRIPTION", "select DESCRIPTION from [info_client] where SHORTNAME='" + TopSeaeEntity.CUSTOMERNAME.ToString().Trim() + "'");
//
UserEntity = UserDA.GetUserAllByID(strUserID.Trim());
if (UserEntity.Gid != null)
{
tbFM.Text = UserEntity.ShowName.ToString().Trim();
tbFMTEL.Text = UserEntity.BaseInfo.OfficePhone.ToString().Trim();
tbFMFAX.Text = UserEntity.BaseInfo.FaxNum.ToString().Trim();
tbFMEMAIL.Text = UserEntity.BaseInfo.EmailAddressPrimary.ToString().Trim();
}
else
{
tbFM.Text = "";
tbFMTEL.Text = "";
tbFMFAX.Text = "";
tbFMEMAIL.Text = "";
}
//
this.hd_comboDOC.Value = TopSeaeEntity.DOC.ToString().Trim();
UserEntity = UserDA.GetUserAllBySHOWNAME(this.hd_comboDOC.Value.Trim());
if (UserEntity.Gid != null)
{
tbDOCTEL.Text = UserEntity.BaseInfo.OfficePhone.ToString().Trim();
tbDOCFAX.Text = UserEntity.BaseInfo.FaxNum.ToString().Trim();
tbDOCEMAIL.Text = UserEntity.BaseInfo.EmailAddressPrimary.ToString().Trim();
}
else
{
tbDOCTEL.Text = "";
tbDOCFAX.Text = "";
tbDOCEMAIL.Text = "";
}
//
//主提单号
tbMBLNO.Text = TopSeaeEntity.MBLNO.ToString().Trim();
//卸货港
tbPORTDISCHARGE.Text = TopSeaeEntity.PORTDISCHARGE.ToString().Trim();
//船名/航次
tbVESSELVOYNO.Text = TopSeaeEntity.VESSEL.ToString().Trim() + " V." + TopSeaeEntity.VOYNO.ToString().Trim();
if (TopSeaeEntity.VOYNO.ToString().Trim() == "")
{
tbVESSELVOYNO.Text = TopSeaeEntity.VESSEL.ToString().Trim();
}
//开船日期
if (TopSeaeEntity.ETD.ToString().Trim().IndexOf("0001")>-1)
{
tbETD.Text = "";
}
else
{
tbETD.Text = DateTime.Parse(TopSeaeEntity.ETD.ToString().Trim()).ToString("yyyy-MM-dd").Trim();
}
//件重尺
tbPKC.Text = TopSeaeEntity.PKGS.ToString().Trim() + TopSeaeEntity.KINDPKGS.ToString().Trim() + "\t |\t " + TopSeaeEntity.KGS.ToString().Trim() + "KGS\t |\t " + TopSeaeEntity.CBM.ToString().Trim() + "CBM";
//货物描述
tbDESCRIPTION.Text = TopSeaeEntity.DESCRIPTION.ToString().Trim();
//截单日期
if (TopSeaeEntity.CLOSEDOCDATE.ToString().Trim().IndexOf("0001")>-1)
{
tbCLOSEDOCDATE.Text = "";
}
else
{
tbCLOSEDOCDATE.Text = DateTime.Parse(TopSeaeEntity.CLOSEDOCDATE.ToString().Trim()).ToString("yyyy-MM-dd hh:mm").Trim();
}
//截港日期==截港日期
if (TopSeaeEntity.CLOSINGDATE.ToString().Trim().IndexOf("0001")>-1)
{
tbCLOSINGDATE.Text = "";
}
else
{
tbCLOSINGDATE.Text = DateTime.Parse(TopSeaeEntity.CLOSINGDATE.ToString().Trim()).ToString("yyyy-MM-dd hh:mm").Trim();
}
//备注
tbREMARK.Text = TopSeaeEntity.REMARK.ToString().Trim();
//箱型箱量
DataSet dss = T_ALL_DA.GetTopCtn(ViewState["GID"].ToString().Trim());
if (dss != null)
{
foreach (DataTable myTable in dss.Tables)
{
foreach (DataRow myRow in myTable.Rows)//遍历表
{
tbCNTR.Text += myRow["CTNALL"].ToString().Trim() + "*" + myRow["CTNNUM"].ToString().Trim() + " \t|\t ";
}
}
tbCNTR.Text = tbCNTR.Text.Trim().Substring(0, tbCNTR.Text.Trim().Length - 1);
}
//
//提箱场站
this.hd_comboYARD.Value = TopSeaeEntity.YARD.ToString().Trim();
//入货场站
this.hd_comboYARD2.Value = TopSeaeEntity.YARD.ToString().Trim();
DataSet ds = T_ALL_DA.GetAllSQL("select * from info_client where SHORTNAME='" + TopSeaeEntity.YARD.ToString().Trim() + "' and ISYARD=1");
if (ds != null)
{
if (ds.Tables[0].Rows.Count > 0)
{
//提箱场站地址
tbAddress.Text = ds.Tables[0].Rows[0]["ADDR"].ToString().Trim();
//提箱场站联系人
this.hd_comboCHIEF.Value = ds.Tables[0].Rows[0]["CHIEF"].ToString().Trim();
//提箱场站电话
string stel3 = ds.Tables[0].Rows[0]["Tel"].ToString().Trim();
tbTel.Text = stel3.Replace("--", "");
//入货场站地址
tbAddress2.Text = ds.Tables[0].Rows[0]["ADDR"].ToString().Trim();
//入货场站联系人
this.hd_comboCHIEF2.Value = ds.Tables[0].Rows[0]["CHIEF"].ToString().Trim();
//入货场站电话
string stel4 = ds.Tables[0].Rows[0]["Tel"].ToString().Trim();
tbTel2.Text = stel4.Replace("--", "");
}
}
}
}
else
{
}
this.imgPrint.Disabled = true;
}
}
//
if (this.hdEnter.Value == "1")
{
getEnter();
}
//加载下拉框
Page.ClientScript.RegisterStartupScript(this.GetType(), "key0", "<script>initComboATTN();initComboDOC();initComboYARD1();initComboCHIEF();initComboYARD2();initComboCHIEF21();</script>");
}
protected void getEnabled()
{
this.imgEnter.Disabled = true;
this.imgPrint.Disabled = true;
//
this.hdEnabled.Value = "false";
//
tbTO.Enabled=false;
//tbATTN.Enabled=false;
tbATTNTEL.Enabled = false;
tbATTNFAX.Enabled = false;
tbFM.Enabled=false;
tbFMTEL.Enabled=false;
tbFMFAX.Enabled=false;
tbFMEMAIL.Enabled = false;
//ddlDOC.Enabled=false;
tbMBLNO.Enabled=false;
tbPORTDISCHARGE.Enabled=false;
tbVESSELVOYNO.Enabled=false;
tbETD.Enabled=false;
tbPKC.Enabled=false;
tbCNTR.Enabled=false;
tbDESCRIPTION.Enabled=false;
//ddlYARD.Disabled = true;
tbAddress.Enabled=false;
//tbCHIEF.Enabled=false;//联系人
tbTel.Enabled=false;
//ddlYARD2.Disabled = true;
tbAddress2.Enabled=false;
//tbCHIEF2.Enabled=false;//联系人
tbTel2.Enabled=false;
tbCLOSINGDATE.Enabled=false;
tbCLOSEDOCDATE.Enabled=false;
tbExportCustoms.Enabled=false;
tbCustomsCode.Enabled=false;
tbDeclarationCode.Enabled=false;
tbREMARK.Enabled = false;
tbDOCTEL.Enabled = false;
tbDOCFAX.Enabled = false;
tbDOCEMAIL.Enabled = false;
}
protected void getEnter()
{
if (Session["handle"].ToString().Trim() != null && Session["handle"].ToString().Trim() == "edit")
{
if (Session["leid"].ToString().Trim() != null && Session["leid"].ToString().Trim() != "")
{
string alt = T_ALL_DA.GetTopLetterYardUpdate(Session["leid"].ToString().Trim(), tbTO.Text.Trim(), this.hd_comboATTN.Value.Trim(), tbATTNTEL.Text.Trim(), tbATTNFAX.Text.Trim(), tbFM.Text.Trim(), tbFMTEL.Text.Trim(), tbFMFAX.Text.Trim(), tbFMEMAIL.Text.Trim(), this.hd_comboDOC.Value.Trim(), tbMBLNO.Text.Trim(), tbPORTDISCHARGE.Text.Trim(), tbVESSELVOYNO.Text.Trim(), tbETD.Text.Trim(), tbPKC.Text.Trim(), tbCNTR.Text.Trim(), tbDESCRIPTION.Text.Trim().Replace("'", ""), this.hd_comboYARD.Value.Trim(), tbAddress.Text.Trim(), this.hd_comboCHIEF.Value.Trim(), tbTel.Text.Trim().Replace("--", ""), this.hd_comboYARD2.Value.Trim(), tbAddress2.Text.Trim(), this.hd_comboCHIEF2.Value.Trim(), tbTel2.Text.Trim(), tbCLOSINGDATE.Text.Trim(), tbCLOSEDOCDATE.Text.Trim(), tbExportCustoms.Text.Trim(), tbCustomsCode.Text.Trim(), tbDeclarationCode.Text.Trim(), tbREMARK.Text.Trim(), tbDOCTEL.Text.Trim(), tbDOCFAX.Text.Trim(), tbDOCEMAIL.Text.Trim(), strUserID.Trim());
if (alt == "")
{
if (this.hdISCLOSINGDATE.Value.Trim() == "1")
{
bool bl = T_ALL_DA.GetExecuteSqlCommand("update op_seae set CLOSINGDATE='" + tbCLOSINGDATE.Text.Trim() + "' where bsno='" + ViewState["GID"].ToString().Trim() + "'");
}
this.hdEnter.Value = "0";
Response.Write("<script>alert('更改成功!');window.opener.location.reload();history.back();</script>");
return;
}
else
{
this.hdEnter.Value = "0";
Response.Write("<script>alert('" + alt + "');history.back();</script>");
return;
}
}
}
else
{
Session["leid"] = T_ALL_DA.getSQLID("TopLetterYard");
string alt = T_ALL_DA.GetTopLetterYardInsert(Session["leid"].ToString().Trim(), ViewState["GID"].ToString().Trim(), tbTO.Text.Trim(), this.hd_comboATTN.Value.Trim(), tbATTNTEL.Text.Trim(), tbATTNFAX.Text.Trim(), tbFM.Text.Trim(), tbFMTEL.Text.Trim(), tbFMFAX.Text.Trim(), tbFMEMAIL.Text.Trim(), this.hd_comboDOC.Value.Trim(), tbMBLNO.Text.Trim(), tbPORTDISCHARGE.Text.Trim(), tbVESSELVOYNO.Text.Trim(), tbETD.Text.Trim(), tbPKC.Text.Trim(), tbCNTR.Text.Trim(), tbDESCRIPTION.Text.Trim().Replace("'", ""), this.hd_comboYARD.Value.Trim(), tbAddress.Text.Trim(), this.hd_comboCHIEF.Value.Trim(), tbTel.Text.Trim().Replace("--", ""), this.hd_comboYARD2.Value.Trim(), tbAddress2.Text.Trim(), this.hd_comboCHIEF2.Value.Trim(), tbTel2.Text.Trim(), tbCLOSINGDATE.Text.Trim(), tbCLOSEDOCDATE.Text.Trim(), tbExportCustoms.Text.Trim(), tbCustomsCode.Text.Trim(), tbDeclarationCode.Text.Trim(), tbREMARK.Text.Trim(),tbDOCTEL.Text.Trim(),tbDOCFAX.Text.Trim(),tbDOCEMAIL.Text.Trim(), strUserID.Trim());
if (alt == "")
{
if (this.hdISCLOSINGDATE.Value.Trim() == "1")
{
bool bl = T_ALL_DA.GetExecuteSqlCommand("update op_seae set CLOSINGDATE='" + tbCLOSINGDATE.Text.Trim() + "' where bsno='" + ViewState["GID"].ToString().Trim() + "'");
}
this.imgPrint.Disabled = false;
this.hdGid.Value = Session["leid"].ToString().Trim();
this.hdEnter.Value = "0";
Session["handle"] = "edit";
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>reloadParent('" + ViewState["GID"].ToString().Trim() + "','" + Session["leid"].ToString().Trim() + "');</script>");
//Response.Write("<script>alert('添加成功!');window.opener.location.reload();history.back();</script>");
return;
}
else
{
this.hdEnter.Value = "0";
Response.Write("<script>alert('" + alt + "');history.back();</script>");
return;
}
}
}
}
}