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; using System.Text.RegularExpressions; using System.ComponentModel; using System.Drawing; using System.Web.SessionState; using System.Web.Mail; using System.IO; using System.Data.OleDb; using JsonHelper; using DSWeb.Log; using DSWeb.Attributes; namespace DSWeb.SeaiInfoLCL { public partial class SeaImportLCLInfo : System.Web.UI.Page { public string strHandleType = String.Empty; public string sSQL = String.Empty; public string gvid = String.Empty; T_ALL_DA T_ALL_DA = new T_ALL_DA(); TopSeaiEntity TopSeaiEntity = new TopSeaiEntity(); SeaImportInfoDA SeaImportInfoDA = new SeaImportInfoDA(); RangeDA RangeDA = new RangeDA(); public string strdate; public string strUserID;//登录用户GID public string strCompanyID;//公司GID public string strShowName;//用户显示名 public string strDeptName;//部门名称 protected void Page_Load(object sender, EventArgs e) { if (Session["USERID"] != null) { strUserID = Session["USERID"].ToString(); this.hdUserID.Value = strUserID; } else { Server.Transfer("~/Error/FriendError.aspx"); return; //strUserID = ""; //hdUserID.Value = ""; } if (Session["SHOWNAME"] != null) { strShowName = Session["SHOWNAME"].ToString(); } if (Session["COMPANYID"] != null) { strCompanyID = Session["COMPANYID"].ToString(); this.hdCOMPANYID.Value = strCompanyID; } if (Session["DEPTNAME"] != null) { strDeptName = Session["DEPTNAME"].ToString(); } // strdate = T_ALL_DA.GetStrSQL("strdate", "select convert(char(10),getdate(),20) as strdate"); //页面是否只读 if (Request.QueryString["hdenabled"] != null) { if (Request.QueryString["hdenabled"].ToString() == "false") { this.hdEnabled.Value = Request.QueryString["hdenabled"].ToString(); getEnabled(); } else { this.hdEnabled.Value = "true"; getEnabledTrue(); } } else { this.hdEnabled.Value = "true"; getEnabledTrue(); } // if (!IsPostBack) { if (Request.QueryString["handle"] != null) { ViewState["strHandleType"] = Request.QueryString["handle"].ToString(); strHandleType = ViewState["strHandleType"].ToString().Trim(); this.hdHandle.Value = ViewState["strHandleType"].ToString().Trim(); // if (Request.QueryString["id"] != null) { ViewState["GID"] = Request.QueryString["id"].ToString(); this.hdGid.Value = ViewState["GID"].ToString().Trim(); } else { ViewState["GID"] = ""; this.hdGid.Value = ""; } switch (strHandleType) { case "add"://新增 getAddInfo(); // ibDel.Enabled = false; ibAdd.Enabled = false; ibFullAdd.Enabled = false; break; case "addfull"://新增 lbBSSTATUS.Text = "未锁定"; //"接受委托"; lbFEESTATUS.Text = "未锁定"; // TopSeaiEntity = SeaImportInfoDA.GetID(ViewState["GID"].ToString().Trim()); if (TopSeaiEntity.BSNO != null) { if (TopSeaiEntity.BSSTATUS.ToString().Trim() == "False") { lbBSSTATUS.Text = "未锁定";//"接受委托"; } else { lbBSSTATUS.Text = "锁定";//业务封帐 } if (TopSeaiEntity.FEESTATUS.ToString().Trim() == "False") { lbFEESTATUS.Text = "未锁定"; } else { lbFEESTATUS.Text = "锁定"; } // this.hd_comboCUSTOMERNAME.Value = TopSeaiEntity.CUSTOMERNAME.ToString().Trim(); this.hd_comboSTORAGENAME.Value = TopSeaiEntity.STORAGENAME.ToString().Trim(); this.hd_comboYARD.Value = TopSeaiEntity.YARD.ToString().Trim(); this.hd_comboGOODSNAME.Value = TopSeaiEntity.GOODSNAME.ToString().Trim(); this.hd_comboCUSTOMSER.Value = TopSeaiEntity.CUSTOMSER.ToString().Trim(); this.hd_comboINSPECTION.Value = TopSeaiEntity.INSPECTION.ToString().Trim(); this.hd_comboVESSEL.Value = TopSeaiEntity.VESSEL.ToString().Trim(); // tbMBLNO.Text = TopSeaiEntity.MBLNO.ToString().Trim(); tbGRADE.Text = TopSeaiEntity.GRADE.ToString().Trim(); tbCOUNTRYOFORIGIN.Text = TopSeaiEntity.COUNTRYOFORIGIN.ToString().Trim(); tbCUSTOMNO.Text = TopSeaiEntity.CUSTOMNO.ToString().Trim(); tbINSPECTIONNO.Text = TopSeaiEntity.INSPECTIONNO.ToString().Trim(); cbISFORCEDTODESPATCH.Checked = bool.Parse(TopSeaiEntity.ISFORCEDTODESPATCH.ToString().Trim()); tbACTUALKGS.Text = TopSeaiEntity.ACTUALKGS.ToString().Trim(); tbREMARK.Text = TopSeaiEntity.REMARK.ToString().Trim(); tbWATERCONTENT.Text = TopSeaiEntity.WATERCONTENT.ToString().Trim(); tbWATERDENSITY.Text = TopSeaiEntity.WATERDENSITY.ToString().Trim(); // if (TopSeaiEntity.CUSTOMDATE.ToString().Trim().IndexOf("0001") > -1) { tbCUSTOMDATE.Text = ""; } else { tbCUSTOMDATE.Text = TopSeaiEntity.CUSTOMDATE.ToString("yyyy-MM-dd").Trim();//.Substring(0,10); } // if (TopSeaiEntity.INSPECTIONDATE.ToString().Trim().IndexOf("0001") > -1) { tbINSPECTIONDATE.Text = "";// strdate; } else { tbINSPECTIONDATE.Text = TopSeaiEntity.INSPECTIONDATE.ToString("yyyy-MM-dd").Trim();//.Substring(0,10); } // if (TopSeaiEntity.NOR.ToString().Trim().IndexOf("0001") > -1) { tbNOR.Text = "";// strdate; } else { tbNOR.Text = TopSeaiEntity.NOR.ToString("yyyy-MM-dd hh:mm").Trim();//.Substring(0,10); } // tbBSKGS.Text = TopSeaiEntity.BSKGS.ToString().Trim(); tbACTUALKGS.Text = TopSeaiEntity.ACTUALKGS.ToString().Trim(); tbDRAFTKGS.Text = TopSeaiEntity.DRAFTKGS.ToString().Trim(); tbWHARFSKGS.Text = TopSeaiEntity.WHARFSKGS.ToString().Trim(); tbWMSINKGS.Text = TopSeaiEntity.WMSINKGS.ToString().Trim(); tbWMSOUTKGS.Text = TopSeaiEntity.WMSOUTKGS.ToString().Trim(); tbDIFFERENCEKGS.Text = TopSeaiEntity.DIFFERENCEKGS.ToString().Trim(); ddlUNITOFWEIGHT0.SelectedValue = TopSeaiEntity.UNITOFWEIGHT.ToString().Trim(); ddlUNITOFWEIGHT1.SelectedValue = TopSeaiEntity.UNITOFWEIGHT.ToString().Trim(); ddlUNITOFWEIGHT2.SelectedValue = TopSeaiEntity.UNITOFWEIGHT.ToString().Trim(); ddlUNITOFWEIGHT3.SelectedValue = TopSeaiEntity.UNITOFWEIGHT.ToString().Trim(); ddlUNITOFWEIGHT4.SelectedValue = TopSeaiEntity.UNITOFWEIGHT.ToString().Trim(); ddlUNITOFWEIGHT5.SelectedValue = TopSeaiEntity.UNITOFWEIGHT.ToString().Trim(); ddlUNITOFWEIGHT6.SelectedValue = TopSeaiEntity.UNITOFWEIGHT.ToString().Trim(); // ViewState["GID"] = ""; this.hdGid.Value = ""; // ibDel.Enabled = false; ibAdd.Enabled = false; ibFullAdd.Enabled = false; } break; case "edit"://录入 lbBSSTATUS.Text = "未锁定"; //"接受委托"; lbFEESTATUS.Text = "未锁定"; // TopSeaiEntity = SeaImportInfoDA.GetID(ViewState["GID"].ToString().Trim()); if (TopSeaiEntity.BSNO != null) { if (TopSeaiEntity.BSSTATUS.ToString().Trim() == "False") { lbBSSTATUS.Text = "未锁定";//"接受委托"; } else { lbBSSTATUS.Text = "锁定";//业务封帐 } if (TopSeaiEntity.FEESTATUS.ToString().Trim() == "False") { lbFEESTATUS.Text = "未锁定"; } else { lbFEESTATUS.Text = "锁定"; } // this.hd_comboCUSTOMERNAME.Value = TopSeaiEntity.CUSTOMERNAME.ToString().Trim(); this.hd_comboSTORAGENAME.Value = TopSeaiEntity.STORAGENAME.ToString().Trim(); this.hd_comboYARD.Value = TopSeaiEntity.YARD.ToString().Trim(); this.hd_comboGOODSNAME.Value = TopSeaiEntity.GOODSNAME.ToString().Trim(); this.hd_comboCUSTOMSER.Value = TopSeaiEntity.CUSTOMSER.ToString().Trim(); this.hd_comboINSPECTION.Value = TopSeaiEntity.INSPECTION.ToString().Trim(); this.hd_comboVESSEL.Value = TopSeaiEntity.VESSEL.ToString().Trim(); // tbMBLNO.Text = TopSeaiEntity.MBLNO.ToString().Trim(); tbGRADE.Text = TopSeaiEntity.GRADE.ToString().Trim(); tbCOUNTRYOFORIGIN.Text = TopSeaiEntity.COUNTRYOFORIGIN.ToString().Trim(); tbCUSTOMNO.Text = TopSeaiEntity.CUSTOMNO.ToString().Trim(); tbINSPECTIONNO.Text = TopSeaiEntity.INSPECTIONNO.ToString().Trim(); cbISFORCEDTODESPATCH.Checked = bool.Parse(TopSeaiEntity.ISFORCEDTODESPATCH.ToString().Trim()); tbACTUALKGS.Text = TopSeaiEntity.ACTUALKGS.ToString().Trim(); tbREMARK.Text = TopSeaiEntity.REMARK.ToString().Trim(); tbWATERCONTENT.Text = TopSeaiEntity.WATERCONTENT.ToString().Trim(); tbWATERDENSITY.Text = TopSeaiEntity.WATERDENSITY.ToString().Trim(); // if (TopSeaiEntity.CUSTOMDATE.ToString().Trim().IndexOf("0001") > -1) { tbCUSTOMDATE.Text = ""; } else { tbCUSTOMDATE.Text = TopSeaiEntity.CUSTOMDATE.ToString("yyyy-MM-dd").Trim();//.Substring(0,10); } // if (TopSeaiEntity.INSPECTIONDATE.ToString().Trim().IndexOf("0001") > -1) { tbINSPECTIONDATE.Text = "";// strdate; } else { tbINSPECTIONDATE.Text = TopSeaiEntity.INSPECTIONDATE.ToString("yyyy-MM-dd").Trim();//.Substring(0,10); } // if (TopSeaiEntity.NOR.ToString().Trim().IndexOf("0001") > -1) { tbNOR.Text = "";// strdate; } else { tbNOR.Text = TopSeaiEntity.NOR.ToString("yyyy-MM-dd hh:mm").Trim();//.Substring(0,10); } // tbBSKGS.Text = TopSeaiEntity.BSKGS.ToString().Trim(); tbACTUALKGS.Text = TopSeaiEntity.ACTUALKGS.ToString().Trim(); tbDRAFTKGS.Text = TopSeaiEntity.DRAFTKGS.ToString().Trim(); tbWHARFSKGS.Text = TopSeaiEntity.WHARFSKGS.ToString().Trim(); tbWMSINKGS.Text = TopSeaiEntity.WMSINKGS.ToString().Trim(); tbWMSOUTKGS.Text = TopSeaiEntity.WMSOUTKGS.ToString().Trim(); tbDIFFERENCEKGS.Text = TopSeaiEntity.DIFFERENCEKGS.ToString().Trim(); ddlUNITOFWEIGHT0.SelectedValue = TopSeaiEntity.UNITOFWEIGHT.ToString().Trim(); ddlUNITOFWEIGHT1.SelectedValue = TopSeaiEntity.UNITOFWEIGHT.ToString().Trim(); ddlUNITOFWEIGHT2.SelectedValue = TopSeaiEntity.UNITOFWEIGHT.ToString().Trim(); ddlUNITOFWEIGHT3.SelectedValue = TopSeaiEntity.UNITOFWEIGHT.ToString().Trim(); ddlUNITOFWEIGHT4.SelectedValue = TopSeaiEntity.UNITOFWEIGHT.ToString().Trim(); ddlUNITOFWEIGHT5.SelectedValue = TopSeaiEntity.UNITOFWEIGHT.ToString().Trim(); ddlUNITOFWEIGHT6.SelectedValue = TopSeaiEntity.UNITOFWEIGHT.ToString().Trim(); // //业务状态的颜色值 string str = T_ALL_DA.GetTCodeBsstatus("海运进口", TopSeaiEntity.BSSTATUS); int a = 0; int b = 0; int c = 0; int d = 0; int f = 0; if (str != "" && str != null) { d = str.IndexOf(","); f = str.LastIndexOf(","); a = int.Parse(str.Substring(0, d)); b = int.Parse(str.Substring((d + 1), (f - (d + 1)))); c = int.Parse(str.Substring((f + 1), (str.Length - (f + 1)))); lbBSSTATUS.BackColor = System.Drawing.Color.FromArgb(a, b, c); } //费用状态的颜色值 str = T_ALL_DA.GetTCodeFeeColor(lbFEESTATUS.Text.Trim()); if (str != "" && str != null) { d = str.IndexOf(","); f = str.LastIndexOf(","); a = int.Parse(str.Substring(0, d)); b = int.Parse(str.Substring((d + 1), (f - (d + 1)))); c = int.Parse(str.Substring((f + 1), (str.Length - (f + 1)))); lbBSSTATUS.BackColor = System.Drawing.Color.FromArgb(a, b, c); } } // if (this.hdEnabled.Value == "true") { ibDel.Enabled = true; ibAdd.Enabled = true; ibFullAdd.Enabled = true; } break; } } else { } // if (this.hdEnabled.Value == "true") { //权限可视范围 if (strHandleType.Trim() == "edit") { string strV = RangeDA.GetVISIBLERANGE(this.hdUserID.Value.Trim(), "modSeaImportLCLList");//海运进口散货委托管理列表 string strO = RangeDA.GetOPERATERANGE(this.hdUserID.Value.Trim(), "modSeaImportLCLList");//海运进口散货委托管理列表 string alt = ""; if (strV.Trim() != strO.Trim()) { if (strO.Trim().Equals("0"))//全部 { } else if (strO.Trim().Equals("1"))//分公司 { alt = RangeDA.GetSeaImportLCLListCompany(this.hdUserID.Value.Trim(), ViewState["GID"].ToString().Trim()); if (alt == "") { getEnabled(); } ibAdd.Enabled = true; ibFullAdd.Enabled = true; } else if (strO.Trim().Equals("2"))//部门 { alt = RangeDA.GetSeaImportLCLListDEPT(this.hdUserID.Value.Trim(), ViewState["GID"].ToString().Trim()); if (alt == "") { getEnabled(); } ibAdd.Enabled = true; ibFullAdd.Enabled = true; } else if (strO.Trim().Equals("3"))//个人 { alt = RangeDA.GetSeaImportLCLListPerson(this.hdUserID.Value.Trim(), ViewState["GID"].ToString().Trim()); if (alt == "") { getEnabled(); } ibAdd.Enabled = true; ibFullAdd.Enabled = true; } else if (strO.Trim().Equals("4"))//无 { getEnabled(); } } } else { getEnabledTrue(); } } // } //保存 if (this.hdEnter.Value == "0") { getEnter(); } //加载下拉框 // Page.ClientScript.RegisterStartupScript(this.GetType(), "key0", ""); } protected void getEnabled() { ibAdd.Enabled = false; ibFullAdd.Enabled = false; this.ibEnter.Disabled = true; this.imgFresh.Disabled = true; ibDel.Enabled = false; this.ibPrint.Disabled = true; // this.hdEnabled.Value = "false"; //this.hd_comboCUSTOMERNAME.Value = ""; //this.hd_comboSTORAGENAME.Value = ""; //this.hd_comboYARD.Value = ""; //this.hd_comboGOODSNAME.Value = ""; //this.hd_comboCUSTOMSER.Value = ""; //this.hd_comboINSPECTION.Value = ""; //this.hd_comboVESSEL.Value = ""; // tbMBLNO.Enabled = false; tbGRADE.Enabled = false; tbCOUNTRYOFORIGIN.Enabled = false; tbCUSTOMNO.Enabled = false; tbCUSTOMDATE.Enabled = false; tbINSPECTIONNO.Enabled = false; tbINSPECTIONDATE.Enabled = false; tbNOR.Enabled = false; cbISFORCEDTODESPATCH.Enabled = false; tbACTUALKGS.Enabled = false; tbREMARK.Enabled = false; tbWATERCONTENT.Enabled = false; tbWATERDENSITY.Enabled = false; // tbBSKGS.Enabled = false; tbBSKGS.Enabled = false; tbACTUALKGS.Enabled = false; tbDRAFTKGS.Enabled = false; tbWHARFSKGS.Enabled = false; tbWMSINKGS.Enabled = false; tbWMSOUTKGS.Enabled = false; tbDIFFERENCEKGS.Enabled = false; ddlUNITOFWEIGHT0.Enabled = false; ddlUNITOFWEIGHT1.Enabled = false; ddlUNITOFWEIGHT2.Enabled = false; ddlUNITOFWEIGHT3.Enabled = false; ddlUNITOFWEIGHT4.Enabled = false; ddlUNITOFWEIGHT5.Enabled = false; ddlUNITOFWEIGHT6.Enabled = false; } protected void getEnabledTrue() { ibAdd.Enabled = true; ibFullAdd.Enabled = true; this.ibEnter.Disabled = false; this.imgFresh.Disabled = false; ibDel.Enabled = true; this.ibPrint.Disabled = false; // this.hdEnabled.Value = "true"; //this.hd_comboCUSTOMERNAME.Value = ""; //this.hd_comboSTORAGENAME.Value = ""; //this.hd_comboYARD.Value = ""; //this.hd_comboGOODSNAME.Value = ""; //this.hd_comboCUSTOMSER.Value = ""; //this.hd_comboINSPECTION.Value = ""; //this.hd_comboVESSEL.Value = ""; // tbMBLNO.Enabled = true; tbGRADE.Enabled = true; tbCOUNTRYOFORIGIN.Enabled = true; tbCUSTOMNO.Enabled = true; tbCUSTOMDATE.Enabled = true; tbINSPECTIONNO.Enabled = true; tbINSPECTIONDATE.Enabled = true; tbNOR.Enabled = true; cbISFORCEDTODESPATCH.Enabled = true; tbACTUALKGS.Enabled = true; tbREMARK.Enabled = true; tbWATERCONTENT.Enabled = true; tbWATERDENSITY.Enabled = true; // tbBSKGS.Enabled = true; tbBSKGS.Enabled = true; tbACTUALKGS.Enabled = true; tbDRAFTKGS.Enabled = true; tbWHARFSKGS.Enabled = true; tbWMSINKGS.Enabled = true; tbWMSOUTKGS.Enabled = true; tbDIFFERENCEKGS.Enabled = true; ddlUNITOFWEIGHT0.Enabled = true; ddlUNITOFWEIGHT1.Enabled = true; ddlUNITOFWEIGHT2.Enabled = true; ddlUNITOFWEIGHT3.Enabled = true; ddlUNITOFWEIGHT4.Enabled = true; ddlUNITOFWEIGHT5.Enabled = true; ddlUNITOFWEIGHT6.Enabled = true; } protected String getBSNO() { string strBSNO = Guid.NewGuid().ToString(); strBSNO = strBSNO.Replace("-", ""); strBSNO = "topseailcl" + strBSNO; return strBSNO; } protected bool getAdd() { ViewState["GID"] = getBSNO(); this.hdGid.Value = ViewState["GID"].ToString().Trim(); // TopSeaiEntity.BSNO = ViewState["GID"].ToString().Trim(); TopSeaiEntity.MASTERNO = ViewState["GID"].ToString().Trim(); if (lbBSSTATUS.Text.Trim() == "未锁定")//"接受委托") { TopSeaiEntity.BSSTATUS = false; } else { TopSeaiEntity.BSSTATUS = true; } if (lbFEESTATUS.Text.Trim() == "未锁定") { TopSeaiEntity.FEESTATUS = false; } else { TopSeaiEntity.FEESTATUS = true; } TopSeaiEntity.ORDERTYPE = "操作录入"; TopSeaiEntity.MBLNO = tbMBLNO.Text.Trim(); TopSeaiEntity.VESSEL = this.hd_comboVESSEL.Value.Trim(); TopSeaiEntity.CUSTOMERNAME = this.hd_comboCUSTOMERNAME.Value.Trim(); TopSeaiEntity.GOODSNAME = this.hd_comboGOODSNAME.Value.Trim(); TopSeaiEntity.INPUTBY = strShowName; TopSeaiEntity.CUSTOMSER = this.hd_comboCUSTOMSER.Value.Trim(); TopSeaiEntity.INSPECTION = this.hd_comboINSPECTION.Value.Trim(); TopSeaiEntity.CORPID = this.hdCOMPANYID.Value; TopSeaiEntity.COUNTRYOFORIGIN = tbCOUNTRYOFORIGIN.Text.Trim(); TopSeaiEntity.CUSTOMNO = tbCUSTOMNO.Text.Trim(); TopSeaiEntity.INSPECTIONNO = tbINSPECTIONNO.Text.Trim(); TopSeaiEntity.UNITOFWEIGHT = ddlUNITOFWEIGHT0.SelectedValue.ToString().Trim(); // TopSeaiEntity.YARD = this.hd_comboYARD.Value.Trim(); TopSeaiEntity.STORAGENAME = this.hd_comboSTORAGENAME.Value.Trim(); TopSeaiEntity.CUSTOMDATE = tbCUSTOMDATE.Text.Trim() == "" ? DateTime.Parse("0001-01-01") : DateTime.Parse(tbCUSTOMDATE.Text.Trim()); TopSeaiEntity.INSPECTIONDATE = tbINSPECTIONDATE.Text.Trim() == "" ? DateTime.Parse("0001-01-01") : DateTime.Parse(tbINSPECTIONDATE.Text.Trim()); TopSeaiEntity.NOR = tbNOR.Text.Trim() == "" ? DateTime.Parse("0001-01-01") : DateTime.Parse(tbNOR.Text.Trim()); TopSeaiEntity.ISFORCEDTODESPATCH = cbISFORCEDTODESPATCH.Checked; TopSeaiEntity.GRADE = tbGRADE.Text.Trim(); TopSeaiEntity.REMARK = tbREMARK.Text.Trim(); TopSeaiEntity.WATERCONTENT = tbWATERCONTENT.Text.Trim(); TopSeaiEntity.WATERDENSITY = tbWATERCONTENT.Text.Trim(); // Decimal sBSKGS = 0; if (tbBSKGS.Text.Trim() == "" || tbBSKGS.Text.Trim() == "0" || tbBSKGS.Text.Trim() == "0.0000") { TopSeaiEntity.BSKGS = 0; } else { TopSeaiEntity.BSKGS = Decimal.Parse(Decimal.Parse(tbBSKGS.Text.Trim()).ToString("#.####")); sBSKGS = Decimal.Parse(Decimal.Parse(tbBSKGS.Text.Trim()).ToString("#.####")); } // Decimal sACTUALKGS = 0; if (tbACTUALKGS.Text.Trim() == "" || tbACTUALKGS.Text.Trim() == "0" || tbACTUALKGS.Text.Trim() == "0.0000") { TopSeaiEntity.ACTUALKGS = 0; } else { TopSeaiEntity.ACTUALKGS = Decimal.Parse(Decimal.Parse(tbACTUALKGS.Text.Trim()).ToString("#.####")); sACTUALKGS = Decimal.Parse(Decimal.Parse(tbACTUALKGS.Text.Trim()).ToString("#.####")); } // Decimal sDRAFTKGS = 0; if (tbDRAFTKGS.Text.Trim() == "" || tbDRAFTKGS.Text.Trim() == "0" || tbDRAFTKGS.Text.Trim() == "0.0000") { TopSeaiEntity.DRAFTKGS = 0; } else { TopSeaiEntity.DRAFTKGS = Decimal.Parse(Decimal.Parse(tbDRAFTKGS.Text.Trim()).ToString("#.####")); sDRAFTKGS = Decimal.Parse(Decimal.Parse(tbDRAFTKGS.Text.Trim()).ToString("#.####")); } // Decimal sWHARFSKGS = 0; if (tbWHARFSKGS.Text.Trim() == "" || tbWHARFSKGS.Text.Trim() == "0" || tbWHARFSKGS.Text.Trim() == "0.0000") { TopSeaiEntity.WHARFSKGS = 0; } else { TopSeaiEntity.WHARFSKGS = Decimal.Parse(Decimal.Parse(tbWHARFSKGS.Text.Trim()).ToString("#.####")); sWHARFSKGS = Decimal.Parse(Decimal.Parse(tbWHARFSKGS.Text.Trim()).ToString("#.####")); } // Decimal sWMSINKGS = 0; if (tbWMSINKGS.Text.Trim() == "" || tbWMSINKGS.Text.Trim() == "0" || tbWMSINKGS.Text.Trim() == "0.0000") { TopSeaiEntity.WMSINKGS = 0; } else { TopSeaiEntity.WMSINKGS = Decimal.Parse(Decimal.Parse(tbWMSINKGS.Text.Trim()).ToString("#.####")); sWMSINKGS = Decimal.Parse(Decimal.Parse(tbWMSINKGS.Text.Trim()).ToString("#.####")); } // Decimal sWMSOUTKGS = 0; if (tbWMSOUTKGS.Text.Trim() == "" || tbWMSOUTKGS.Text.Trim() == "0" || tbWMSOUTKGS.Text.Trim() == "0.0000") { TopSeaiEntity.WMSOUTKGS = 0; } else { TopSeaiEntity.WMSOUTKGS = Decimal.Parse(Decimal.Parse(tbWMSOUTKGS.Text.Trim()).ToString("#.####")); sWMSOUTKGS = Decimal.Parse(Decimal.Parse(tbWMSOUTKGS.Text.Trim()).ToString("#.####")); } // Decimal sDIFFERENCEKGS = 0; if (tbDIFFERENCEKGS.Text.Trim() == "" || tbDIFFERENCEKGS.Text.Trim() == "0" || tbDIFFERENCEKGS.Text.Trim() == "0.0000") { TopSeaiEntity.DIFFERENCEKGS = 0; } else { TopSeaiEntity.DIFFERENCEKGS = Decimal.Parse(Decimal.Parse(tbDIFFERENCEKGS.Text.Trim()).ToString("#.####")); sDIFFERENCEKGS = Decimal.Parse(Decimal.Parse(tbDIFFERENCEKGS.Text.Trim()).ToString("#.####")); } // TopSeaiEntity.ACCDATE = ""; TopSeaiEntity.HBLNO = ""; TopSeaiEntity.CUSTNO = ""; TopSeaiEntity.VOYNO = ""; TopSeaiEntity.PORTLOADID = ""; TopSeaiEntity.PORTLOAD = ""; TopSeaiEntity.PORTDISCHARGEID = ""; TopSeaiEntity.PORTDISCHARGE = ""; TopSeaiEntity.OP = ""; TopSeaiEntity.CUSTSERVICE = ""; TopSeaiEntity.SALE = ""; TopSeaiEntity.BSSOURCE = ""; TopSeaiEntity.BSSOURCEDETAIL = ""; TopSeaiEntity.CONTRACTNO = ""; TopSeaiEntity.SALEDEPT = ""; TopSeaiEntity.NUMBERPLATE = ""; TopSeaiEntity.BALES = ""; TopSeaiEntity.KGS = 0; TopSeaiEntity.NETWEIGHT = 0; // TopSeaiEntity.CNTRNO = ""; TopSeaiEntity.CNTR1 = 0; TopSeaiEntity.CNTR2 = 0; TopSeaiEntity.CNTR3 = 0; TopSeaiEntity.CNTR4 = 0; TopSeaiEntity.CNTR5 = 0; TopSeaiEntity.CNTR6 = 0; TopSeaiEntity.CNTR7 = 0; TopSeaiEntity.CNTR8 = 0; TopSeaiEntity.CNTR9 = 0; TopSeaiEntity.CNTR10 = 0; TopSeaiEntity.OTCNTR = 0; TopSeaiEntity.TEU = 0; TopSeaiEntity.CNTRTOTAL = ""; TopSeaiEntity.BSDATE = DateTime.Parse("0001-01-01"); TopSeaiEntity.ETD = DateTime.Parse("0001-01-01"); TopSeaiEntity.BMDDATE = DateTime.Parse("0001-01-01"); TopSeaiEntity.TARRIFSPAIEDTIEM = DateTime.Parse("0001-01-01"); TopSeaiEntity.FBP = 0; TopSeaiEntity.PKGS = 0; TopSeaiEntity.MT = 0; TopSeaiEntity.KINDPKGS = ""; TopSeaiEntity.TRADINGAGENCY = ""; TopSeaiEntity.GOODSTYPENAME = ""; TopSeaiEntity.TRADETYPE = ""; TopSeaiEntity.SHOWNAME = ""; TopSeaiEntity.TEL = ""; TopSeaiEntity.FAX = ""; TopSeaiEntity.EMAIL = ""; TopSeaiEntity.APPROVENO = ""; TopSeaiEntity.BLTYPE = ""; // int iResult = SeaImportInfoDA.InserInfo(TopSeaiEntity, strUserID); if (iResult > 0) { return true; } else { return false; } } protected bool getEdit() { TopSeaiEntity.BSNO = ViewState["GID"].ToString().Trim(); TopSeaiEntity.MBLNO = tbMBLNO.Text.Trim(); TopSeaiEntity.VESSEL = this.hd_comboVESSEL.Value.Trim(); TopSeaiEntity.CUSTOMERNAME = this.hd_comboCUSTOMERNAME.Value.Trim(); TopSeaiEntity.GOODSNAME = this.hd_comboGOODSNAME.Value.Trim(); TopSeaiEntity.INPUTBY = strShowName; TopSeaiEntity.CUSTOMSER = this.hd_comboCUSTOMSER.Value.Trim(); TopSeaiEntity.INSPECTION = this.hd_comboINSPECTION.Value.Trim(); TopSeaiEntity.CORPID = this.hdCOMPANYID.Value; TopSeaiEntity.COUNTRYOFORIGIN = tbCOUNTRYOFORIGIN.Text.Trim(); TopSeaiEntity.CUSTOMNO = tbCUSTOMNO.Text.Trim(); TopSeaiEntity.INSPECTIONNO = tbINSPECTIONNO.Text.Trim(); TopSeaiEntity.UNITOFWEIGHT = ddlUNITOFWEIGHT0.SelectedValue.ToString().Trim(); // TopSeaiEntity.YARD = this.hd_comboYARD.Value.Trim(); TopSeaiEntity.STORAGENAME = this.hd_comboSTORAGENAME.Value.Trim(); TopSeaiEntity.CUSTOMDATE = tbCUSTOMDATE.Text.Trim() == "" ? DateTime.Parse("0001-01-01") : DateTime.Parse(tbCUSTOMDATE.Text.Trim()); TopSeaiEntity.INSPECTIONDATE = tbINSPECTIONDATE.Text.Trim() == "" ? DateTime.Parse("0001-01-01") : DateTime.Parse(tbINSPECTIONDATE.Text.Trim()); TopSeaiEntity.NOR = tbNOR.Text.Trim() == "" ? DateTime.Parse("0001-01-01") : DateTime.Parse(tbNOR.Text.Trim()); TopSeaiEntity.ISFORCEDTODESPATCH = cbISFORCEDTODESPATCH.Checked; TopSeaiEntity.GRADE = tbGRADE.Text.Trim(); TopSeaiEntity.REMARK = tbREMARK.Text.Trim(); TopSeaiEntity.WATERCONTENT = tbWATERCONTENT.Text.Trim(); TopSeaiEntity.WATERDENSITY = tbWATERCONTENT.Text.Trim(); // Decimal sBSKGS = 0; if (tbBSKGS.Text.Trim() == "" || tbBSKGS.Text.Trim() == "0" || tbBSKGS.Text.Trim() == "0.0000") { TopSeaiEntity.BSKGS = 0; } else { TopSeaiEntity.BSKGS = Decimal.Parse(Decimal.Parse(tbBSKGS.Text.Trim()).ToString("#.####")); sBSKGS = Decimal.Parse(Decimal.Parse(tbBSKGS.Text.Trim()).ToString("#.####")); } // Decimal sACTUALKGS = 0; if (tbACTUALKGS.Text.Trim() == "" || tbACTUALKGS.Text.Trim() == "0" || tbACTUALKGS.Text.Trim() == "0.0000") { TopSeaiEntity.ACTUALKGS = 0; } else { TopSeaiEntity.ACTUALKGS = Decimal.Parse(Decimal.Parse(tbACTUALKGS.Text.Trim()).ToString("#.####")); sACTUALKGS = Decimal.Parse(Decimal.Parse(tbACTUALKGS.Text.Trim()).ToString("#.####")); } // Decimal sDRAFTKGS = 0; if (tbDRAFTKGS.Text.Trim() == "" || tbDRAFTKGS.Text.Trim() == "0" || tbDRAFTKGS.Text.Trim() == "0.0000") { TopSeaiEntity.DRAFTKGS = 0; } else { TopSeaiEntity.DRAFTKGS = Decimal.Parse(Decimal.Parse(tbDRAFTKGS.Text.Trim()).ToString("#.####")); sDRAFTKGS = Decimal.Parse(Decimal.Parse(tbDRAFTKGS.Text.Trim()).ToString("#.####")); } // Decimal sWHARFSKGS = 0; if (tbWHARFSKGS.Text.Trim() == "" || tbWHARFSKGS.Text.Trim() == "0" || tbWHARFSKGS.Text.Trim() == "0.0000") { TopSeaiEntity.WHARFSKGS = 0; } else { TopSeaiEntity.WHARFSKGS = Decimal.Parse(Decimal.Parse(tbWHARFSKGS.Text.Trim()).ToString("#.####")); sWHARFSKGS = Decimal.Parse(Decimal.Parse(tbWHARFSKGS.Text.Trim()).ToString("#.####")); } // Decimal sWMSINKGS = 0; if (tbWMSINKGS.Text.Trim() == "" || tbWMSINKGS.Text.Trim() == "0" || tbWMSINKGS.Text.Trim() == "0.0000") { TopSeaiEntity.WMSINKGS = 0; } else { TopSeaiEntity.WMSINKGS = Decimal.Parse(Decimal.Parse(tbWMSINKGS.Text.Trim()).ToString("#.####")); sWMSINKGS = Decimal.Parse(Decimal.Parse(tbWMSINKGS.Text.Trim()).ToString("#.####")); } // Decimal sWMSOUTKGS = 0; if (tbWMSOUTKGS.Text.Trim() == "" || tbWMSOUTKGS.Text.Trim() == "0" || tbWMSOUTKGS.Text.Trim() == "0.0000") { TopSeaiEntity.WMSOUTKGS = 0; } else { TopSeaiEntity.WMSOUTKGS = Decimal.Parse(Decimal.Parse(tbWMSOUTKGS.Text.Trim()).ToString("#.####")); sWMSOUTKGS = Decimal.Parse(Decimal.Parse(tbWMSOUTKGS.Text.Trim()).ToString("#.####")); } // Decimal sDIFFERENCEKGS = 0; if (tbDIFFERENCEKGS.Text.Trim() == "" || tbDIFFERENCEKGS.Text.Trim() == "0" || tbDIFFERENCEKGS.Text.Trim() == "0.0000") { TopSeaiEntity.DIFFERENCEKGS = 0; } else { TopSeaiEntity.DIFFERENCEKGS = Decimal.Parse(Decimal.Parse(tbDIFFERENCEKGS.Text.Trim()).ToString("#.####")); sDIFFERENCEKGS = Decimal.Parse(Decimal.Parse(tbDIFFERENCEKGS.Text.Trim()).ToString("#.####")); } // TopSeaiEntity.ACCDATE = ""; TopSeaiEntity.HBLNO = ""; TopSeaiEntity.CUSTNO = ""; TopSeaiEntity.VOYNO = ""; TopSeaiEntity.PORTLOADID = ""; TopSeaiEntity.PORTLOAD = ""; TopSeaiEntity.PORTDISCHARGEID = ""; TopSeaiEntity.PORTDISCHARGE = ""; TopSeaiEntity.OP = ""; TopSeaiEntity.CUSTSERVICE = ""; TopSeaiEntity.SALE = ""; TopSeaiEntity.BSSOURCE = ""; TopSeaiEntity.BSSOURCEDETAIL = ""; TopSeaiEntity.CONTRACTNO = ""; TopSeaiEntity.SALEDEPT = ""; TopSeaiEntity.NUMBERPLATE = ""; TopSeaiEntity.BALES = ""; TopSeaiEntity.KGS = 0; TopSeaiEntity.NETWEIGHT = 0; // TopSeaiEntity.CNTRNO = ""; TopSeaiEntity.CNTR1 = 0; TopSeaiEntity.CNTR2 = 0; TopSeaiEntity.CNTR3 = 0; TopSeaiEntity.CNTR4 = 0; TopSeaiEntity.CNTR5 = 0; TopSeaiEntity.CNTR6 = 0; TopSeaiEntity.CNTR7 = 0; TopSeaiEntity.CNTR8 = 0; TopSeaiEntity.CNTR9 = 0; TopSeaiEntity.CNTR10 = 0; TopSeaiEntity.OTCNTR = 0; TopSeaiEntity.TEU = 0; TopSeaiEntity.CNTRTOTAL = ""; TopSeaiEntity.BSDATE = DateTime.Parse("0001-01-01"); TopSeaiEntity.ETD = DateTime.Parse("0001-01-01"); TopSeaiEntity.BMDDATE = DateTime.Parse("0001-01-01"); TopSeaiEntity.TARRIFSPAIEDTIEM = DateTime.Parse("0001-01-01"); TopSeaiEntity.FBP = 0; TopSeaiEntity.PKGS = 0; TopSeaiEntity.MT = 0; TopSeaiEntity.KINDPKGS = ""; TopSeaiEntity.TRADINGAGENCY = ""; TopSeaiEntity.GOODSTYPENAME = ""; TopSeaiEntity.TRADETYPE = ""; TopSeaiEntity.SHOWNAME = ""; TopSeaiEntity.TEL = ""; TopSeaiEntity.FAX = ""; TopSeaiEntity.EMAIL = ""; TopSeaiEntity.APPROVENO = ""; TopSeaiEntity.BLTYPE = ""; // int iResult = SeaImportInfoDA.UpdateInfo(TopSeaiEntity, strUserID); if (iResult > 0) { return true; } else { return false; } } protected void getEnter() { bool bl = false; string alt = ""; strHandleType = ViewState["strHandleType"].ToString(); this.hdHandle.Value = ViewState["strHandleType"].ToString().Trim(); if (strHandleType.Equals("add"))//新增 { alt = T_ALL_DA.GetStrSQL("VESSEL", "select VESSEL from [op_seai] where VESSEL='" + this.hd_comboVESSEL.Value.Trim() + "' and bsno like 'topseailcl%'"); if (alt.Trim() != "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", ""); return; } // bl = getAdd(); } else if (strHandleType.Equals("addfull"))//新增 { alt = T_ALL_DA.GetStrSQL("VESSEL", "select VESSEL from [op_seai] where VESSEL='" + this.hd_comboVESSEL.Value.Trim() + "' and bsno like 'topseailcl%'"); if (alt.Trim() != "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", ""); return; } // bl = getAdd(); } else if (strHandleType.Equals("edit"))//录入 { alt = T_ALL_DA.GetStrSQL("VESSEL", "select VESSEL from [op_seai] where VESSEL='" + this.hd_comboVESSEL.Value.Trim() + "' and bsno like 'topseailcl%' and bsno<>'" + ViewState["GID"].ToString().Trim() + "'"); if (alt.Trim() != "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", ""); return; } // bl = getEdit(); } this.hdEnter.Value = "1"; // if (bl) { // ibDel.Enabled = true; ibAdd.Enabled = true; ibFullAdd.Enabled = true; // Page.ClientScript.RegisterStartupScript(this.GetType(), "key7", ""); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "key8", ""); } } protected void ibEnter_Click(object sender, EventArgs e) { bool bl = false; strHandleType = ViewState["strHandleType"].ToString(); this.hdHandle.Value = ViewState["strHandleType"].ToString().Trim(); if (strHandleType.Equals("add"))//新增 { bl = getAdd(); } else if (strHandleType.Equals("addfull"))//新增 { bl = getAdd(); } else if (strHandleType.Equals("edit"))//录入 { bl = getEdit(); } // if (bl) { ibDel.Enabled = true; ibAdd.Enabled = true; ibFullAdd.Enabled = true; // this.hdEnter.Value = "1"; } else { this.hdEnter.Value = "0"; } } protected void ibFullAdd_Click(object sender, EventArgs e) { ViewState["strHandleType"] = "addfull"; this.hdHandle.Value = ViewState["strHandleType"].ToString().Trim(); ViewState["GID"] = ""; this.hdGid.Value = ""; // lbBSSTATUS.Text = "未锁定"; //"接受委托"; lbFEESTATUS.Text = "未锁定"; // ibDel.Enabled = false; ibAdd.Enabled = false; ibFullAdd.Enabled = false; } protected void ibAdd_Click(object sender, EventArgs e) { ViewState["strHandleType"] = "add"; this.hdHandle.Value = ViewState["strHandleType"].ToString().Trim(); ViewState["GID"] = ""; this.hdGid.Value = ""; getAddInfo(); // ibDel.Enabled = false; ibAdd.Enabled = false; ibFullAdd.Enabled = false; } public void getAddInfo() { lbBSSTATUS.Text = "未锁定"; //"接受委托"; lbFEESTATUS.Text = "未锁定"; // this.hd_comboCUSTOMERNAME.Value = ""; this.hd_comboSTORAGENAME.Value = ""; this.hd_comboYARD.Value = ""; this.hd_comboGOODSNAME.Value = ""; this.hd_comboCUSTOMSER.Value = ""; this.hd_comboINSPECTION.Value = ""; this.hd_comboVESSEL.Value = ""; // tbMBLNO.Text = ""; tbGRADE.Text = ""; tbCOUNTRYOFORIGIN.Text = ""; tbCUSTOMNO.Text = ""; tbCUSTOMDATE.Text = ""; tbINSPECTIONNO.Text = ""; tbINSPECTIONDATE.Text = ""; tbNOR.Text = ""; cbISFORCEDTODESPATCH.Checked = false; tbACTUALKGS.Text = ""; tbREMARK.Text = ""; tbWATERCONTENT.Text = ""; tbWATERDENSITY.Text = ""; // tbBSKGS.Text = ""; tbBSKGS.Text = "0"; tbACTUALKGS.Text = "0"; tbDRAFTKGS.Text = "0"; tbWHARFSKGS.Text = "0"; tbWMSINKGS.Text = "0"; tbWMSOUTKGS.Text = "0"; tbDIFFERENCEKGS.Text = "0"; ddlUNITOFWEIGHT0.SelectedValue = "吨"; ddlUNITOFWEIGHT1.SelectedValue = "吨"; ddlUNITOFWEIGHT2.SelectedValue = "吨"; ddlUNITOFWEIGHT3.SelectedValue = "吨"; ddlUNITOFWEIGHT4.SelectedValue = "吨"; ddlUNITOFWEIGHT5.SelectedValue = "吨"; ddlUNITOFWEIGHT6.SelectedValue = "吨"; } protected void ibDel_Click(object sender, EventArgs e) { bool bl = false; if (lbBSSTATUS.Text.Trim() == "未锁定")//接受委托 { bl = false; } else { bl = true; Page.ClientScript.RegisterStartupScript(this.GetType(), "key3", "");//业务封帐 return; } string alt = T_ALL_DA.GetSeaImportInfoDel(ViewState["GID"].ToString().Trim(), bl, this.hdUserID.Value.Trim()); if (alt != "") { Response.Write(""); return; } ViewState["strHandleType"] = "add"; this.hdHandle.Value = ViewState["strHandleType"].ToString().Trim(); ViewState["GID"] = ""; this.hdGid.Value = ""; // getAddInfo(); // ibDel.Enabled = false; ibAdd.Enabled = false; ibFullAdd.Enabled = false; } public bool IsNumeric(string s) { int inum = 0; bool bReturn = true; try { inum = int.Parse(s); } catch { inum = 0; bReturn = false; } return bReturn; } #region Unicode-GB Code转换 /// /// Unicode-GB Code转换 /// /// 将Unicode编码字符转换成GB编码字符 /// GB Code字符串 public string UnicodeToGB(string text) { UnicodeEncoding unicode = new UnicodeEncoding(); text = unicode.GetString(unicode.GetBytes(Regex.Unescape(text.Trim()))); return text; } /// /// Unicode-GB Code转换 /// /// 将Unicode编码字符转换成GB编码字符 /// GB Code字符串 public string UnicodeToGB_Old(string text) { MatchCollection mc = Regex.Matches(text, "([\\w]+)|(\\\\u([\\w]{4}))"); if (mc != null && mc.Count > 0) { StringBuilder sb = new StringBuilder(); foreach (Match m2 in mc) { string v = m2.Value; if (v.IndexOf("\\") >= 0) { string word = v.Substring(2); byte[] codes = new byte[2]; int code = Convert.ToInt32(word.Substring(0, 2), 16); int code2 = Convert.ToInt32(word.Substring(2), 16); codes[0] = (byte)code2; codes[1] = (byte)code; sb.Append(Encoding.Unicode.GetString(codes)); } else { sb.Append(v); } } return sb.ToString(); } else { return text; } } #endregion #region 字段匹配信息 //委托方式 //业务状态 //费用状态 //录入人 //创建日期 //委托单位 //提单号 //船名 //品名 //品位 //原产地 //报关行 //报关单号 //通关日期 //报检行 //报检单号 //报检日期 //NOR //靠泊码头 //所属仓库 //是否缴纳强制速遣费 //提单吨数 //实际发货吨数 //水尺数 //码头数 //入库数 //计费单位 //是否生成凭证 //凭证号 //分公司 //备注信息 //ORDERTYPE //BSSTATUS //FEESTATUS //INPUTBY //CREATETIME //CUSTOMERNAME //MBLNO //VESSEL //GOODSNAME //GRADE //COUNTRYOFORIGIN //CUSTOMSER //CUSTOMNO //CUSTOMDATE //INSPECTION //INSPECTIONNO //INSPECTIONDATE //NOR //YARD //STORAGENAME //ISFORCEDTODESPATCH //BSKGS //ACTUALKGS //DRAFTKGS //WHARFSKGS //WMSINKGS //UNITOFWEIGHT //ISVOU //VOUNO //CORPID //REMARK #endregion } }