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/SeaiInfo/SeaImportInfo.aspx.cs

3101 lines
158 KiB
C#

2 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;
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.SeaiInfo
{
public partial class SeaImportInfo : 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();
MoneyConvert MoneyConvert = new MoneyConvert();
TopSeaiEntity TopSeaiEntity = new TopSeaiEntity();
SeaImportInfoDA SeaImportInfoDA = new SeaImportInfoDA();
TopCtnDA TopCtnDA = new TopCtnDA();
TopCtnEntity TopCtnEntity = new TopCtnEntity();
RangeDA RangeDA = new RangeDA();
//上传附件
OpSailingDateUrlEntity OpSailingDateUrlEntity = new OpSailingDateUrlEntity();
OpSailingDateEntity OpSailingDateEntity = new OpSailingDateEntity();
OpSailingDateDA OpSailingDateDA = new OpSailingDateDA();
private string recvJSON;
//private string recvJSON_2;
private string recvJSON_3;
private string strSeaBSNO;
public string strRQ;
public string strdate;//用户GID
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 getdate() 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();
}
//
strRQ = T_ALL_DA.GetStrSQL("rq", "select convert(char(10),getdate(),20) as rq");
//
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();
}
switch (strHandleType)
{
case "add"://新增
ViewState["GID"] = getBSNO();
this.hdGid.Value = ViewState["GID"].ToString().Trim();
this.hdMASTERNO.Value = this.hdGid.Value;
this.hdPARENTID.Value = "0";
this.hdLEVELS.Value = "0";
lbBSSTATUS.Text = "未锁定"; //"接受委托";
lbFEESTATUS.Text = "未锁定";
this.hd_comboBLTYPE.Value = "整箱";
ddlBSTYPE.Text = "普通货";
//tbACCDATE.Enabled = true;
//this.hd_comboBLTYPE.Disabled = false;
//
tbACCDATE.Text = DateTime.Parse(strdate).Year.ToString().Trim() + "-" + DateTime.Parse(strdate).Month.ToString().Trim();
tbKGS.Text = "0";
this.hd_comboBSSOURCE.Value = "自揽货";
this.hd_comboOP.Value = T_ALL_DA.GetStrSQL("SHOWNAME", "select SHOWNAME from [user] where GID='" + this.hdUserID.Value.Trim() + "'");
//
tbMBLNO.Text = "";
tbHBLNO.Text = "";//调用编码规则
tbCUSTNO.Text = "";//调用编码规则
//tbHBLNO.Text = getCodeRule("分提单号", "HBLNO");//调用编码规则
//tbCUSTNO.Text = getCodeRule("委托编号", "CUSTNO");//调用编码规则
//
this.hd_comboCUSTOMERNAME.Value = "";
this.hd_comboVESSEL.Value = "";
this.hd_comboVOYNO.Value = "";
this.hd_comboPORTLOAD.Value = "";
this.hd_comboPORTDISCHARGE.Value = T_ALL_DA.GetStrSQL("PORTLOAD", "select PORTLOAD from subcomp_seae_def where CORPID=(select GID from company where GID='" + this.hdCOMPANYID.Value.Trim() + "' and ISDELETED=0)");
this.hd_comboGOODSNAME.Value = "";
this.hd_comboCUSTSERVICE.Value = "";
this.hd_comboSALE.Value = "";
this.hd_comboCUSTOMSER.Value = "";
this.hd_comboINSPECTION.Value = "";
this.hd_comboCARRIER.Value = "";
this.hd_comboTRUCKER.Value = "";
this.hd_comboBSSOURCEDETAIL.Value = "";
this.hd_comboTradingAgency.Value = "";
this.hd_comboGoodsTypeName.Value = "";
this.hd_comboTradeType.Value = "";
this.hd_comboCustContact.Value = ""; //tmplcx
tbCustTEL.Text = "";
tbCustFAX.Text = "";
tbCustEMAIL.Text = "";
tbTARRIFSPAIEDTIEM.Text = "";
tbApproveNo.Text = "";
tbCONTRACTNO.Text = "";
this.hd_comboSALEDEPT.Value = "";
this.hd_comboWMSTYPE.Value = "";
//
tbCOUNTRYOFORIGIN.Text = "";
//this.hd_comboNUMBERPLATE.Value = "";
tbNUMBERPLATE.Text = "";
tbBALES.Text = "";
tbCUSTOMNO.Text = "";
tbINSPECTIONNO.Text = "";
tbNETWEIGHT.Text = "0";
tbCUSTOMDATE.Text = "";
tbINSPECTIONDATE.Text = "";
tbBSDATE.Text = strRQ;
//
tbETD.Text = "";
tbFBP.Text = "0";
tbBMDDATE.Text = "";
tbMDTDATE.Text = "";
ddlUNITOFWEIGHT.SelectedValue = "吨";
tbPKGS.Text = "0";
this.hd_comboKINDPKGS.Value = "";
tbREMARK.Text = "";
this.dvCNTRTOTAL.Value = "";
this.tbCBM.Text = "0.0000";
//
ibDel.Enabled = false;
ibAdd.Enabled = false;
ibFullAdd.Enabled = false;
this.tbIMPORTVALUE.Text = "0.00";
this.tbUNITPRICE.Text = "0.00";
this.tbUPDATETIME.Text = "";
break;
case "addfull"://新增
this.hdLEVELS.Value = "0";
this.hdPARENTID.Value = "0";
lbBSSTATUS.Text = "未锁定"; //"接受委托";
lbFEESTATUS.Text = "未锁定";
this.hd_comboBLTYPE.Value = "整箱";
ddlBSTYPE.Text = "普通货";
//tbACCDATE.Enabled = true;
//this.hd_comboBLTYPE.Disabled = false;
//
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 = "锁定";
}
tbACCDATE.Text = DateTime.Parse(strdate).Year.ToString().Trim() + "-" + DateTime.Parse(strdate).Month.ToString().Trim();
this.hd_comboBLTYPE.Value = TopSeaiEntity.BLTYPE.ToString().Trim();
ddlBSTYPE.Text = TopSeaiEntity.BSTYPE.ToString().Trim();
tbMBLNO.Text = TopSeaiEntity.MBLNO.ToString().Trim();
tbHBLNO.Text = TopSeaiEntity.HBLNO.ToString().Trim();
tbCUSTNO.Text = TopSeaiEntity.CUSTNO.ToString().Trim();
this.hd_comboCUSTOMERNAME.Value = TopSeaiEntity.CUSTOMERNAME.ToString().Trim();
this.hd_comboVESSEL.Value = TopSeaiEntity.VESSEL.ToString().Trim();
this.hd_comboVOYNO.Value = TopSeaiEntity.VOYNO.ToString().Trim();
//
this.hd_comboPORTLOAD.Value = TopSeaiEntity.PORTLOAD.ToString().Trim();
this.hd_comboPORTDISCHARGE.Value = TopSeaiEntity.PORTDISCHARGE.ToString().Trim();
this.hd_comboGOODSNAME.Value = TopSeaiEntity.GOODSNAME.ToString().Trim();
tbKGS.Text = TopSeaiEntity.KGS.ToString().Trim();//"#.####"
this.hd_comboOP.Value = TopSeaiEntity.OP.ToString().Trim();
this.hd_comboCUSTSERVICE.Value = TopSeaiEntity.CUSTSERVICE.ToString().Trim();
this.hd_comboSALE.Value = TopSeaiEntity.SALE.ToString().Trim();
this.hd_comboCUSTOMSER.Value = TopSeaiEntity.CUSTOMSER.ToString().Trim();
this.hd_comboINSPECTION.Value = TopSeaiEntity.INSPECTION.ToString().Trim();
this.hd_comboCARRIER.Value = TopSeaiEntity.CARRIER.ToString().Trim();
this.hd_comboTRUCKER.Value = TopSeaiEntity.TRUCKER.ToString().Trim();
this.hd_comboBSSOURCE.Value = TopSeaiEntity.BSSOURCE.ToString().Trim();
this.hd_comboBSSOURCEDETAIL.Value = TopSeaiEntity.BSSOURCEDETAIL.ToString().Trim();
tbCONTRACTNO.Text = TopSeaiEntity.CONTRACTNO.ToString().Trim();
this.hd_comboSALEDEPT.Value = TopSeaiEntity.SALEDEPT.ToString().Trim();
this.hdCOMPANYID.Value = TopSeaiEntity.CORPID.ToString().Trim();
this.hd_comboTradingAgency.Value = TopSeaiEntity.TRADINGAGENCY.ToString().Trim();
this.hd_comboGoodsTypeName.Value = TopSeaiEntity.GOODSTYPENAME.ToString().Trim();
this.hd_comboTradeType.Value = TopSeaiEntity.TRADETYPE.ToString().Trim();
this.hd_comboWMSTYPE.Value = TopSeaiEntity.WMSTYPE.ToString().Trim();
this.hd_comboCustContact.Value = TopSeaiEntity.SHOWNAME.ToString().Trim();
tbCustTEL.Text = TopSeaiEntity.TEL.ToString().Trim();
tbCustFAX.Text = TopSeaiEntity.FAX.ToString().Trim();
tbCustEMAIL.Text = TopSeaiEntity.EMAIL.ToString().Trim();
//
if (TopSeaiEntity.TARRIFSPAIEDTIEM.ToString().Trim().IndexOf("0001") > -1)
{
tbTARRIFSPAIEDTIEM.Text = "";
}
else
{
tbTARRIFSPAIEDTIEM.Text = TopSeaiEntity.TARRIFSPAIEDTIEM.ToString("yyyy-MM-dd").Trim();//.Substring(0,10);
}
//
tbApproveNo.Text = TopSeaiEntity.APPROVENO.ToString().Trim();
tbHBLNO.Text = "";//调用编码规则
tbCUSTNO.Text = "";//调用编码规则
//tbHBLNO.Text = getCodeRule("分提单号", "HBLNO");//调用编码规则
//tbCUSTNO.Text = getCodeRule("委托编号", "CUSTNO");//调用编码规则
//
tbCOUNTRYOFORIGIN.Text = TopSeaiEntity.COUNTRYOFORIGIN.ToString().Trim();
//this.hd_comboNUMBERPLATE.Value = TopSeaiEntity.NUMBERPLATE.ToString().Trim();
tbNUMBERPLATE.Text = TopSeaiEntity.NUMBERPLATE.ToString().Trim();
tbBALES.Text = TopSeaiEntity.BALES.ToString().Trim();
tbCUSTOMNO.Text = TopSeaiEntity.CUSTOMNO.ToString().Trim();
tbINSPECTIONNO.Text = TopSeaiEntity.INSPECTIONNO.ToString().Trim();
tbNETWEIGHT.Text = TopSeaiEntity.NETWEIGHT.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 = strRQ;
}
else
{
tbINSPECTIONDATE.Text = TopSeaiEntity.INSPECTIONDATE.ToString("yyyy-MM-dd").Trim();//.Substring(0,10);
}
//
tbBSDATE.Text = strRQ;
//
if (TopSeaiEntity.ETD.ToString().Trim().IndexOf("0001") > -1)
{
tbETD.Text = "";
}
else
{
tbETD.Text = TopSeaiEntity.ETD.ToString("yyyy-MM-dd").Trim();//.Substring(0,10);
}
//
tbFBP.Text = TopSeaiEntity.FBP.ToString().Trim();
//
if (TopSeaiEntity.BMDDATE.ToString().Trim().IndexOf("0001") > -1)
{
tbBMDDATE.Text = "";
}
else
{
tbBMDDATE.Text = TopSeaiEntity.BMDDATE.ToString("yyyy-MM-dd").Trim();//.Substring(0,10);
}
//
if (TopSeaiEntity.MDTDATE.ToString().Trim().IndexOf("0001") > -1)
{
tbMDTDATE.Text = "";
}
else
{
tbMDTDATE.Text = TopSeaiEntity.MDTDATE.ToString("yyyy-MM-dd").Trim();//.Substring(0,10);
}
//
ddlUNITOFWEIGHT.SelectedValue = TopSeaiEntity.UNITOFWEIGHT.ToString().Trim();
tbPKGS.Text = TopSeaiEntity.PKGS.ToString().Trim();
this.hd_comboKINDPKGS.Value = TopSeaiEntity.KINDPKGS.ToString().Trim();
tbREMARK.Text = TopSeaiEntity.REMARK.ToString().Trim();
if (TopSeaiEntity.CBM == 0)
{
this.tbCBM.Text = "0.0000";
}
else
{
this.tbCBM.Text = TopSeaiEntity.CBM.ToString().Trim();//尺码
}
this.dvCNTRTOTAL.Value = "";
//
ViewState["GID"] = getBSNO();
this.hdGid.Value = ViewState["GID"].ToString().Trim();
this.hdMASTERNO.Value = this.hdGid.Value;
//
ibDel.Enabled = false;
ibAdd.Enabled = false;
ibFullAdd.Enabled = false;
this.tbIMPORTVALUE.Text = TopSeaiEntity.IMPORTVALUE.ToString().Trim();//货值
this.tbUNITPRICE.Text = TopSeaiEntity.UNITPRICE.ToString().Trim();//单价
this.ddlCURRENCY.SelectedValue = TopSeaiEntity.CURRENCY.ToString().Trim();//币别
if (TopSeaiEntity.UPDATETIME.ToString().Trim().IndexOf("0001") > -1)//申报日期
{
this.tbUPDATETIME.Text = "";
}
else
{
this.tbUPDATETIME.Text = TopSeaiEntity.UPDATETIME.ToString("yyyy-MM-dd").Trim();
}
}
break;
case "addhblno"://新增分单
lbBSSTATUS.Text = "未锁定"; //"接受委托";
lbFEESTATUS.Text = "未锁定";
this.hd_comboBLTYPE.Value = "整箱";
ddlBSTYPE.Text = "分单";
//tbACCDATE.Enabled = true;
//this.hd_comboBLTYPE.Disabled = false;
//
TopSeaiEntity = SeaImportInfoDA.GetID(ViewState["GID"].ToString().Trim());
if (TopSeaiEntity.BSNO != null)
{
this.hdMASTERNO.Value = TopSeaiEntity.MASTERNO.ToString().Trim();
this.hdPARENTID.Value = TopSeaiEntity.BSNO.ToString().Trim();
this.hdLEVELS.Value = (int.Parse(TopSeaiEntity.LEVELS.ToString().Trim())+1).ToString();
ViewState["GID"] = "";
this.hdGid.Value = "";
//
if (TopSeaiEntity.BSSTATUS.ToString().Trim() == "False")
{
lbBSSTATUS.Text = "未锁定";//"接受委托";
}
else
{
lbBSSTATUS.Text = "锁定";//业务封帐
}
if (TopSeaiEntity.FEESTATUS.ToString().Trim() == "False")
{
lbFEESTATUS.Text = "未锁定";
}
else
{
lbFEESTATUS.Text = "锁定";
}
tbACCDATE.Text = DateTime.Parse(strdate).Year.ToString().Trim() + "-" + DateTime.Parse(strdate).Month.ToString().Trim();
//
string strnum = T_ALL_DA.GetStrSQL("num", "select (count(*)+1) as num from op_Seai where PARENTID='" + this.hdPARENTID.Value.Trim() + "'");
tbMBLNO.Text = TopSeaiEntity.MBLNO.ToString().Trim() + "-" + strnum;
//
tbHBLNO.Text = TopSeaiEntity.HBLNO.ToString().Trim();
tbCUSTNO.Text = TopSeaiEntity.CUSTNO.ToString().Trim();
this.hd_comboCUSTOMERNAME.Value = TopSeaiEntity.CUSTOMERNAME.ToString().Trim();
this.hd_comboVESSEL.Value = TopSeaiEntity.VESSEL.ToString().Trim();
this.hd_comboVOYNO.Value = TopSeaiEntity.VOYNO.ToString().Trim();
//
this.hd_comboPORTLOAD.Value = TopSeaiEntity.PORTLOAD.ToString().Trim();
this.hd_comboPORTDISCHARGE.Value = TopSeaiEntity.PORTDISCHARGE.ToString().Trim();
this.hd_comboGOODSNAME.Value = TopSeaiEntity.GOODSNAME.ToString().Trim();
tbKGS.Text = TopSeaiEntity.KGS.ToString().Trim();//"#.####"
this.hd_comboOP.Value = TopSeaiEntity.OP.ToString().Trim();
this.hd_comboCUSTSERVICE.Value = TopSeaiEntity.CUSTSERVICE.ToString().Trim();
this.hd_comboSALE.Value = TopSeaiEntity.SALE.ToString().Trim();
this.hd_comboCUSTOMSER.Value = TopSeaiEntity.CUSTOMSER.ToString().Trim();
this.hd_comboINSPECTION.Value = TopSeaiEntity.INSPECTION.ToString().Trim();
this.hd_comboCARRIER.Value = TopSeaiEntity.CARRIER.ToString().Trim();
this.hd_comboTRUCKER.Value = TopSeaiEntity.TRUCKER.ToString().Trim();
this.hd_comboBSSOURCE.Value = TopSeaiEntity.BSSOURCE.ToString().Trim();
this.hd_comboBSSOURCEDETAIL.Value = TopSeaiEntity.BSSOURCEDETAIL.ToString().Trim();
tbCONTRACTNO.Text = TopSeaiEntity.CONTRACTNO.ToString().Trim();
this.hd_comboSALEDEPT.Value = TopSeaiEntity.SALEDEPT.ToString().Trim();
this.hdCOMPANYID.Value = TopSeaiEntity.CORPID.ToString().Trim();
this.hd_comboTradingAgency.Value = TopSeaiEntity.TRADINGAGENCY.ToString().Trim();
this.hd_comboGoodsTypeName.Value = TopSeaiEntity.GOODSTYPENAME.ToString().Trim();
this.hd_comboTradeType.Value = TopSeaiEntity.TRADETYPE.ToString().Trim();
this.hd_comboWMSTYPE.Value = TopSeaiEntity.WMSTYPE.ToString().Trim();
this.hd_comboCustContact.Value = TopSeaiEntity.SHOWNAME.ToString().Trim();
tbCustTEL.Text = TopSeaiEntity.TEL.ToString().Trim();
tbCustFAX.Text = TopSeaiEntity.FAX.ToString().Trim();
tbCustEMAIL.Text = TopSeaiEntity.EMAIL.ToString().Trim();
//
if (TopSeaiEntity.TARRIFSPAIEDTIEM.ToString().Trim().IndexOf("0001") > -1)
{
tbTARRIFSPAIEDTIEM.Text = "";
}
else
{
tbTARRIFSPAIEDTIEM.Text = TopSeaiEntity.TARRIFSPAIEDTIEM.ToString("yyyy-MM-dd").Trim();//.Substring(0,10);
}
//
tbApproveNo.Text = TopSeaiEntity.APPROVENO.ToString().Trim();
tbHBLNO.Text = "";//调用编码规则
tbCUSTNO.Text = "";//调用编码规则
//tbHBLNO.Text = getCodeRule("分提单号", "HBLNO");//调用编码规则
//tbCUSTNO.Text = getCodeRule("委托编号", "CUSTNO");//调用编码规则
//
tbCOUNTRYOFORIGIN.Text = TopSeaiEntity.COUNTRYOFORIGIN.ToString().Trim();
//this.hd_comboNUMBERPLATE.Value = TopSeaiEntity.NUMBERPLATE.ToString().Trim();
tbNUMBERPLATE.Text = TopSeaiEntity.NUMBERPLATE.ToString().Trim();
tbBALES.Text = TopSeaiEntity.BALES.ToString().Trim();
tbCUSTOMNO.Text = TopSeaiEntity.CUSTOMNO.ToString().Trim();
tbINSPECTIONNO.Text = TopSeaiEntity.INSPECTIONNO.ToString().Trim();
tbNETWEIGHT.Text = TopSeaiEntity.NETWEIGHT.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 = strRQ;
}
else
{
tbINSPECTIONDATE.Text = TopSeaiEntity.INSPECTIONDATE.ToString("yyyy-MM-dd").Trim();//.Substring(0,10);
}
//
tbBSDATE.Text = strRQ;
//
if (TopSeaiEntity.ETD.ToString().Trim().IndexOf("0001") > -1)
{
tbETD.Text = "";
}
else
{
tbETD.Text = TopSeaiEntity.ETD.ToString("yyyy-MM-dd").Trim();//.Substring(0,10);
}
//
tbFBP.Text = TopSeaiEntity.FBP.ToString().Trim();
//
if (TopSeaiEntity.BMDDATE.ToString().Trim().IndexOf("0001") > -1)
{
tbBMDDATE.Text = "";
}
else
{
tbBMDDATE.Text = TopSeaiEntity.BMDDATE.ToString("yyyy-MM-dd").Trim();//.Substring(0,10);
}
//
if (TopSeaiEntity.MDTDATE.ToString().Trim().IndexOf("0001") > -1)
{
tbMDTDATE.Text = "";
}
else
{
tbMDTDATE.Text = TopSeaiEntity.MDTDATE.ToString("yyyy-MM-dd").Trim();//.Substring(0,10);
}
//
ddlUNITOFWEIGHT.SelectedValue = TopSeaiEntity.UNITOFWEIGHT.ToString().Trim();
tbPKGS.Text = TopSeaiEntity.PKGS.ToString().Trim();
this.hd_comboKINDPKGS.Value = TopSeaiEntity.KINDPKGS.ToString().Trim();
tbREMARK.Text = TopSeaiEntity.REMARK.ToString().Trim();
if (TopSeaiEntity.CBM == 0)
{
this.tbCBM.Text = "0.0000";
}
else
{
this.tbCBM.Text = TopSeaiEntity.CBM.ToString().Trim();//尺码
}
this.dvCNTRTOTAL.Value = "";
//
ViewState["GID"] = getBSNO();
this.hdGid.Value = ViewState["GID"].ToString().Trim();
//
ibDel.Enabled = false;
ibAdd.Enabled = false;
ibFullAdd.Enabled = false;
this.tbIMPORTVALUE.Text = TopSeaiEntity.IMPORTVALUE.ToString().Trim();//货值
this.tbUNITPRICE.Text = TopSeaiEntity.UNITPRICE.ToString().Trim();//单价
this.ddlCURRENCY.SelectedValue = TopSeaiEntity.CURRENCY.ToString().Trim();//币别
if (TopSeaiEntity.UPDATETIME.ToString().Trim().IndexOf("0001") > -1)//申报日期
{
this.tbUPDATETIME.Text = "";
}
else
{
this.tbUPDATETIME.Text = TopSeaiEntity.UPDATETIME.ToString("yyyy-MM-dd").Trim();
}
}
break;
case "edit"://录入
//tbACCDATE.Enabled = false;
//this.hd_comboBLTYPE.Disabled = true;
TopSeaiEntity = SeaImportInfoDA.GetID(ViewState["GID"].ToString().Trim());
if (TopSeaiEntity.BSNO != null)
{
this.hdMASTERNO.Value = TopSeaiEntity.MASTERNO.ToString().Trim();
this.hdPARENTID.Value = TopSeaiEntity.PARENTID.ToString().Trim();
this.hdLEVELS.Value = TopSeaiEntity.LEVELS.ToString().Trim();
//
if (TopSeaiEntity.BSSTATUS.ToString().Trim() == "False")
{
lbBSSTATUS.Text = "未锁定";//"接受委托";
}
else
{
lbBSSTATUS.Text = "锁定";//"业务封帐";
}
if (TopSeaiEntity.FEESTATUS.ToString().Trim() == "False")
{
lbFEESTATUS.Text = "未锁定";
}
else
{
lbFEESTATUS.Text = "锁定";
}
tbACCDATE.Text = TopSeaiEntity.ACCDATE.ToString().Trim();
this.hd_comboBLTYPE.Value = TopSeaiEntity.BLTYPE.ToString().Trim();
ddlBSTYPE.Text = TopSeaiEntity.BSTYPE.ToString().Trim();
this.hdBSTYPE.Value = TopSeaiEntity.BSTYPE.ToString().Trim();
tbMBLNO.Text = TopSeaiEntity.MBLNO.ToString().Trim();
//
tbHBLNO.Text = TopSeaiEntity.HBLNO.ToString().Trim();
getCodeRuleEnabled("分提单号", "HBLNO");
tbCUSTNO.Text = TopSeaiEntity.CUSTNO.ToString().Trim();
getCodeRuleEnabled("委托编号", "CUSTNO");
if (this.hdEnabled.Value == "false")
{
tbHBLNO.Enabled = false;
tbCUSTNO.Enabled = false;
}
//
this.hd_comboCUSTOMERNAME.Value = TopSeaiEntity.CUSTOMERNAME.ToString().Trim();
this.hd_comboVESSEL.Value = TopSeaiEntity.VESSEL.ToString().Trim();
this.hd_comboVOYNO.Value = TopSeaiEntity.VOYNO.ToString().Trim();
this.hd_comboPORTLOAD.Value = TopSeaiEntity.PORTLOAD.ToString().Trim();
this.hd_comboPORTDISCHARGE.Value = TopSeaiEntity.PORTDISCHARGE.ToString().Trim();
this.hd_comboGOODSNAME.Value = TopSeaiEntity.GOODSNAME.ToString().Trim();
tbKGS.Text = TopSeaiEntity.KGS.ToString().Trim();//"#.####"
this.hd_comboOP.Value = TopSeaiEntity.OP.ToString().Trim();
this.hd_comboCUSTSERVICE.Value = TopSeaiEntity.CUSTSERVICE.ToString().Trim();
this.hd_comboSALE.Value = TopSeaiEntity.SALE.ToString().Trim();
this.hd_comboCUSTOMSER.Value = TopSeaiEntity.CUSTOMSER.ToString().Trim();
this.hd_comboINSPECTION.Value = TopSeaiEntity.INSPECTION.ToString().Trim();
this.hd_comboCARRIER.Value = TopSeaiEntity.CARRIER.ToString().Trim();
this.hd_comboTRUCKER.Value = TopSeaiEntity.TRUCKER.ToString().Trim();
this.hd_comboBSSOURCE.Value = TopSeaiEntity.BSSOURCE.ToString().Trim();
this.hd_comboBSSOURCEDETAIL.Value = TopSeaiEntity.BSSOURCEDETAIL.ToString().Trim();
tbCONTRACTNO.Text = TopSeaiEntity.CONTRACTNO.ToString().Trim();
this.hd_comboSALEDEPT.Value = TopSeaiEntity.SALEDEPT.ToString().Trim();
this.hdCOMPANYID.Value = TopSeaiEntity.CORPID.ToString().Trim();
//
tbCOUNTRYOFORIGIN.Text = TopSeaiEntity.COUNTRYOFORIGIN.ToString().Trim();
//this.hd_comboNUMBERPLATE.Value = TopSeaiEntity.NUMBERPLATE.ToString().Trim();
tbNUMBERPLATE.Text = TopSeaiEntity.NUMBERPLATE.ToString().Trim();
tbBALES.Text = TopSeaiEntity.BALES.ToString().Trim();
tbCUSTOMNO.Text = TopSeaiEntity.CUSTOMNO.ToString().Trim();
tbINSPECTIONNO.Text = TopSeaiEntity.INSPECTIONNO.ToString().Trim();
tbNETWEIGHT.Text = TopSeaiEntity.NETWEIGHT.ToString().Trim();//"#.####"
this.hd_comboTradingAgency.Value = TopSeaiEntity.TRADINGAGENCY.ToString().Trim();
this.hd_comboGoodsTypeName.Value = TopSeaiEntity.GOODSTYPENAME.ToString().Trim();
this.hd_comboTradeType.Value = TopSeaiEntity.TRADETYPE.ToString().Trim();
this.hd_comboWMSTYPE.Value = TopSeaiEntity.WMSTYPE.ToString().Trim();
this.hd_comboCustContact.Value = TopSeaiEntity.SHOWNAME.ToString().Trim();
tbCustTEL.Text = TopSeaiEntity.TEL.ToString().Trim();
tbCustFAX.Text = TopSeaiEntity.FAX.ToString().Trim();
tbCustEMAIL.Text = TopSeaiEntity.EMAIL.ToString().Trim();
tbApproveNo.Text = TopSeaiEntity.APPROVENO.ToString().Trim();
//
if (TopSeaiEntity.TARRIFSPAIEDTIEM.ToString().Trim().IndexOf("0001") > -1)
{
tbTARRIFSPAIEDTIEM.Text = "";
}
else
{
tbTARRIFSPAIEDTIEM.Text = TopSeaiEntity.TARRIFSPAIEDTIEM.ToString("yyyy-MM-dd").Trim();//.Substring(0,10);
}
//
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 = "";
}
else
{
tbINSPECTIONDATE.Text = TopSeaiEntity.INSPECTIONDATE.ToString("yyyy-MM-dd").Trim();//.Substring(0,10);
}
//
if (TopSeaiEntity.BSDATE.ToString().Trim().IndexOf("0001") > -1)
{
tbBSDATE.Text = strRQ;
}
else
{
tbBSDATE.Text = TopSeaiEntity.BSDATE.ToString("yyyy-MM-dd").Trim();//.Substring(0,10);
}
//
if (TopSeaiEntity.ETD.ToString().Trim().IndexOf("0001") > -1)
{
tbETD.Text = "";
}
else
{
tbETD.Text = TopSeaiEntity.ETD.ToString("yyyy-MM-dd").Trim();
}
//
tbFBP.Text = TopSeaiEntity.FBP.ToString().Trim();
//
if (TopSeaiEntity.BMDDATE.ToString().Trim().IndexOf("0001") > -1)
{
tbBMDDATE.Text = "";
}
else
{
tbBMDDATE.Text = TopSeaiEntity.BMDDATE.ToString("yyyy-MM-dd").Trim();//.Substring(0,10);
}
//
if (TopSeaiEntity.MDTDATE.ToString().Trim().IndexOf("0001") > -1)
{
tbMDTDATE.Text = "";
}
else
{
tbMDTDATE.Text = TopSeaiEntity.MDTDATE.ToString("yyyy-MM-dd").Trim();//.Substring(0,10);
}
//
ddlUNITOFWEIGHT.SelectedValue = TopSeaiEntity.UNITOFWEIGHT.ToString().Trim();
tbPKGS.Text = TopSeaiEntity.PKGS.ToString().Trim();
this.hd_comboKINDPKGS.Value = TopSeaiEntity.KINDPKGS.ToString().Trim();
tbREMARK.Text = TopSeaiEntity.REMARK.ToString().Trim();
this.dvCNTRTOTAL.Value = TopSeaiEntity.CNTRTOTAL.ToString().Trim();
if (TopSeaiEntity.CBM == 0)
{
this.tbCBM.Text = "0.0000";
}
else
{
this.tbCBM.Text = TopSeaiEntity.CBM.ToString().Trim();//尺码
}
this.tbIMPORTVALUE.Text = TopSeaiEntity.IMPORTVALUE.ToString().Trim();//货值
this.tbUNITPRICE.Text = TopSeaiEntity.UNITPRICE.ToString().Trim();//单价
if (TopSeaiEntity.CURRENCY=="" || TopSeaiEntity.CURRENCY==null)
{
ddlCURRENCY.SelectedIndex =0;
}
else
{
this.ddlCURRENCY.SelectedValue = TopSeaiEntity.CURRENCY.ToString().Trim();//币别
}
if (TopSeaiEntity.UPDATETIME.ToString().Trim().IndexOf("0001") > -1)//申报日期
{
this.tbUPDATETIME.Text = "";
}
else
{
this.tbUPDATETIME.Text = TopSeaiEntity.UPDATETIME.ToString("yyyy-MM-dd").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(), "modSeaImportList");//海运进口委托管理列表
string strO = RangeDA.GetOPERATERANGE(this.hdUserID.Value.Trim(), "modSeaImportList");//海运进口委托管理列表
string alt = "";
if (strV.Trim() != strO.Trim())
{
if (strO.Trim().Equals("0"))//全部
{
}
else if (strO.Trim().Equals("1"))//分公司
{
alt = RangeDA.GetSeaImportListCompany(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.GetSeaImportListDEPT(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.GetSeaImportListPerson(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();
}
}
//
}
//集装箱
recvJSON = "";
recvJSON = this.recvContainer.Value.Trim();
//recvJSON_2 = "";
//recvJSON_2 = this.recvContainer_2.Value.Trim();
recvJSON_3 = "";
recvJSON_3 = this.recvContainer_3.Value.Trim();
if (ViewState["GID"] != null)
{
if (this.hdEnter.Value == "0")
{
getEnter();
}
//
strSeaBSNO = ViewState["GID"].ToString().Trim();
this.dvOrderNumVal.Value = ViewState["GID"].ToString().Trim();
//this.dvOrderNumVal_2.Value = ViewState["GID"].ToString().Trim();
this.dvOrderNumVal_3.Value = ViewState["GID"].ToString().Trim();
//CTN
if (!recvJSON.Trim().Equals(""))
{
//应收账户保存
JsonTopCtnGroupEntity TopCtnGroupRecvEntity = GetPostEntity(recvJSON);
List<JsonTopCtnEntity> TopCtnRecvEntities = new List<JsonTopCtnEntity>();
TopCtnRecvEntities = TopCtnGroupRecvEntity.JsonTopCtnEntities;
SaveRecvTopCtn(TopCtnGroupRecvEntity);
//更新完初始化
recvJSON = "";
this.recvContainer.Value = "";
}
////仓储费率
//if (!recvJSON_2.Trim().Equals(""))
//{
// SaveRateAction();
// recvJSON_2 = "";
// this.recvContainer_2.Value = "";
//}
if (!recvJSON_3.Trim().Equals(""))
{
getFuJianEnter();
recvJSON_3 = "";
this.recvContainer_3.Value = "";
}
//Truck
//if (!recvJSON_2.Trim().Equals(""))
//{
// //应收账户保存
// JsonOpSeaiTruckGroupEntity OpSeaiTruckGroupRecvEntity = GetOpSeaiTruckEntity(recvJSON_2);
// List<JsonOpSeaiTruckEntity> OpSeaiTruckRecvEntities = new List<JsonOpSeaiTruckEntity>();
// OpSeaiTruckRecvEntities = OpSeaiTruckGroupRecvEntity.JsonOpSeaiTruckEntities;
// SaveRecvOpSeaiTruck(OpSeaiTruckGroupRecvEntity);
// //更新完初始化
// recvJSON_2 = "";
//}
}
else
{
//Response.Write("-1");
//Response.End();
}
//加载下拉框 initComboTradingAgency();
// Page.ClientScript.RegisterStartupScript(this.GetType(), "key0", "<script>initComboOP();initComboSALE();initComboCUSTSERVICE();initComboCUSTOMERNAME();initComboGOODSNAME();initComboCUSTOMSER();initComboINSPECTION();initComboVESSEL();initComboPORTLOAD();initComboPORTDISCHARGE();initComboBSSOURCE();initComboKINDPKGS();initComboSALEDEPT();</script>");
}
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";
//
tbACCDATE.Enabled = false;
this.hd_comboBLTYPE.Disabled = true;
ddlBSTYPE.Enabled = false;
tbMBLNO.Enabled = false;
getCodeRuleEnabled("分提单号", "HBLNO");
getCodeRuleEnabled("委托编号", "CUSTNO");
tbCUSTNO.Enabled = false;
tbHBLNO.Enabled = false;
divadd.Disabled = true;
divsave.Disabled = true;
divdel.Disabled = true;
divrollback.Disabled = true;
divrefresh.Disabled = true;
divctn.Disabled = true;
mygrid_container_recv.Disabled = true;
tbETD.Enabled = false;
tbKGS.Enabled = false;
tbCONTRACTNO.Enabled = false;
//
tbCOUNTRYOFORIGIN.Enabled = false;
//this.hd_comboNUMBERPLATE.Enabled = false;
//
//ddlNUMBERPLATE.Disabled = true;
//
tbNUMBERPLATE.Enabled = false;
tbBALES.Enabled = false;
tbCUSTOMNO.Enabled = false;
tbINSPECTIONNO.Enabled = false;
tbNETWEIGHT.Enabled = false;
tbCBM.Enabled = false;
tbIMPORTVALUE.Enabled = false;
tbUNITPRICE.Enabled = false;
ddlCURRENCY.Enabled = false;
this.dvCNTRTOTAL.Disabled = true;
tbCUSTOMDATE.Enabled = false;
tbINSPECTIONDATE.Enabled = false;
tbBSDATE.Enabled = false;
tbPKGS.Enabled = false;
ddlUNITOFWEIGHT.Enabled = false;
ddlUNITOFWEIGHT2.Enabled = false;
//
//divadd_2.Disabled = true;
//divsave_2.Disabled = true;
//divdel_2.Disabled = true;
//divrollback_2.Disabled = true;
//divrefresh_2.Disabled = true;
//mygrid_container_recv_2.Disabled = true;
//
tbFBP.Enabled = false;
tbBMDDATE.Enabled = false;
tbMDTDATE.Enabled = false;
tbCustTEL.Enabled=false;
tbCustFAX.Enabled=false;
tbCustEMAIL.Enabled = false;
tbTARRIFSPAIEDTIEM.Enabled=false;
tbApproveNo.Enabled=false;
tbREMARK.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";
//
tbACCDATE.Enabled = true;
this.hd_comboBLTYPE.Disabled = false;
ddlBSTYPE.Enabled = true;
tbMBLNO.Enabled = true;
//
tbCUSTNO.Enabled = true;
tbHBLNO.Enabled = true;
getCodeRuleEnabled("分提单号", "HBLNO");
getCodeRuleEnabled("委托编号", "CUSTNO");
//
//
divadd.Disabled = false;
divsave.Disabled = false;
divdel.Disabled = false;
divrollback.Disabled = false;
divrefresh.Disabled = false;
divctn.Disabled = false;
////btCTN.Enabled = true;
mygrid_container_recv.Disabled = false;
//
tbETD.Enabled = true;
tbKGS.Enabled = true;
tbCONTRACTNO.Enabled = true;
//
tbCOUNTRYOFORIGIN.Enabled = true;
//this.hd_comboNUMBERPLATE.Enabled = true;
//
//ddlNUMBERPLATE.Disabled = false;
//
tbNUMBERPLATE.Enabled = true;
tbBALES.Enabled = true;
tbCUSTOMNO.Enabled = true;
tbINSPECTIONNO.Enabled = true;
tbNETWEIGHT.Enabled = true;
tbCBM.Enabled = true;
tbIMPORTVALUE.Enabled = true;
tbUNITPRICE.Enabled = true;
ddlCURRENCY.Enabled = true;
this.dvCNTRTOTAL.Disabled = false;
tbCUSTOMDATE.Enabled = true;
tbINSPECTIONDATE.Enabled = true;
tbBSDATE.Enabled = true;
tbPKGS.Enabled = true;
ddlUNITOFWEIGHT.Enabled = true;
ddlUNITOFWEIGHT2.Enabled = true;
//
//divadd_2.Disabled = false;
//divsave_2.Disabled = false;
//divdel_2.Disabled = false;
//divrollback_2.Disabled = false;
//divrefresh_2.Disabled = false;
//mygrid_container_recv_2.Disabled = false;
//
tbFBP.Enabled = true;
tbBMDDATE.Enabled = true;
tbMDTDATE.Enabled = true;
tbCustTEL.Enabled = true;
tbCustFAX.Enabled = true;
tbCustEMAIL.Enabled = true;
tbTARRIFSPAIEDTIEM.Enabled = true;
tbApproveNo.Enabled = true;
tbREMARK.Enabled = true;
}
/// <summary>
/// 提取规则编号
/// </summary>
/// <param name="strRULENAME">规则项目名称</param>
/// <param name="strfield">需要加规则的字段</param>
/// <returns></returns>
protected void getCodeRuleEnabled(string strRULENAME, string strfield)
{
//是否生成之后允许编辑
DataSet ds = T_ALL_DA.GetAllSQL("select * from code_rule where RULENAME='" + strRULENAME.Trim() + "' and RULETYPE=2");
if (ds != null)
{
if (ds.Tables[0].Rows.Count > 0)
{
if (ds.Tables[0].Rows[0]["ISSTARTUSING"].ToString().Trim().Equals("True"))
{
if (strfield == "HBLNO")
{
if (ds.Tables[0].Rows[0]["ISALLOWEDITS"].ToString().Trim().Equals("True"))
{
tbHBLNO.Enabled = true;
}
else
{
tbHBLNO.Enabled = false;
}
}
else if (strfield == "CUSTNO")
{
if (ds.Tables[0].Rows[0]["ISALLOWEDITS"].ToString().Trim().Equals("True"))
{
tbCUSTNO.Enabled = true;
}
else
{
tbCUSTNO.Enabled = false;
}
}
}
}
}
}
/// <summary>
/// 提取规则编号
/// </summary>
/// <param name="strRULENAME">规则项目名称</param>
/// <param name="strfield">需要加规则的字段</param>
/// <returns></returns>
protected String getCodeRule(string strRULENAME, string strfield)
{
//调用编码规则
string strRULEYEAR = "";
string strRULECONTENT = "";
string strCODENAME = "";
string strDEPTNO = "";
string strRULENOLENGTH = "";
int iRULENOLENGTH = 0;
int inum = 0;
string strCONTENT = "";
DataSet ds = T_ALL_DA.GetAllSQL("select * from code_rule where RULENAME='" + strRULENAME.Trim() + "' and RULETYPE=2");
if (ds != null)
{
if (ds.Tables[0].Rows.Count > 0)
{
if (ds.Tables[0].Rows[0]["ISSTARTUSING"].ToString().Trim().Equals("True"))
{
getCodeRuleEnabled(strRULENAME, strfield);
//
if (ds.Tables[0].Rows[0]["RULEDATE"].ToString().Trim().Equals("业务日期"))
{
if (tbETD.Text.Trim() == "")
{
return "";
}
DateTime dETD = System.Convert.ToDateTime(tbETD.Text.Trim());
if (ds.Tables[0].Rows[0]["ISCLEAREDINEARLY"].ToString().Trim().Equals("True"))
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = dETD.ToString("yyyy") + dETD.ToString("MM");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = dETD.ToString("yy") + dETD.ToString("MM");
}
}
else
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = dETD.ToString("yyyy");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = dETD.ToString("yy");
}
}
}
else if (ds.Tables[0].Rows[0]["RULEDATE"].ToString().Trim().Equals("会计期间"))
{
if (tbACCDATE.Text.Trim() == "")
{
return "";
}
DateTime dACCDATE = System.Convert.ToDateTime(tbACCDATE.Text.Trim() + "-01");
if (ds.Tables[0].Rows[0]["ISCLEAREDINEARLY"].ToString().Trim().Equals("True"))
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = dACCDATE.ToString("yyyy") + dACCDATE.ToString("MM");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = dACCDATE.ToString("yy") + dACCDATE.ToString("MM");
}
}
else
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = dACCDATE.ToString("yyyy");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = dACCDATE.ToString("yy");
}
}
}
else if (ds.Tables[0].Rows[0]["RULEDATE"].ToString().Trim().Equals("自然月份"))
{
DateTime fwqdate = System.Convert.ToDateTime(T_ALL_DA.GetStrSQL("fwqdate", "select fwqdate=getdate()"));
if (ds.Tables[0].Rows[0]["ISCLEAREDINEARLY"].ToString().Trim().Equals("True"))
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = fwqdate.ToString("yyyy") + fwqdate.ToString("MM");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = fwqdate.ToString("yy") + fwqdate.ToString("MM");
}
}
else
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = fwqdate.ToString("yyyy");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = fwqdate.ToString("yy");
}
}
}
//
if (ds.Tables[0].Rows[0]["ISCOMPANY"].ToString().Trim().Equals("True"))
{
strCODENAME = T_ALL_DA.GetStrSQL("CODENAME", "select CODENAME from [company] where GID=(select top 1 COMPANYID from user_company where USERID='" + this.hdUserID.Value.Trim() + "')");
}
if (ds.Tables[0].Rows[0]["ISDEPT"].ToString().Trim().Equals("True"))
{
strDEPTNO = T_ALL_DA.GetStrSQL("DEPTNO", "select DEPTNO from [sys_dept] where LINKID=(select top 1 COMPANYID from user_company where USERID='" + this.hdUserID.Value.Trim() + "')");
}
strRULECONTENT = ds.Tables[0].Rows[0]["RULECONTENT"].ToString().Trim();
strRULECONTENT = strRULECONTENT.Replace("《COMPANY》", strCODENAME);
strRULECONTENT = strRULECONTENT.Replace("《DEPT》", strDEPTNO);
//
if (ds.Tables[0].Rows[0]["RULENOLENGTH"].ToString().Trim() == "")
{
iRULENOLENGTH = 0;
}
else
{
iRULENOLENGTH = int.Parse(ds.Tables[0].Rows[0]["RULENOLENGTH"].ToString().Trim());
}
strCONTENT = strRULECONTENT + strRULEYEAR;
//获取分公司的票号头字符
string tempBANKSHEAD = T_ALL_DA.GetStrSQL("BANKSHEAD", "SELECT TOP 1 BANKSHEAD FROM company WHERE GID='" + strCompanyID.Trim() + "'");
strCONTENT = tempBANKSHEAD + strCONTENT;
//
strRULENOLENGTH = T_ALL_DA.GetStrSQL(strfield, "select top 1 " + strfield + " from [op_seai] where " + strfield + " like '" + strCONTENT.Trim() + "%' order by " + strfield + " DESC");
if (strRULENOLENGTH == "")
{
strRULENOLENGTH = "1";
}
else
{
strRULENOLENGTH = strRULENOLENGTH.Replace(strCONTENT.Trim(), "");
inum = int.Parse(strRULENOLENGTH.Trim());
inum = inum + 1;
strRULENOLENGTH = inum.ToString();
}
int j = iRULENOLENGTH - strRULENOLENGTH.Length;
for (int i = 1; i <= j; i++)
{
strRULENOLENGTH = "0" + strRULENOLENGTH;
}
//
strCONTENT = strCONTENT + strRULENOLENGTH;
return strCONTENT;
}
}
}
return "";
}
protected String getBSNO()
{
string strBSNO = Guid.NewGuid().ToString();
strBSNO = strBSNO.Replace("-", "");
strBSNO = "topseai" + strBSNO;
return strBSNO;
}
protected bool getAdd()
{
TopSeaiEntity.MASTERNO = this.hdMASTERNO.Value;
TopSeaiEntity.PARENTID = this.hdPARENTID.Value;
TopSeaiEntity.LEVELS = int.Parse(this.hdLEVELS.Value);
TopSeaiEntity.BSNO = 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.ACCDATE = tbACCDATE.Text.Trim();
TopSeaiEntity.BLTYPE = this.hd_comboBLTYPE.Value.Trim();
TopSeaiEntity.BSTYPE = ddlBSTYPE.Text.Trim();
TopSeaiEntity.MBLNO = tbMBLNO.Text.Trim();
TopSeaiEntity.HBLNO = tbHBLNO.Text.Trim();
TopSeaiEntity.CUSTNO = tbCUSTNO.Text.Trim();
TopSeaiEntity.CUSTOMERNAME = this.hd_comboCUSTOMERNAME.Value.Trim();
TopSeaiEntity.VESSEL = this.hd_comboVESSEL.Value.Trim();
TopSeaiEntity.VOYNO = this.hd_comboVOYNO.Value.Trim();
TopSeaiEntity.PORTLOADID = "";
TopSeaiEntity.PORTLOAD = this.hd_comboPORTLOAD.Value.Trim();
TopSeaiEntity.PORTDISCHARGEID = "";
TopSeaiEntity.PORTDISCHARGE = this.hd_comboPORTDISCHARGE.Value.Trim();
TopSeaiEntity.GOODSNAME = this.hd_comboGOODSNAME.Value.Trim();
//
Decimal sKGS = 0;
if (tbKGS.Text.Trim() == "" || tbKGS.Text.Trim() == "0" || tbKGS.Text.Trim() == "0.0000")
{
TopSeaiEntity.KGS = 0;
}
else
{
TopSeaiEntity.KGS = Decimal.Parse(Decimal.Parse(tbKGS.Text.Trim()).ToString("#.####"));
sKGS = Decimal.Parse(Decimal.Parse(tbKGS.Text.Trim()).ToString("#.####"));
}
//
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.INPUTBY = "";
DataSet ds1 = SqlHelper.OpenSqlDataSet(SqlHelper.ConnectionStringLocalTransaction, "select SHOWNAME from [user] where GID ='" + this.hdUserID.Value.Trim() + "'");
if (ds1 != null)
{
if (ds1.Tables[0].Rows.Count > 0)
{
TopSeaiEntity.INPUTBY = ds1.Tables[0].Rows[0]["SHOWNAME"].ToString().Trim();
}
}
//
TopSeaiEntity.OP = this.hd_comboOP.Value.Trim();
TopSeaiEntity.CUSTSERVICE = this.hd_comboCUSTSERVICE.Value.Trim();
TopSeaiEntity.SALE = this.hd_comboSALE.Value.Trim();
TopSeaiEntity.CUSTOMSER = this.hd_comboCUSTOMSER.Value.Trim();
TopSeaiEntity.INSPECTION = this.hd_comboINSPECTION.Value.Trim();
TopSeaiEntity.CARRIER = this.hd_comboCARRIER.Value.Trim();
TopSeaiEntity.TRUCKER = this.hd_comboTRUCKER.Value.Trim();
TopSeaiEntity.BSSOURCE = this.hd_comboBSSOURCE.Value.Trim();
TopSeaiEntity.BSSOURCEDETAIL = this.hd_comboBSSOURCEDETAIL.Value.Trim();
TopSeaiEntity.CONTRACTNO = tbCONTRACTNO.Text.Trim();
TopSeaiEntity.CORPID = this.hdCOMPANYID.Value;
TopSeaiEntity.SALEDEPT = this.hd_comboSALEDEPT.Value.Trim();
//
TopSeaiEntity.COUNTRYOFORIGIN = tbCOUNTRYOFORIGIN.Text.Trim();
//TopSeaiEntity.NUMBERPLATE = this.hd_comboNUMBERPLATE.Value.Trim();
TopSeaiEntity.NUMBERPLATE = tbNUMBERPLATE.Text.Trim();
TopSeaiEntity.BALES = tbBALES.Text.Trim();
TopSeaiEntity.CUSTOMNO = tbCUSTOMNO.Text.Trim();
TopSeaiEntity.INSPECTIONNO = tbINSPECTIONNO.Text.Trim();
//
Decimal dNETWEIGHT = 0;
if (tbNETWEIGHT.Text.Trim() == "" || tbNETWEIGHT.Text.Trim() == "0" || tbNETWEIGHT.Text.Trim() == "0.0000")
{
TopSeaiEntity.NETWEIGHT = 0;
}
else
{
TopSeaiEntity.NETWEIGHT = Decimal.Parse(Decimal.Parse(tbNETWEIGHT.Text.Trim()).ToString("#.####"));
dNETWEIGHT = Decimal.Parse(Decimal.Parse(tbNETWEIGHT.Text.Trim()).ToString("#.####"));
}
//
if (tbCUSTOMDATE.Text.Trim() != "")
{
TopSeaiEntity.CUSTOMDATE = DateTime.Parse(tbCUSTOMDATE.Text.Trim());
}
//
if (tbINSPECTIONDATE.Text.Trim() != "")
{
TopSeaiEntity.INSPECTIONDATE = DateTime.Parse(tbINSPECTIONDATE.Text.Trim());
}
//
if (tbBSDATE.Text.Trim() != "")
{
TopSeaiEntity.BSDATE = DateTime.Parse(tbBSDATE.Text.Trim());
}
//
if (tbETD.Text.Trim() != "")
{
TopSeaiEntity.ETD = DateTime.Parse(tbETD.Text.Trim());
}
TopSeaiEntity.FBP = int.Parse(tbFBP.Text.Trim());
if (tbBMDDATE.Text.Trim() != "")
{
TopSeaiEntity.BMDDATE = DateTime.Parse(tbBMDDATE.Text.Trim());
}
if (tbMDTDATE.Text.Trim() != "")
{
TopSeaiEntity.MDTDATE = DateTime.Parse(tbMDTDATE.Text.Trim());
}
//
TopSeaiEntity.UNITOFWEIGHT = ddlUNITOFWEIGHT.SelectedValue.ToString().Trim();
TopSeaiEntity.PKGS = int.Parse(tbPKGS.Text.Trim());
TopSeaiEntity.KINDPKGS = this.hd_comboKINDPKGS.Value.ToString().Trim();
TopSeaiEntity.TRADINGAGENCY = this.hd_comboTradingAgency.Value.ToString().Trim();
TopSeaiEntity.GOODSTYPENAME = this.hd_comboGoodsTypeName.Value.ToString().Trim();
TopSeaiEntity.TRADETYPE = this.hd_comboTradeType.Value.ToString().Trim();
TopSeaiEntity.WMSTYPE = this.hd_comboWMSTYPE.Value.ToString().Trim();
TopSeaiEntity.SHOWNAME = this.hd_comboCustContact.Value.ToString().Trim();
TopSeaiEntity.TEL = tbCustTEL.Text.Trim();
TopSeaiEntity.FAX=tbCustFAX.Text.Trim();
TopSeaiEntity.EMAIL=tbCustEMAIL.Text.Trim();
if (tbTARRIFSPAIEDTIEM.Text.Trim()!="")
{
TopSeaiEntity.TARRIFSPAIEDTIEM=DateTime.Parse(tbTARRIFSPAIEDTIEM.Text.Trim());
}
TopSeaiEntity.APPROVENO = tbApproveNo.Text.Trim();
//
if (dNETWEIGHT > sKGS)
{
TopSeaiEntity.MT = dNETWEIGHT;
}
else
{
TopSeaiEntity.MT = sKGS;
}
TopSeaiEntity.REMARK = tbREMARK.Text.Trim();
//
TopSeaiEntity.GRADE = "";
TopSeaiEntity.STORAGENAME = "";
TopSeaiEntity.ISFORCEDTODESPATCH = false;
TopSeaiEntity.BSKGS = 0;
TopSeaiEntity.ACTUALKGS = 0;
TopSeaiEntity.DRAFTKGS = 0;
TopSeaiEntity.WHARFSKGS = 0;
TopSeaiEntity.WMSINKGS = 0;
TopSeaiEntity.YARD = "";
TopSeaiEntity.WMSOUTKGS = 0;
TopSeaiEntity.DIFFERENCEKGS = 0;
TopSeaiEntity.WATERCONTENT = "";
TopSeaiEntity.WATERDENSITY = "";
TopSeaiEntity.CBM =Convert.ToDecimal(this.tbCBM.Text.Trim());//尺码
//货值
if (tbIMPORTVALUE.Text.Trim() == "" || tbIMPORTVALUE.Text.Trim() == "0" || tbIMPORTVALUE.Text.Trim() == "0.00")
{
TopSeaiEntity.IMPORTVALUE = 0;
}
else
{
TopSeaiEntity.IMPORTVALUE = Convert.ToDecimal(this.tbIMPORTVALUE.Text.Trim());
}
//单价
if (tbUNITPRICE.Text.Trim() == "" || tbUNITPRICE.Text.Trim() == "0" || tbUNITPRICE.Text.Trim() == "0.00")
{
TopSeaiEntity.UNITPRICE = 0;
}
else
{
TopSeaiEntity.UNITPRICE = Convert.ToDecimal(this.tbUNITPRICE.Text.Trim());
}
TopSeaiEntity.CURRENCY = this.ddlCURRENCY.SelectedValue.ToString().Trim();//币别
if (this.tbUPDATETIME.Text.Trim() != "")//申报时间
{
TopSeaiEntity.UPDATETIME = Convert.ToDateTime(this.tbUPDATETIME.Text.Trim());
}
//
int iResult = SeaImportInfoDA.InserInfo(TopSeaiEntity, strUserID);
//int iResult = SeaImportInfoDA.InsertTopseaisHBLNOCUSTNO(TopSeaiEntity);
if (iResult > 0)
{
//ViewState["strHandleType"] = "edit";
//this.hdHandle.Value = ViewState["strHandleType"].ToString().Trim();
return true;
}
else
{
return false;
}
}
protected bool getEdit()
{
TopSeaiEntity.MASTERNO = this.hdMASTERNO.Value;
TopSeaiEntity.PARENTID = this.hdPARENTID.Value;
TopSeaiEntity.LEVELS = int.Parse(this.hdLEVELS.Value);
TopSeaiEntity.BSNO = ViewState["GID"].ToString().Trim();
TopSeaiEntity.ACCDATE = tbACCDATE.Text.Trim();
TopSeaiEntity.MBLNO = tbMBLNO.Text.Trim();
TopSeaiEntity.HBLNO = tbHBLNO.Text.Trim();
TopSeaiEntity.CUSTNO = tbCUSTNO.Text.Trim();
TopSeaiEntity.BLTYPE = this.hd_comboBLTYPE.Value.Trim();
TopSeaiEntity.BSTYPE = ddlBSTYPE.Text.Trim();
TopSeaiEntity.CUSTOMERNAME = this.hd_comboCUSTOMERNAME.Value.Trim();
TopSeaiEntity.VESSEL = this.hd_comboVESSEL.Value.Trim();
TopSeaiEntity.VOYNO = this.hd_comboVOYNO.Value.Trim();
TopSeaiEntity.PORTLOADID = "";
TopSeaiEntity.PORTLOAD = this.hd_comboPORTLOAD.Value.Trim();
TopSeaiEntity.PORTDISCHARGEID = "";
TopSeaiEntity.PORTDISCHARGE = this.hd_comboPORTDISCHARGE.Value.Trim();
TopSeaiEntity.GOODSNAME = this.hd_comboGOODSNAME.Value.Trim();
//
Decimal sKGS = 0;
if (tbKGS.Text.Trim() == "" || tbKGS.Text.Trim() == "0" || tbKGS.Text.Trim() == "0.0000")
{
TopSeaiEntity.KGS = 0;
}
else
{
TopSeaiEntity.KGS = Decimal.Parse(Decimal.Parse(tbKGS.Text.Trim()).ToString("#.####"));
sKGS = Decimal.Parse(Decimal.Parse(tbKGS.Text.Trim()).ToString("#.####"));
}
//
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 = this.dvCNTRTOTAL.Value.Trim();
TopSeaiEntity.OP = this.hd_comboOP.Value.Trim();
TopSeaiEntity.CUSTSERVICE = this.hd_comboCUSTSERVICE.Value.Trim();
TopSeaiEntity.SALE = this.hd_comboSALE.Value.Trim();
TopSeaiEntity.CUSTOMSER = this.hd_comboCUSTOMSER.Value.Trim();
TopSeaiEntity.INSPECTION = this.hd_comboINSPECTION.Value.Trim();
TopSeaiEntity.CARRIER = this.hd_comboCARRIER.Value.Trim();
TopSeaiEntity.TRUCKER = this.hd_comboTRUCKER.Value.Trim();
TopSeaiEntity.BSSOURCE = this.hd_comboBSSOURCE.Value.Trim();
TopSeaiEntity.BSSOURCEDETAIL = this.hd_comboBSSOURCEDETAIL.Value.Trim();
TopSeaiEntity.CONTRACTNO = tbCONTRACTNO.Text.Trim();
TopSeaiEntity.CORPID = this.hdCOMPANYID.Value;
TopSeaiEntity.SALEDEPT = this.hd_comboSALEDEPT.Value.Trim();
//
TopSeaiEntity.COUNTRYOFORIGIN = tbCOUNTRYOFORIGIN.Text.Trim();
//TopSeaiEntity.NUMBERPLATE = this.hd_comboNUMBERPLATE.Value.Trim();
TopSeaiEntity.NUMBERPLATE = tbNUMBERPLATE.Text.Trim();
TopSeaiEntity.BALES = tbBALES.Text.Trim();
TopSeaiEntity.CUSTOMNO = tbCUSTOMNO.Text.Trim();
TopSeaiEntity.INSPECTIONNO = tbINSPECTIONNO.Text.Trim();
//
Decimal dNETWEIGHT = 0;
if (tbNETWEIGHT.Text.Trim() == "" || tbNETWEIGHT.Text.Trim() == "0" || tbNETWEIGHT.Text.Trim() == "0.0000")
{
TopSeaiEntity.NETWEIGHT = 0;
}
else
{
TopSeaiEntity.NETWEIGHT = Decimal.Parse(Decimal.Parse(tbNETWEIGHT.Text.Trim()).ToString("#.####"));
dNETWEIGHT = Decimal.Parse(Decimal.Parse(tbNETWEIGHT.Text.Trim()).ToString("#.####"));
}
//
if (tbCUSTOMDATE.Text.Trim() != "")
{
TopSeaiEntity.CUSTOMDATE = DateTime.Parse(tbCUSTOMDATE.Text.Trim());
}
//
if (tbINSPECTIONDATE.Text.Trim() != "")
{
TopSeaiEntity.INSPECTIONDATE = DateTime.Parse(tbINSPECTIONDATE.Text.Trim());
}
//
if (tbBSDATE.Text.Trim() != "")
{
TopSeaiEntity.BSDATE = DateTime.Parse(tbBSDATE.Text.Trim());
}
//
if (tbETD.Text.Trim() != "")
{
TopSeaiEntity.ETD = DateTime.Parse(tbETD.Text.Trim());
}
TopSeaiEntity.FBP = int.Parse(tbFBP.Text.Trim());
if (tbBMDDATE.Text.Trim() != "")
{
TopSeaiEntity.BMDDATE = DateTime.Parse(tbBMDDATE.Text.Trim());
}
if (tbMDTDATE.Text.Trim() != "")
{
TopSeaiEntity.MDTDATE = DateTime.Parse(tbMDTDATE.Text.Trim());
}
//
TopSeaiEntity.UNITOFWEIGHT = ddlUNITOFWEIGHT.SelectedValue.ToString().Trim();
TopSeaiEntity.PKGS = int.Parse(tbPKGS.Text.Trim());
TopSeaiEntity.KINDPKGS = this.hd_comboKINDPKGS.Value.ToString().Trim();
TopSeaiEntity.TRADINGAGENCY = this.hd_comboTradingAgency.Value.ToString().Trim();
TopSeaiEntity.GOODSTYPENAME = this.hd_comboGoodsTypeName.Value.ToString().Trim();
TopSeaiEntity.TRADETYPE = this.hd_comboTradeType.Value.ToString().Trim();
TopSeaiEntity.WMSTYPE = this.hd_comboWMSTYPE.Value.ToString().Trim();
TopSeaiEntity.SHOWNAME= this.hd_comboCustContact.Value.ToString().Trim();
TopSeaiEntity.TEL = tbCustTEL.Text.Trim();
TopSeaiEntity.FAX = tbCustFAX.Text.Trim();
TopSeaiEntity.EMAIL = tbCustEMAIL.Text.Trim();
TopSeaiEntity.APPROVENO = tbApproveNo.Text.Trim();
if (tbTARRIFSPAIEDTIEM.Text.Trim()!="")
{
TopSeaiEntity.TARRIFSPAIEDTIEM=DateTime.Parse(tbTARRIFSPAIEDTIEM.Text.Trim());
}
//
if (dNETWEIGHT > sKGS)
{
TopSeaiEntity.MT = dNETWEIGHT;
}
else
{
TopSeaiEntity.MT = sKGS;
}
TopSeaiEntity.REMARK = tbREMARK.Text.Trim();
//
TopSeaiEntity.GRADE = "";
TopSeaiEntity.STORAGENAME = "";
TopSeaiEntity.ISFORCEDTODESPATCH = false;
TopSeaiEntity.BSKGS = 0;
TopSeaiEntity.ACTUALKGS = 0;
TopSeaiEntity.DRAFTKGS = 0;
TopSeaiEntity.WHARFSKGS = 0;
TopSeaiEntity.WMSINKGS = 0;
TopSeaiEntity.YARD = "";
TopSeaiEntity.WMSOUTKGS = 0;
TopSeaiEntity.DIFFERENCEKGS = 0;
TopSeaiEntity.WATERCONTENT = "";
TopSeaiEntity.WATERDENSITY = "";
TopSeaiEntity.CBM = Convert.ToDecimal(this.tbCBM.Text.Trim());//尺码
//货值
if (tbIMPORTVALUE.Text.Trim() == "" || tbIMPORTVALUE.Text.Trim() == "0" || tbIMPORTVALUE.Text.Trim() == "0.00")
{
TopSeaiEntity.IMPORTVALUE = 0;
}
else
{
TopSeaiEntity.IMPORTVALUE = Convert.ToDecimal(this.tbIMPORTVALUE.Text.Trim());
}
//单价
if (tbUNITPRICE.Text.Trim() == "" || tbUNITPRICE.Text.Trim() == "0" || tbUNITPRICE.Text.Trim() == "0.00")
{
TopSeaiEntity.UNITPRICE = 0;
}
else
{
TopSeaiEntity.UNITPRICE = Convert.ToDecimal(this.tbUNITPRICE.Text.Trim());
}
TopSeaiEntity.CURRENCY = this.ddlCURRENCY.SelectedValue.ToString().Trim();//币别
if (this.tbUPDATETIME.Text.Trim() != "")//申报时间
{
TopSeaiEntity.UPDATETIME = Convert.ToDateTime(this.tbUPDATETIME.Text.Trim());
}
//
int iResult = SeaImportInfoDA.UpdateInfo(TopSeaiEntity, strUserID);
//int iResult = SeaImportInfoDA.UpdateTopseaisHBLNOCUSTNO(TopSeaiEntity);
if (iResult > 0)
{
//this.hdEnter.Value = "1";
//Response.Write("<script>alert('成功提交!');history.back();</script>");
if (iResult == 8)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "key5", "<script>alert('分提单号重复!');</script>");
return false;
}
else if (iResult == 9)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "key6", "<script>alert('委托编号重复!');</script>");
return false;
}
return true;
}
else
{
//this.hdEnter.Value = "0";
//Response.Write("<script>alert('出错,请重新填写!');history.back();</script>");
return false;
}
}
protected void getEnter()
{
bool bl = false;
string alt = "";
strHandleType = ViewState["strHandleType"].ToString();
this.hdHandle.Value = ViewState["strHandleType"].ToString().Trim();
if (ddlBSTYPE.Text.Trim() != "分单")
{
this.hdMASTERNO.Value = ViewState["GID"].ToString().Trim();
}
//
if (strHandleType.Equals("add") || strHandleType.Equals("addfull") || strHandleType.Equals("addhblno"))//新增
{
AttributeManage attributeManager = new AttributeManage();
//主提单号规则
if (tbMBLNO.Text.Trim() != "")
{
//先获取分公司默认主提单号是否允许重复
AttributeCompanyEntity attributeCompanyEntity = (AttributeCompanyEntity)attributeManager.FindAttributeByName("refSubCompanyMBLNO", AttributeType.COMPANYATTRIBUTE, strCompanyID) as AttributeCompanyEntity;
if (attributeCompanyEntity != null)
{
if (attributeCompanyEntity.GID != null)
{
if (attributeCompanyEntity.AttributeValue.ToString().Trim() == "false")
{
alt = T_ALL_DA.GetStrSQL("MBLNO", "select MBLNO from [op_seai] where MBLNO='" + tbMBLNO.Text.Trim() + "'");
if (alt.Trim() != "")
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('主提单号不允许重复!');</script>");
return;
}
}
}
else
{
alt = T_ALL_DA.GetStrSQL("MBLNO", "select MBLNO from [op_seai] where MBLNO='" + tbMBLNO.Text.Trim() + "'");
if (alt.Trim() != "")
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('主提单号不允许重复!');</script>");
return;
}
}
}
else
{
alt = T_ALL_DA.GetStrSQL("MBLNO", "select MBLNO from [op_seai] where MBLNO='" + tbMBLNO.Text.Trim() + "'");
if (alt.Trim() != "")
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('主提单号不允许重复!');</script>");
return;
}
}
}
//分提单号规则
if (tbHBLNO.Text.Trim() == "")
{
tbHBLNO.Text = getCodeRule("分提单号", "HBLNO");//调用编码规则
}
//
//先获取分公司默认分提单号是否允许重复
AttributeCompanyEntity attributeCompanyEntity_2 = (AttributeCompanyEntity)attributeManager.FindAttributeByName("refSubCompanyHBLNO", AttributeType.COMPANYATTRIBUTE, strCompanyID) as AttributeCompanyEntity;
if (attributeCompanyEntity_2 != null)
{
if (attributeCompanyEntity_2.GID != null)
{
if (attributeCompanyEntity_2.AttributeValue.ToString().Trim() == "false")
{
alt = T_ALL_DA.GetStrSQL("HBLNO", "select HBLNO from [op_seai] where HBLNO='" + tbHBLNO.Text.Trim() + "'");
if (alt.Trim() != "")
{
//Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('分提单号重复!');</script>");
tbHBLNO.Text = getCodeRule("分提单号", "HBLNO");//调用编码规则
}
}
}
else
{
alt = T_ALL_DA.GetStrSQL("HBLNO", "select HBLNO from [op_seai] where HBLNO='" + tbHBLNO.Text.Trim() + "'");
if (alt.Trim() != "")
{
//Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('分提单号重复!');</script>");
tbHBLNO.Text = getCodeRule("分提单号", "HBLNO");//调用编码规则
}
}
}
else
{
alt = T_ALL_DA.GetStrSQL("HBLNO", "select HBLNO from [op_seai] where HBLNO='" + tbHBLNO.Text.Trim() + "'");
if (alt.Trim() != "")
{
//Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('分提单号重复!');</script>");
tbHBLNO.Text = getCodeRule("分提单号", "HBLNO");//调用编码规则
}
}
//委托编号规则
if (tbCUSTNO.Text.Trim() == "")
{
tbCUSTNO.Text = getCodeRule("委托编号", "CUSTNO");//调用编码规则
}
alt = T_ALL_DA.GetStrSQL("CUSTNO", "select CUSTNO from [op_seai] where CUSTNO='" + tbCUSTNO.Text.Trim() + "'");
if (alt.Trim() != "")
{
//Page.ClientScript.RegisterStartupScript(this.GetType(), "key2", "<script>alert('委托编号重复!');</script>");
tbCUSTNO.Text = getCodeRule("委托编号", "CUSTNO");//调用编码规则
}
//
bl = getAdd();
}
else if (strHandleType.Equals("edit"))//录入
{
AttributeManage attributeManager = new AttributeManage();
//主提单号规则
if (tbMBLNO.Text.Trim() != "")
{
//先获取分公司默认主提单号是否允许重复
AttributeCompanyEntity attributeCompanyEntity = (AttributeCompanyEntity)attributeManager.FindAttributeByName("refSubCompanyMBLNO", AttributeType.COMPANYATTRIBUTE, strCompanyID) as AttributeCompanyEntity;
if (attributeCompanyEntity != null)
{
if (attributeCompanyEntity.GID != null)
{
if (attributeCompanyEntity.AttributeValue.ToString().Trim() == "false")
{
alt = T_ALL_DA.GetStrSQL("MBLNO", "select MBLNO from [op_seai] where MBLNO='" + tbMBLNO.Text.Trim() + "' and BSNO<>'" + ViewState["GID"].ToString().Trim() + "'");
if (alt.Trim() != "")
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('主提单号不允许重复!');</script>");
return;
}
}
}
else
{
alt = T_ALL_DA.GetStrSQL("MBLNO", "select MBLNO from [op_seai] where MBLNO='" + tbMBLNO.Text.Trim() + "' and BSNO<>'" + ViewState["GID"].ToString().Trim() + "'");
if (alt.Trim() != "")
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('主提单号不允许重复!');</script>");
return;
}
}
}
else
{
alt = T_ALL_DA.GetStrSQL("MBLNO", "select MBLNO from [op_seai] where MBLNO='" + tbMBLNO.Text.Trim() + "' and BSNO<>'" + ViewState["GID"].ToString().Trim() + "'");
if (alt.Trim() != "")
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('主提单号不允许重复!');</script>");
return;
}
}
}
//分提单号规则
if (tbHBLNO.Text.Trim() == "")
{
tbHBLNO.Text = getCodeRule("分提单号", "HBLNO");//调用编码规则
}
//
//先获取分公司默认分提单号是否允许重复
AttributeCompanyEntity attributeCompanyEntity_2 = (AttributeCompanyEntity)attributeManager.FindAttributeByName("refSubCompanyHBLNO", AttributeType.COMPANYATTRIBUTE, strCompanyID) as AttributeCompanyEntity;
if (attributeCompanyEntity_2 != null)
{
if (attributeCompanyEntity_2.GID != null)
{
if (attributeCompanyEntity_2.AttributeValue.ToString().Trim() == "false")
{
alt = T_ALL_DA.GetStrSQL("HBLNO", "select HBLNO from [op_seai] where HBLNO='" + tbHBLNO.Text.Trim() + "' and BSNO<>'" + ViewState["GID"].ToString().Trim() + "'");
if (alt.Trim() != "")
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "key5", "<script>alert('分提单号重复!');</script>");
return;
}
}
}
else
{
alt = T_ALL_DA.GetStrSQL("HBLNO", "select HBLNO from [op_seai] where HBLNO='" + tbHBLNO.Text.Trim() + "' and BSNO<>'" + ViewState["GID"].ToString().Trim() + "'");
if (alt.Trim() != "")
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "key5", "<script>alert('分提单号重复!');</script>");
return;
}
}
}
else
{
alt = T_ALL_DA.GetStrSQL("HBLNO", "select HBLNO from [op_seai] where HBLNO='" + tbHBLNO.Text.Trim() + "' and BSNO<>'" + ViewState["GID"].ToString().Trim() + "'");
if (alt.Trim() != "")
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "key5", "<script>alert('分提单号重复!');</script>");
return;
}
}
//委托编号规则
//
if (tbCUSTNO.Text.Trim() == "")
{
tbCUSTNO.Text = T_ALL_DA.GetStrSQL("CUSTNO", "select CUSTNO from [op_seai] where BSNO='" + ViewState["GID"].ToString().Trim() + "'");
if (tbCUSTNO.Text.Trim() == "")
{
tbCUSTNO.Text = getCodeRule("委托编号", "CUSTNO");//调用编码规则
}
}
else
{
alt = T_ALL_DA.GetStrSQL("CUSTNO", "select CUSTNO from [op_seai] where CUSTNO='" + tbCUSTNO.Text.Trim() + "' and BSNO<>'" + ViewState["GID"].ToString().Trim() + "'");
if (alt.Trim() != "")
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "key6", "<script>alert('委托编号重复!');</script>");
return;
}
}
//
bl = getEdit();
}
this.hdEnter.Value = "1";
//
if (bl)
{
//
ibDel.Enabled = true;
ibAdd.Enabled = true;
ibFullAdd.Enabled = true;
//
Page.ClientScript.RegisterStartupScript(this.GetType(), "key7", "<script>reloadParent('" + ViewState["GID"].ToString().Trim() + "','" + strHandleType.Trim() + "');</script>");
}
else
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "key8", "<script>alert('出错,请重新填写!');</script>");
}
}
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") || strHandleType.Equals("addfull") || strHandleType.Equals("addhblno"))//新增
{
bl = getAdd();
}
else if (strHandleType.Equals("edit"))//录入
{
bl = getEdit();
}
//
if (bl)
{
//
ibDel.Enabled = true;
ibAdd.Enabled = true;
ibFullAdd.Enabled = true;
//
this.hdEnter.Value = "1";
//System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport30", "reloadParent('" + ViewState["GID"].ToString().Trim() + "','" + strHandleType .Trim()+ "');", true);
//System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport30", "alert('成功提交!');", true);
//Response.Write("<script>alert('成功提交!');history.back();</script>");
//Page.RegisterStartupScript("103", "<script>reloadParent('" + ViewState["GID"].ToString().Trim() + "','" + strHandleType .Trim()+ "');</script>");
//return;
}
else
{
this.hdEnter.Value = "0";
//Page.RegisterStartupScript("103", "<script>reloadParent('" + ViewState["GID"].ToString().Trim() + "','" + strHandleType .Trim()+ "');</script>");
//System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport31", "alert('出错,请重新填写!');", true);
//Response.Write("<script>alert('出错,请重新填写!');history.back();</script>");
//return;
}
}
protected void ibAddHblno_Click(object sender, EventArgs e)
{
ViewState["strHandleType"] = "addhblno";
this.hdHandle.Value = ViewState["strHandleType"].ToString().Trim();
//
this.hdMASTERNO.Value = TopSeaiEntity.MASTERNO.ToString().Trim();
this.hdPARENTID.Value = TopSeaiEntity.BSNO.ToString().Trim();
this.hdLEVELS.Value = (int.Parse(TopSeaiEntity.LEVELS.ToString().Trim()) + 1).ToString();
ViewState["GID"] = getBSNO();
//
this.dvOrderNumVal.Value = ViewState["GID"].ToString().Trim();
this.hdGid.Value = ViewState["GID"].ToString().Trim();
lbBSSTATUS.Text = "未锁定"; //"接受委托";
lbFEESTATUS.Text = "未锁定";
this.hd_comboBLTYPE.Value = "整箱";
ddlBSTYPE.Text = "分单";
//tbACCDATE.Enabled = true;
//this.hd_comboBLTYPE.Disabled = false;
tbACCDATE.Text = DateTime.Parse(strdate).Year.ToString().Trim() + "-" + DateTime.Parse(strdate).Month.ToString().Trim();
//
//
string strnum = T_ALL_DA.GetStrSQL("num", "select (count(*)+1) as num from op_Seai where PARENTID='" + this.hdPARENTID.Value.Trim() + "'");
tbMBLNO.Text = TopSeaiEntity.MBLNO.ToString().Trim() + "-" + strnum;
//
tbHBLNO.Text = "";//调用编码规则
tbCUSTNO.Text = "";//调用编码规则
//tbHBLNO.Text = getCodeRule("分提单号", "HBLNO");//调用编码规则
//tbCUSTNO.Text = getCodeRule("委托编号", "CUSTNO");//调用编码规则
//
ibDel.Enabled = false;
ibAdd.Enabled = false;
ibFullAdd.Enabled = false;
}
protected void ibFullAdd_Click(object sender, EventArgs e)
{
//Session["USERID"] = "04eaeac5-f271-45d1-b17b-ad4ccbab63d0";
ViewState["strHandleType"] = "addfull";
this.hdHandle.Value = ViewState["strHandleType"].ToString().Trim();
ViewState["GID"] = getBSNO();
this.hdMASTERNO.Value = ViewState["GID"].ToString().Trim();
this.hdPARENTID.Value = ViewState["GID"].ToString().Trim();
this.hdLEVELS.Value = "0";
//
this.dvOrderNumVal.Value = ViewState["GID"].ToString().Trim();
//this.dvOrderNumVal_2.Value = ViewState["GID"].ToString().Trim();
this.hdGid.Value = ViewState["GID"].ToString().Trim();
lbBSSTATUS.Text = "未锁定"; //"接受委托";
lbFEESTATUS.Text = "未锁定";
this.hd_comboBLTYPE.Value = "整箱";
ddlBSTYPE.Text = "普通货";
//tbACCDATE.Enabled = true;
//this.hd_comboBLTYPE.Disabled = false;
tbACCDATE.Text = DateTime.Parse(strdate).Year.ToString().Trim() + "-" + DateTime.Parse(strdate).Month.ToString().Trim();
//
tbHBLNO.Text = "";//调用编码规则
tbCUSTNO.Text = "";//调用编码规则
//tbHBLNO.Text = getCodeRule("分提单号", "HBLNO");//调用编码规则
//tbCUSTNO.Text = getCodeRule("委托编号", "CUSTNO");//调用编码规则
//
ibDel.Enabled = false;
ibAdd.Enabled = false;
ibFullAdd.Enabled = false;
}
protected void ibAdd_Click(object sender, EventArgs e)
{
//Session["USERID"] = "04eaeac5-f271-45d1-b17b-ad4ccbab63d0";
ViewState["strHandleType"] = "add";
this.hdHandle.Value = ViewState["strHandleType"].ToString().Trim();
ViewState["GID"] = getBSNO();
this.hdMASTERNO.Value = ViewState["GID"].ToString().Trim();
this.hdPARENTID.Value = ViewState["GID"].ToString().Trim();
this.hdLEVELS.Value = "0";
//
this.dvOrderNumVal.Value = ViewState["GID"].ToString().Trim();
//this.dvOrderNumVal_2.Value = ViewState["GID"].ToString().Trim();
this.hdGid.Value = ViewState["GID"].ToString().Trim();
lbBSSTATUS.Text = "未锁定"; //"接受委托";
lbFEESTATUS.Text = "未锁定";
this.hd_comboBLTYPE.Value = "整箱";
ddlBSTYPE.Text = "普通货";
//tbACCDATE.Enabled = true;
//this.hd_comboBLTYPE.Disabled = false;
//
tbACCDATE.Text = DateTime.Parse(strdate).Year.ToString().Trim() + "-" + DateTime.Parse(strdate).Month.ToString().Trim();
tbETD.Text = "";
tbKGS.Text = "0";
this.hd_comboBSSOURCE.Value = "自揽货";
this.hd_comboOP.Value = T_ALL_DA.GetStrSQL("SHOWNAME", "select SHOWNAME from [user] where GID='" + this.hdUserID.Value.Trim() + "'");
//
tbMBLNO.Text = "";
tbHBLNO.Text = "";
tbCUSTNO.Text = "";
tbHBLNO.Text = "";//调用编码规则
tbCUSTNO.Text = "";//调用编码规则
//tbHBLNO.Text = getCodeRule("分提单号", "HBLNO");//调用编码规则
//tbCUSTNO.Text = getCodeRule("委托编号", "CUSTNO");//调用编码规则
this.hd_comboCUSTOMERNAME.Value = "";
this.hd_comboVESSEL.Value = "";
this.hd_comboVOYNO.Value = "";
this.hd_comboPORTLOAD.Value = "";
this.hd_comboPORTDISCHARGE.Value = T_ALL_DA.GetStrSQL("PORTLOAD", "select PORTLOAD from subcomp_seae_def where CORPID=(select GID from company where GID='" + this.hdCOMPANYID.Value.Trim() + "' and ISDELETED=0)");
this.hd_comboGOODSNAME.Value = "";
this.hd_comboCUSTSERVICE.Value = "";
this.hd_comboSALE.Value = "";
this.hd_comboCUSTOMSER.Value = "";
this.hd_comboINSPECTION.Value = "";
this.hd_comboCARRIER.Value = "";
this.hd_comboTRUCKER.Value = "";
this.hd_comboBSSOURCEDETAIL.Value = "";
tbCONTRACTNO.Text = "";
this.hd_comboSALEDEPT.Value = "";
//
tbCOUNTRYOFORIGIN.Text = "";
//this.hd_comboNUMBERPLATE.Value = "";
tbNUMBERPLATE.Text = "";
tbBALES.Text = "";
tbCUSTOMNO.Text = "";
tbINSPECTIONNO.Text = "";
tbNETWEIGHT.Text = "0";
tbCUSTOMDATE.Text = "";
tbINSPECTIONDATE.Text = "";
tbBSDATE.Text = strRQ;
//
tbETD.Text = "";
tbFBP.Text = "0";
tbBMDDATE.Text = "";
tbMDTDATE.Text = "";
ddlUNITOFWEIGHT.SelectedValue = "吨";
tbPKGS.Text = "0";
this.hd_comboKINDPKGS.Value = "";
this.hd_comboTradingAgency.Value = "";
this.hd_comboGoodsTypeName.Value="";
this.hd_comboTradeType.Value="";
this.hd_comboWMSTYPE.Value = "";
this.hd_comboCustContact.Value="";
tbCustTEL.Text="";
tbCustFAX.Text="";
tbCustEMAIL.Text = "";
tbREMARK.Text = "";
this.tbCBM.Text = "0.0000";
//
ibDel.Enabled = false;
ibAdd.Enabled = false;
ibFullAdd.Enabled = false;
}
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", "<script>alert('当前业务为锁定状态,不允许删除此业务!');</script>");//业务封帐
return;
}
//
if (lbBSSTATUS.Text.Trim() != "普通货")//接受委托
{
string ls = T_ALL_DA.GetStrSQL("num", "select count(*) num from op_seai where PARENTID='" + ViewState["GID"].ToString().Trim() + "'");
if (ls.Trim() != "0")
{
bl = true;
Page.ClientScript.RegisterStartupScript(this.GetType(), "key3", "<script>alert('当前业务有分单,不允许删除此业务!');</script>");//业务封帐
return;
}
}
//
//if (strShowName.Trim() != this.hd_comboOP.Value.Trim())
//{
// Page.ClientScript.RegisterStartupScript(this.GetType(), "key3", "<script>alert('您不是当前业务的操作,无删除此业务的权限!');</script>");
// return;
//}
//
string alt = T_ALL_DA.GetSeaImportInfoDel(ViewState["GID"].ToString().Trim(), bl, this.hdUserID.Value.Trim());
if (alt != "")
{
//System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport50", "alert('" + alt + "');", true);
Response.Write("<script>alert('" + alt + "');history.back();</script>");
return;
}
//Session["USERID"] = "04eaeac5-f271-45d1-b17b-ad4ccbab63d0";
ViewState["strHandleType"] = "add";
this.hdHandle.Value = ViewState["strHandleType"].ToString().Trim();
ViewState["GID"] = getBSNO();
this.dvOrderNumVal.Value = ViewState["GID"].ToString().Trim();
//this.dvOrderNumVal_2.Value = ViewState["GID"].ToString().Trim();
this.hdGid.Value = ViewState["GID"].ToString().Trim();
lbBSSTATUS.Text = "未锁定";//"接受委托";
lbFEESTATUS.Text = "未锁定";
this.hd_comboBLTYPE.Value = "整箱";
ddlBSTYPE.Text = "普通货";
//tbACCDATE.Enabled = true;
//this.hd_comboBLTYPE.Disabled = false;
//
tbACCDATE.Text = DateTime.Parse(strdate).Year.ToString().Trim() + "-" + DateTime.Parse(strdate).Month.ToString().Trim();
tbETD.Text = "";
tbKGS.Text = "0";
this.hd_comboBSSOURCE.Value = "自揽货";
this.hd_comboOP.Value = T_ALL_DA.GetStrSQL("SHOWNAME", "select SHOWNAME from [user] where GID='" + this.hdUserID.Value.Trim() + "'");
tbMBLNO.Text = "";
tbHBLNO.Text = "";
tbCUSTNO.Text = "";
tbHBLNO.Text = "";//调用编码规则
tbCUSTNO.Text = "";//调用编码规则
//tbHBLNO.Text = getCodeRule("分提单号", "HBLNO");//调用编码规则
//tbCUSTNO.Text = getCodeRule("委托编号", "CUSTNO");//调用编码规则
this.hd_comboCUSTOMERNAME.Value = "";
this.hd_comboVESSEL.Value = "";
this.hd_comboVOYNO.Value = "";
this.hd_comboPORTLOAD.Value = "";
this.hd_comboPORTDISCHARGE.Value = T_ALL_DA.GetStrSQL("PORTLOAD", "select PORTLOAD from subcomp_seae_def where CORPID=(select GID from company where GID='" + this.hdCOMPANYID.Value.Trim() + "' and ISDELETED=0)");
this.hd_comboGOODSNAME.Value = "";
this.hd_comboCUSTSERVICE.Value = "";
this.hd_comboSALE.Value = "";
this.hd_comboCUSTOMSER.Value = "";
this.hd_comboINSPECTION.Value = "";
this.hd_comboCARRIER.Value = "";
this.hd_comboTRUCKER.Value = "";
this.hd_comboBSSOURCEDETAIL.Value = "";
tbCONTRACTNO.Text = "";
this.hd_comboSALEDEPT.Value = "";
//
tbCOUNTRYOFORIGIN.Text = "";
//this.hd_comboNUMBERPLATE.Value = "";
tbNUMBERPLATE.Text = "";
tbBALES.Text = "";
tbCUSTOMNO.Text = "";
tbINSPECTIONNO.Text = "";
tbNETWEIGHT.Text = "0";
tbCUSTOMDATE.Text = "";
tbINSPECTIONDATE.Text = "";
tbBSDATE.Text = strRQ;
//
tbETD.Text = "";
tbFBP.Text = "0";
tbBMDDATE.Text = "";
tbMDTDATE.Text = "";
ddlUNITOFWEIGHT.SelectedValue = "吨";
tbPKGS.Text = "0";
this.hd_comboKINDPKGS.Value = "";
this.hd_comboTradingAgency.Value = "";
this.hd_comboGoodsTypeName.Value="";
this.hd_comboTradeType.Value="";
this.hd_comboWMSTYPE.Value = "";
this.hd_comboCustContact.Value = "";
//
tbCustTEL.Text = "";
tbCustFAX.Text = "";
tbCustEMAIL.Text = "";
tbTARRIFSPAIEDTIEM.Text = "";
tbApproveNo.Text = "";
tbREMARK.Text = "";
this.tbCBM.Text = "0.0000";
//
ibDel.Enabled = false;
ibAdd.Enabled = false;
ibFullAdd.Enabled = false;
}
private string TableName()
{
//创建临时表名
string sTableName = "";
sTableName = DateTime.Now.ToString("s");
string sUserCode = "";
sUserCode = Session["UserCode"].ToString().Trim();
sTableName = sUserCode + "TEMP" + sTableName.Substring(0, 4) +
sTableName.Substring(5, 2) +
sTableName.Substring(8, 2) +
sTableName.Substring(11, 2) +
sTableName.Substring(14, 2) +
sTableName.Substring(17, 2);
return sTableName;
}
public bool IsNumeric(string s)
{
int inum = 0;
bool bReturn = true;
try
{
inum = int.Parse(s);
}
catch
{
inum = 0;
bReturn = false;
}
return bReturn;
}
//////////集装箱/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region 集装箱
#region 保存应收账户列表更改结果
/// <summary>
/// 保存应收账户列表更改结果
/// </summary>
/// <param name="tempGroupEntity"></param>
private void SaveRecvTopCtn(JsonTopCtnGroupEntity tempGroupEntity)
{
ViewState["CNTRTOTAL"] = "";
if (tempGroupEntity != null)
{
// 0 1 2 3 4 5 6 7 8 9
// 箱型,箱量,箱号,封号,件数,包装类型,箱内货重,箱皮重,尺码,备注
List<JsonTopCtnEntity> TopCtnEntities = new List<JsonTopCtnEntity>();
TopCtnEntities = tempGroupEntity.JsonTopCtnEntities;
TopCtnDA TopCtnDA = new TopCtnDA();
DataTable TopCtnTable = new DataTable();
string strInitSql = "";
if (tempGroupEntity.JsonTopCtnEntities.Count > 0)
{
string BSNO = tempGroupEntity.JsonTopCtnEntities[0].TopCtn12.Trim();
if (BSNO == "")
{
strInitSql = " SELECT CTN_ID,CTNALL,CTNNUM,CNTRNO,SEALNO,PKGS,KGS,CBM,REMARK,KINDPKGS,TAREWEIGHT FROM op_ctn WHERE 1=1 AND BSNO = '" + ViewState["GID"].ToString().Trim() + "'";
}
else
{
strInitSql = " SELECT CTN_ID,CTNALL,CTNNUM,CNTRNO,SEALNO,PKGS,KGS,CBM,REMARK,KINDPKGS,TAREWEIGHT FROM op_ctn WHERE 1=1 AND BSNO = '" + BSNO + "'";
}
}
else
{
return;
}
TopCtnTable = TopCtnDA.GetExcuteSql(strInitSql).Tables[0];
//取出主提单号
string sMBLNO = "";
TopSeaiEntity = SeaImportInfoDA.GetID(ViewState["GID"].ToString().Trim());
if (TopSeaiEntity.MBLNO != null)
{
sMBLNO = TopSeaiEntity.MBLNO.ToString().Trim();
}
//更新操作SQL语句
ArrayList sqlList = new ArrayList();
//日志操作SQL语句
ArrayList logList = new ArrayList();
//日志记录
Logger log = Logger.Instance;
for (int i = 0; i < TopCtnTable.Rows.Count; i++)
{
foreach (JsonTopCtnEntity TopCtn in TopCtnEntities)
{
if (TopCtnTable.Rows[i]["CTN_ID"].ToString().Trim().Equals(TopCtn.TopCtn1.Trim()))
{
string strSql = "";
string LogContent = "";
LogEntity logEntity = new LogEntity();
#region 更改前后信息对比
//箱型
string strTopCtnCTNALL = TopCtn.TopCtn2.Trim().ToLower().Equals("null") ? "" : TopCtn.TopCtn2.Trim();
if (!TopCtnTable.Rows[i]["CTNALL"].ToString().Trim().Equals(strTopCtnCTNALL))
{
strSql += String.Format(" CTNALL = '{0}'", strTopCtnCTNALL);
LogContent += String.Format(Logger.Instance.GetLogContentTemplate(Logger.LogTypes.UPDATE), "箱型", TopCtnTable.Rows[i]["CTNALL"].ToString().Trim(), strTopCtnCTNALL);
}
//箱量
int strTopCtnCTNNUM = TopCtn.TopCtn3.Equals("null") ? 0 : TopCtn.TopCtn3;
if (!TopCtnTable.Rows[i]["CTNNUM"].ToString().Trim().Equals(strTopCtnCTNNUM))
{
strSql += String.Format(",CTNNUM = '{0}'", strTopCtnCTNNUM);
LogContent += String.Format(Logger.Instance.GetLogContentTemplate(Logger.LogTypes.UPDATE), "箱量", TopCtnTable.Rows[i]["CTNNUM"].ToString().Trim(), strTopCtnCTNNUM);
}
//箱号
string strTopCtnCNTRNO = TopCtn.TopCtn4.Trim().ToLower().Equals("null") ? "" : TopCtn.TopCtn4.Trim();
if (!TopCtnTable.Rows[i]["CNTRNO"].ToString().Trim().Equals(strTopCtnCNTRNO))
{
strSql += String.Format(",CNTRNO = '{0}'", strTopCtnCNTRNO);
LogContent += String.Format(Logger.Instance.GetLogContentTemplate(Logger.LogTypes.UPDATE), "箱号", TopCtnTable.Rows[i]["CNTRNO"].ToString().Trim(), strTopCtnCNTRNO);
}
//封号
string strTopCtnSEALNO = TopCtn.TopCtn5.Trim().ToLower().Equals("null") ? "" : TopCtn.TopCtn5.Trim();
if (!TopCtnTable.Rows[i]["SEALNO"].ToString().Trim().Equals(strTopCtnSEALNO))
{
strSql += String.Format(",SEALNO = '{0}'", strTopCtnSEALNO);
LogContent += String.Format(Logger.Instance.GetLogContentTemplate(Logger.LogTypes.UPDATE), "封号", TopCtnTable.Rows[i]["SEALNO"].ToString().Trim(), strTopCtnSEALNO);
}
//件数
string strTopCtnPKGS = TopCtn.TopCtn6.ToString().Trim().ToLower().Equals("null") ? "" : TopCtn.TopCtn6.ToString().Trim();
if (!TopCtnTable.Rows[i]["PKGS"].ToString().Trim().Equals(strTopCtnPKGS))
{
strSql += String.Format(",PKGS = '{0}'", strTopCtnPKGS);
LogContent += String.Format(Logger.Instance.GetLogContentTemplate(Logger.LogTypes.UPDATE), "件数", TopCtnTable.Rows[i]["PKGS"].ToString().Trim(), strTopCtnPKGS);
}
//包装类型
string strTopCtnKINDPKGS = TopCtn.TopCtn7.Trim().ToLower().Equals("null") ? "" : TopCtn.TopCtn7.Trim();
if (!TopCtnTable.Rows[i]["KINDPKGS"].ToString().Trim().Equals(strTopCtnKINDPKGS))
{
strSql += String.Format(",KINDPKGS = '{0}'", strTopCtnKINDPKGS);
LogContent += String.Format(Logger.Instance.GetLogContentTemplate(Logger.LogTypes.UPDATE), "包装类型", TopCtnTable.Rows[i]["KINDPKGS"].ToString().Trim(), strTopCtnKINDPKGS);
}
//箱内货重
string strTopCtnKGS = TopCtn.TopCtn8.ToString().Trim().ToLower().Equals("null") ? "" : TopCtn.TopCtn8.ToString().Trim();
if (!TopCtnTable.Rows[i]["KGS"].ToString().Trim().Equals(strTopCtnKGS))
{
strSql += String.Format(",KGS = '{0}'", strTopCtnKGS);
LogContent += String.Format(Logger.Instance.GetLogContentTemplate(Logger.LogTypes.UPDATE), "箱内货重", TopCtnTable.Rows[i]["KGS"].ToString().Trim(), strTopCtnKGS);
}
//箱皮重
string strTopCtnTAREWEIGHT = TopCtn.TopCtn9.ToString().Trim().ToLower().Equals("null") ? "" : TopCtn.TopCtn9.ToString().Trim();
if (!TopCtnTable.Rows[i]["TAREWEIGHT"].ToString().Trim().Equals(strTopCtnTAREWEIGHT))
{
strSql += String.Format(",TAREWEIGHT = '{0}'", strTopCtnTAREWEIGHT);
LogContent += String.Format(Logger.Instance.GetLogContentTemplate(Logger.LogTypes.UPDATE), "箱皮重", TopCtnTable.Rows[i]["TAREWEIGHT"].ToString().Trim(), strTopCtnTAREWEIGHT);
}
//尺码
string strTopCtnCBM = TopCtn.TopCtn10.ToString().Trim().ToLower().Equals("null") ? "" : TopCtn.TopCtn10.ToString().Trim();
if (!TopCtnTable.Rows[i]["CBM"].ToString().Trim().Equals(strTopCtnCBM))
{
strSql += String.Format(",CBM = '{0}'", strTopCtnCBM);
LogContent += String.Format(Logger.Instance.GetLogContentTemplate(Logger.LogTypes.UPDATE), "尺码", TopCtnTable.Rows[i]["CBM"].ToString().Trim(), strTopCtnCBM);
}
//备注
string strTopCtnREMARK = TopCtn.TopCtn11.Trim().ToLower().Equals("null") ? "" : TopCtn.TopCtn11.Trim();
if (!TopCtnTable.Rows[i]["REMARK"].ToString().Trim().Equals(strTopCtnREMARK))
{
strSql += String.Format(",REMARK = '{0}'", strTopCtnREMARK);
LogContent += String.Format(Logger.Instance.GetLogContentTemplate(Logger.LogTypes.UPDATE), "备注", TopCtnTable.Rows[i]["REMARK"].ToString().Trim(), strTopCtnREMARK);
}
#endregion
//如果有字段内容更新则执行更新操作
if (LogContent.Trim().Length > 1)
{
if (strSql.Trim().StartsWith(","))
{
strSql = strSql.Trim().Substring(1);
}
string strUpdateSql = String.Format("UPDATE {0} SET {1} WHERE CTN_ID = '{2}'", "op_ctn", strSql, TopCtn.TopCtn1.Trim());
sqlList.Add(strUpdateSql);
logList.Add(String.Format("{0} {1} {2} ", strShowName, "修改主提单号为:“" + sMBLNO.Trim() + "”箱型为:“" + TopCtnTable.Rows[i]["CTNALL"].ToString().Trim() + "”的集装箱内容", LogContent));
}
TopCtnEntities.Remove(TopCtn);
break;
}
}
}
if (sqlList.Count > 0)
{
int iResult = TopCtnDA.UpdateTopCtnFromGrid(sqlList);
//为1表示更新成功
//为-1有异常,更新失败
//为-2更新异常,事务已回滚成功
//更新完成后,记录日志
if (iResult == 1)
{
#region 日志记录操作
// INSERT-"INSERT INTO {0} ({1}) VALUES ({2})" @{0}-所要插入记录的表;{1}记录字段值;{2}-记录新值@
if (logList.Count > 0)
{
for (int i = 0; i < logList.Count; i++)
{
LogEntity logEntity = new LogEntity();
logEntity.GID = Guid.NewGuid().ToString();
logEntity.Name = "更新集装箱列表信息";
logEntity.LogType = "UPDATE 更新操作";
logEntity.CreateUserID = this.hdUserID.Value.Trim();//测试使用数据,正式发布请删除
logEntity.LogContent = logList[i].ToString();
log.WriteLog(logEntity);
}
}
#endregion
}
}
//如果遍历完所有费用表数据,没有相对应的费用信息,则将剩余的费用信息插入到费用表中
if (TopCtnEntities.Count > 0)
{
//插入新的应收费用信息
InsertTopCtn(TopCtnEntities, 1);
}
//
getCNTRTOTAL();
setCNT();
recvJSON = "";
this.recvContainer.Value = "";
}
else
{
recvJSON = "";
this.recvContainer.Value = "";
return;
}
}
#endregion
#region 插入账户信息记录
/// <summary>
/// 插入账户信息记录
/// </summary>
/// <param name="TopCtnEntities">需要插入账户表的账户实体类</param>
/// <param name="iType">如果iType值为1则记录账户类型为收/否则记录为付</param>
public void InsertTopCtn(List<JsonTopCtnEntity> TopCtnEntities, int iType)
{
ViewState["CNTRTOTAL"] = "";
ArrayList sqlInsertList = new ArrayList();
TopCtnDA TopCtnDA = new TopCtnDA();
foreach (JsonTopCtnEntity TopCtn in TopCtnEntities)
{
string strItemSql = "";
string strValueSql = "";
string strInsertSql = "";
//编号
strItemSql += "CTN_ID";
strValueSql += String.Format("'{0}'", TopCtn.TopCtn1.Trim().Equals("null") ? "" : TopCtn.TopCtn1.Trim());
//订舱编号
strItemSql += ",BSNO";
if (TopCtn.TopCtn12.Trim().Equals(""))
{
strValueSql += String.Format(",'{0}'", ViewState["GID"].ToString().Trim());
}
else
{
strValueSql += String.Format(",'{0}'", TopCtn.TopCtn12.Trim().Equals("null") ? ViewState["GID"].ToString().Trim() : TopCtn.TopCtn12.Trim());
}
//箱型
strItemSql += ",CTNALL";
strValueSql += String.Format(",'{0}'", TopCtn.TopCtn2.Trim().Equals("null") ? "" : TopCtn.TopCtn2.Trim());
//箱量
strItemSql += ",CTNNUM";
strValueSql += String.Format(",'{0}'", TopCtn.TopCtn3.Equals("null") ? 0 : TopCtn.TopCtn3);
//箱号
strItemSql += ",CNTRNO";
strValueSql += String.Format(",'{0}'", TopCtn.TopCtn4.Trim().Equals("null") ? "" : TopCtn.TopCtn4.Trim());
//封号
strItemSql += ",SEALNO";
strValueSql += String.Format(",'{0}'", TopCtn.TopCtn5.Trim().Equals("null") ? "" : TopCtn.TopCtn5.Trim());
//件数
strItemSql += ",PKGS";
strValueSql += String.Format(",'{0}'", TopCtn.TopCtn6.Equals("null") ? 0 : TopCtn.TopCtn6);
//包装类型
strItemSql += ",KINDPKGS";
strValueSql += String.Format(",'{0}'", TopCtn.TopCtn7.Trim().Equals("null") ? "" : TopCtn.TopCtn7.Trim());
//箱内货重
strItemSql += ",KGS";
strValueSql += String.Format(",'{0}'", TopCtn.TopCtn8.Equals("null") ? 0 : TopCtn.TopCtn8);
//箱皮重
strItemSql += ",TAREWEIGHT";
strValueSql += String.Format(",'{0}'", TopCtn.TopCtn9.Equals("null") ? 0 : TopCtn.TopCtn9);
//尺码
strItemSql += ",CBM";
strValueSql += String.Format(",'{0}'", TopCtn.TopCtn10.Equals("null") ? 0 : TopCtn.TopCtn10);
//备注
strItemSql += ",REMARK";
strValueSql += String.Format(",'{0}'", TopCtn.TopCtn11.Trim().Equals("null") ? "" : TopCtn.TopCtn11.Trim());
//
if (!strItemSql.Trim().Equals("") && !strValueSql.Trim().Equals(""))
{
if (strItemSql.Trim().StartsWith(","))
{
strItemSql = strItemSql.Trim().Substring(1);
}
if (strValueSql.Trim().StartsWith(","))
{
strValueSql = strValueSql.Trim().Substring(1);
}
strInsertSql = String.Format("INSERT INTO {0} ({1}) VALUES({2})", "op_ctn", strItemSql, strValueSql);
sqlInsertList.Add(strInsertSql);
}
}
if (sqlInsertList.Count > 0)
{
int iResult = TopCtnDA.InsertTopCtnFromGrid(sqlInsertList);
//为1表示更新成功
//为-1有异常,更新失败
//为-2更新异常,事务已回滚成功
//更新完成后,记录日志
if (iResult == 1)
{
//getCNTRTOTAL();
//setCNT();
}
}
}
#endregion
protected void setCNT()
{
DataSet ds = TopCtnDA.GetFieldAll(" and BSNO='" + ViewState["GID"].ToString().Trim() + "'");
if (ds != null)
{
if (ds.Tables[0].Rows.Count > 0)
{
foreach (DataTable myTable in ds.Tables)
{
foreach (DataRow myRow in myTable.Rows)//遍历表
{
string alt = T_ALL_DA.GetCTNCODEInsert("op_seai",ViewState["GID"].ToString().Trim(), this.hdUserID.Value.Trim(), myRow["CTNALL"].ToString().Trim(), int.Parse(myRow["CTNNUM"].ToString().Trim()), myRow["CTN_ID"].ToString().Trim(), myRow["REMARK"].ToString().Trim(), myRow["CNTRNO"].ToString().Trim(), myRow["SEALNO"].ToString().Trim(), myRow["PKGS"].ToString().Trim(), myRow["KGS"].ToString().Trim(), myRow["CBM"].ToString().Trim());
if (alt != "")
{
Response.Write("<script>alert('" + alt + "');history.back();</script>");
return;
}
}
}
}
}
}
protected void getCNTRTOTAL()
{
string strCNTRTOTAL = "";
string strCNTRNO = "";
DataSet ds = TopCtnDA.GetFieldAll(" and BSNO='" + ViewState["GID"].ToString().Trim() + "'");
if (ds != null)
{
if (ds.Tables[0].Rows.Count <= 0)
{
getAdd();
Response.Write("<script>window.opener.location.reload();history.back();</script>");
return;
}
else
{
foreach (DataTable myTable in ds.Tables)
{
foreach (DataRow myRow in myTable.Rows)//遍历表
{
strCNTRNO += myRow["CNTRNO"].ToString().Trim() + "/" + myRow["SEALNO"].ToString().Trim() + "/" + myRow["CTNALL"].ToString().Trim() + "\r\n";
}
}
//
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
ds = T_ALL_DA.GetAllSQL("select CTNALL,sum(CTNNUM) as hj from op_ctn where BSNO='" + ViewState["GID"].ToString().Trim() + "' group by CTNALL order by CTNALL");
foreach (DataTable myTable in ds.Tables)
{
foreach (DataRow myRow in myTable.Rows)//遍历表
{
strCNTRTOTAL += myRow["CTNALL"].ToString().Trim() + "*" + myRow["hj"].ToString().Trim() + " / ";
}
}
strCNTRTOTAL = strCNTRTOTAL.Trim().Substring(0, strCNTRTOTAL.Trim().Length - 1);
}
}
CrmSeaeorderDA CrmSeaeorderDA = new CrmSeaeorderDA();
int iii = CrmSeaeorderDA.UpdateInfoCNTRTOTAL("update op_seai set CNTRTOTAL='" + strCNTRTOTAL + "',CNTRSEALNO='" + strCNTRNO + "' where BSNO='" + ViewState["GID"].ToString().Trim() + "'", this.hdUserID.Value.Trim());
}
#region 获取账户客户保存的账户信息
/// <summary>
/// 获取账户客户保存的账户信息
/// </summary>
/// <param name="tempValue"></param>
/// <returns></returns>
public JsonTopCtnGroupEntity GetPostEntity(string tempValue)
{
JsonTopCtnGroupEntity TopCtnGroupEntity = (JsonTopCtnGroupEntity)JSON.Instance.ToObject(tempValue);
return TopCtnGroupEntity;
}
#endregion
#endregion 集装箱
//////////派车/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region 派车
//#region 保存应收账户列表更改结果
///// <summary>
///// 保存应收账户列表更改结果
///// </summary>
///// <param name="tempGroupEntity"></param>
//private void SaveRecvOpSeaiTruck(JsonOpSeaiTruckGroupEntity tempGroupEntity)
//{
// if (tempGroupEntity != null)
// {
// List<JsonOpSeaiTruckEntity> OpSeaiTruckEntities = new List<JsonOpSeaiTruckEntity>();
// OpSeaiTruckEntities = tempGroupEntity.JsonOpSeaiTruckEntities;
// OpSeaiTruckDA OpSeaiTruckDA = new OpSeaiTruckDA();
// DataTable OpSeaiTruckTable = new DataTable();
// string strInitSql = "";
// if (tempGroupEntity.JsonOpSeaiTruckEntities.Count > 0)
// {
// string BSNO = tempGroupEntity.JsonOpSeaiTruckEntities[0].OpSeaiTruck5.Trim();
// if (BSNO == "")
// {
// strInitSql = " SELECT GID,TRUCKER,TRUCKNO,TRUCKDATE FROM op_seai_truck WHERE 1=1 AND BSNO = '" + ViewState["GID"].ToString().Trim() + "'";
// }
// else
// {
// strInitSql = " SELECT GID,TRUCKER,TRUCKNO,TRUCKDATE FROM op_seai_truck WHERE 1=1 AND BSNO = '" + BSNO + "'";
// }
// }
// else
// {
// return;
// }
// OpSeaiTruckTable = OpSeaiTruckDA.GetExcuteSql(strInitSql).Tables[0];
// //取出主提单号
// string sMBLNO = "";
// TopSeaiEntity = SeaImportInfoDA.GetID(ViewState["GID"].ToString().Trim());
// if (TopSeaiEntity.MBLNO != null)
// {
// sMBLNO = TopSeaiEntity.MBLNO.ToString().Trim();
// }
// //更新操作SQL语句
// ArrayList sqlList = new ArrayList();
// //日志操作SQL语句
// ArrayList logList = new ArrayList();
// //日志记录
// Logger log = Logger.Instance;
// for (int i = 0; i < OpSeaiTruckTable.Rows.Count; i++)
// {
// foreach (JsonOpSeaiTruckEntity OpSeaiTruck in OpSeaiTruckEntities)
// {
// if (OpSeaiTruckTable.Rows[i]["GID"].ToString().Trim().Equals(OpSeaiTruck.OpSeaiTruck1.Trim()))
// {
// string strSql = "";
// string LogContent = "";
// LogEntity logEntity = new LogEntity();
// #region 更改前后信息对比
// //承运车队
// string strOpSeaiTruckTRUCKER = OpSeaiTruck.OpSeaiTruck2.Trim().ToLower().Equals("null") ? "" : OpSeaiTruck.OpSeaiTruck2.Trim();
// if (!OpSeaiTruckTable.Rows[i]["TRUCKER"].ToString().Trim().Equals(strOpSeaiTruckTRUCKER))
// {
// strSql += String.Format(" TRUCKER = '{0}'", strOpSeaiTruckTRUCKER);
// LogContent += String.Format(Logger.Instance.GetLogContentTemplate(Logger.LogTypes.UPDATE), "承运车队", OpSeaiTruckTable.Rows[i]["TRUCKER"].ToString().Trim(), strOpSeaiTruckTRUCKER);
// }
// //车牌号
// string strOpSeaiTruckTRUCKNO = OpSeaiTruck.OpSeaiTruck3.Trim().ToLower().Equals("null") ? "" : OpSeaiTruck.OpSeaiTruck3.Trim();
// if (!OpSeaiTruckTable.Rows[i]["TRUCKNO"].ToString().Trim().Equals(strOpSeaiTruckTRUCKNO))
// {
// strSql += String.Format(" TRUCKNO = '{0}'", strOpSeaiTruckTRUCKNO);
// LogContent += String.Format(Logger.Instance.GetLogContentTemplate(Logger.LogTypes.UPDATE), "车牌号", OpSeaiTruckTable.Rows[i]["TRUCKNO"].ToString().Trim(), strOpSeaiTruckTRUCKNO);
// }
// //拖货日期
// string strOpSeaiTruckTRUCKDATE = OpSeaiTruck.OpSeaiTruck4.ToString().Trim();//.IndexOf("0001")>-1 ? "" : OpSeaiTruck.OpSeaiTruck4;
// if (!OpSeaiTruckTable.Rows[i]["TRUCKDATE"].ToString().Trim().Equals(strOpSeaiTruckTRUCKDATE))
// {
// if (strOpSeaiTruckTRUCKDATE.Trim().IndexOf("0001")>-1 || strOpSeaiTruckTRUCKDATE.Trim().Equals(""))
// {
// strOpSeaiTruckTRUCKDATE = "NULL";
// }
// strSql += String.Format(",TRUCKDATE = '{0}'", strOpSeaiTruckTRUCKDATE);
// LogContent += String.Format(Logger.Instance.GetLogContentTemplate(Logger.LogTypes.UPDATE), "拖货日期", OpSeaiTruckTable.Rows[i]["TRUCKDATE"].ToString().Trim(), strOpSeaiTruckTRUCKDATE);
// }
// #endregion
// //如果有字段内容更新则执行更新操作
// if (LogContent.Trim().Length > 1)
// {
// if (strSql.Trim().StartsWith(","))
// {
// strSql = strSql.Trim().Substring(1);
// }
// string strUpdateSql = String.Format("UPDATE {0} SET {1} WHERE GID = '{2}'", "op_seai_truck", strSql, OpSeaiTruck.OpSeaiTruck1.Trim());
// sqlList.Add(strUpdateSql);
// logList.Add(String.Format("{0} {1} {2} ", strShowName, "修改主提单号为:“" + sMBLNO.Trim() + "” 承运车队为:“" + OpSeaiTruckTable.Rows[i]["TRUCKER"].ToString().Trim() + "”的派车内容", LogContent));
// }
// OpSeaiTruckEntities.Remove(OpSeaiTruck);
// break;
// }
// }
// }
// if (sqlList.Count > 0)
// {
// int iResult = OpSeaiTruckDA.UpdateOpSeaiTruckFromGrid(sqlList);
// //为1表示更新成功
// //为-1有异常,更新失败
// //为-2更新异常,事务已回滚成功
// //更新完成后,记录日志
// if (iResult == 1)
// {
// #region 日志记录操作
// // INSERT-"INSERT INTO {0} ({1}) VALUES ({2})" @{0}-所要插入记录的表;{1}记录字段值;{2}-记录新值@
// if (logList.Count > 0)
// {
// for (int i = 0; i < logList.Count; i++)
// {
// LogEntity logEntity = new LogEntity();
// logEntity.GID = Guid.NewGuid().ToString();
// logEntity.Name = "更新集装箱列表信息";
// logEntity.LogType = "UPDATE 更新操作";
// logEntity.CreateUserID = this.hdUserID.Value.Trim();//测试使用数据,正式发布请删除
// logEntity.LogContent = logList[i].ToString();
// log.WriteLog(logEntity);
// }
// }
// getCNTRTOTAL();
// setCNT();
// #endregion
// }
// }
// //如果遍历完所有费用表数据,没有相对应的费用信息,则将剩余的费用信息插入到费用表中
// if (OpSeaiTruckEntities.Count > 0)
// {
// //插入新的应收费用信息
// InsertOpSeaiTruck(OpSeaiTruckEntities, 1);
// }
// recvJSON = "";
// this.recvContainer.Value = "";
// }
// else
// {
// recvJSON = "";
// this.recvContainer.Value = "";
// return;
// }
//}
//#endregion
//#region 插入账户信息记录
///// <summary>
///// 插入账户信息记录
///// </summary>
///// <param name="OpSeaiTruckEntities">需要插入账户表的账户实体类</param>
///// <param name="iType">如果iType值为1则记录账户类型为收/否则记录为付</param>
//public void InsertOpSeaiTruck(List<JsonOpSeaiTruckEntity> OpSeaiTruckEntities, int iType)
//{
// ArrayList sqlInsertList = new ArrayList();
// OpSeaiTruckDA OpSeaiTruckDA = new OpSeaiTruckDA();
// foreach (JsonOpSeaiTruckEntity OpSeaiTruck in OpSeaiTruckEntities)
// {
// string strItemSql = "";
// string strValueSql = "";
// string strInsertSql = "";
// //编号
// strItemSql += "GID";
// strValueSql += String.Format("'{0}'", OpSeaiTruck.OpSeaiTruck1.Trim().Equals("null") ? "" : OpSeaiTruck.OpSeaiTruck1.Trim());
// //业务编号
// strItemSql += ",BSNO";
// if (OpSeaiTruck.OpSeaiTruck5.Trim().Equals(""))
// {
// strValueSql += String.Format(",'{0}'", ViewState["GID"].ToString().Trim());
// }
// else
// {
// strValueSql += String.Format(",'{0}'", OpSeaiTruck.OpSeaiTruck5.Trim().Equals("null") ? ViewState["GID"].ToString().Trim() : OpSeaiTruck.OpSeaiTruck5.Trim());
// }
// //承运车队
// strItemSql += ",TRUCKER";
// strValueSql += String.Format(",'{0}'", OpSeaiTruck.OpSeaiTruck2.Trim().Equals("null") ? "" : OpSeaiTruck.OpSeaiTruck2.Trim());
// //车牌号
// strItemSql += ",TRUCKNO";
// strValueSql += String.Format(",'{0}'", OpSeaiTruck.OpSeaiTruck3.Trim().Equals("null") ? "" : OpSeaiTruck.OpSeaiTruck3.Trim());
// //拖货日期
// if ((!OpSeaiTruck.OpSeaiTruck4.ToString().Trim().IndexOf("0001")>-1) && (!OpSeaiTruck.OpSeaiTruck4.ToString().Trim().Equals("")))
// {
// strItemSql += ",TRUCKDATE";
// strValueSql += String.Format(",'{0}'", OpSeaiTruck.OpSeaiTruck4.ToString().Trim());
// }
// //
// if (!strItemSql.Trim().Equals("") && !strValueSql.Trim().Equals(""))
// {
// if (strItemSql.Trim().StartsWith(","))
// {
// strItemSql = strItemSql.Trim().Substring(1);
// }
// if (strValueSql.Trim().StartsWith(","))
// {
// strValueSql = strValueSql.Trim().Substring(1);
// }
// strInsertSql = String.Format("INSERT INTO {0} ({1}) VALUES({2})", "op_seai_truck", strItemSql, strValueSql);
// sqlInsertList.Add(strInsertSql);
// }
// }
// if (sqlInsertList.Count > 0)
// {
// int iResult = OpSeaiTruckDA.InsertOpSeaiTruckFromGrid(sqlInsertList);
// //为1表示更新成功
// //为-1有异常,更新失败
// //为-2更新异常,事务已回滚成功
// //更新完成后,记录日志
// if (iResult == 1)
// {
// }
// }
//}
//#endregion
//#region 获取账户客户保存的账户信息
///// <summary>
///// 获取账户客户保存的账户信息
///// </summary>
///// <param name="tempValue"></param>
///// <returns></returns>
//public JsonOpSeaiTruckGroupEntity GetOpSeaiTruckEntity(string tempValue)
//{
// JsonOpSeaiTruckGroupEntity OpSeaiTruckGroupEntity = (JsonOpSeaiTruckGroupEntity)JSON.Instance.ToObject(tempValue);
// return OpSeaiTruckGroupEntity;
//}
//#endregion
//
#endregion
#region 将页面post获取的仓储费率信息保存或更新“仓储费率信息表”wms_rate,并返回操作结果
/// <summary>
/// 将页面post获取的仓储费率信息保存或更新“仓储费率信息表”wms_rate,并返回操作结果
/// </summary>
/*
private void SaveRateAction()
{
IList<WmsRateEntity> rateEntities = new List<WmsRateEntity>();
if (!recvJSON_2.Trim().Equals(""))
{
rateEntities = ResolverecvJSON_2(recvJSON_2.Trim(), rateEntities);
this.recvContainer_2.Value = "";
}
WmsRateDA rateDA = new WmsRateDA();
foreach (WmsRateEntity rateentity in rateEntities)
{
string strwhere = String.Format(" GID='{0}' ", rateentity.GID);
int strExists = rateDA.GetRecordCount(strwhere);
if (strExists == 1)
{
bool iRecvState = rateDA.Update(rateentity);
}
else if (strExists == 0)
{
bool iRecvState = rateDA.Add(rateentity);
}
}
}
*/
#endregion
#region 将页面post获取的仓储费率信息读入到仓储费率实体类wms_rate中
/// <summary>
/// 将页面post获取的仓储费率信息读入到仓储费率实体类wms_rate中
/// </summary>
/// <param name="tempJSON"></param>
/// <param name="tempFeeEntities"></param>
/// <returns>将页面post获取的仓储费率信息读入到仓储费率实体类wms_rate中</returns>
/*
private IList<WmsRateEntity> ResolverecvJSON_2(string tempJSON, IList<WmsRateEntity> tempRateEntities)
{
string strFilter = "";
if (tempJSON.IndexOf("[") >= 0 && tempJSON.IndexOf("]") > 0)
{
strFilter = tempJSON.Substring(tempJSON.IndexOf("[") + 1, tempJSON.IndexOf("]") - tempJSON.IndexOf("[") - 1);
string[] strFees = strFilter.Split(new string[] { "},{" }, System.StringSplitOptions.RemoveEmptyEntries);
if (strFees.Length > 0)
{
for (int i = 0; i < strFees.Length; i++)
{
strFees[i] = strFees[i].ToString().Replace("{", "");
strFees[i] = strFees[i].ToString().Replace("}", "");
string[] strCell = strFees[i].Split(new char[] { ',' });
if (strCell.Length > 0)
{
WmsRateEntity RateEntity = new WmsRateEntity();
for (int j = 0; j < strCell.Length; j++)
{
string[] strArg = strCell[j].Split(new char[] { ':' });
switch (strArg[0].Replace("\"", ""))
{
case "id":
RateEntity.GID = strArg[1].ToString().Replace("\"", "");
break;
//case "cusid":
// RateEntity.CLIENTGID = strArg[1].ToString().Replace("\"", "");
// break;
case "cus":
RateEntity.CUSTOMERNAME = UnicodeToGB(strArg[1].ToString().Replace("\"", ""));
break;
//case "no":
// RateEntity.CONTRACTNO =strArg[1].ToString().Replace("\"", "") ;
// break;
//case "bt":
// RateEntity.STARTTIME = DateTime.Parse(strArg[1].ToString().Replace("\"", ""));
// break;
//case "et":
// RateEntity.ENDTIME = DateTime.Parse(strArg[1].ToString().Replace("\"", ""));
// break;
//case "goods":
// RateEntity.GOODSNAME = strArg[1].ToString().Replace("\"", "");
// break;
case "fgrade":
RateEntity.FEEGRADE = int.Parse(strArg[1].ToString().Replace("\"", ""));
break;
case "fscale":
RateEntity.FEESCALE = int.Parse(strArg[1].ToString().Replace("\"", ""));
break;
case "fprice":
RateEntity.FEEPRICE = decimal.Parse(strArg[1].ToString().Replace("\"", ""));
break;
case "funit":
RateEntity.FEEUNIT = "吨天";
break;
case "remark":
RateEntity.REMARK = strArg[1].ToString().Replace("\"", "");
break;
default:
break;
}
}
RateEntity.BSNO = strSeaBSNO;
RateEntity.CREATEUSER = this.strShowName;
RateEntity.MODIFIEDUSER = this.strShowName;
tempRateEntities.Add(RateEntity);
}
}
}
}
return tempRateEntities;
}
*/
#endregion
#region 上传附件
/// <summary>
/// 上传附件
/// </summary>
/// <returns></returns>
protected string getFU()
{
if (FileUpload1.HasFile == true)//如果用户确实选择了上传控件的浏览按钮,浏览文件成功.
{
string fuName = FileUpload1.FileName.Replace(" ", "_");
string AbsPath = Server.MapPath("FTPFiles/");
string sPath = AbsPath + fuName;
Int32 FileLength = 0;//有可能图片的大小会超出INT的范围所以声明为Int32,当然这和下面大小的判断有关系
FileLength = this.FileUpload1.PostedFile.ContentLength;//获取上传文件的字节大小
//取web中的最大限制数FTPMaxRequestLength
string strFTPMaxRequestLength = System.Configuration.ConfigurationSettings.AppSettings["FTPMaxRequestLength"].ToString() as string;
Int32 iFTPMaxRequestLength = 2091151;
if (strFTPMaxRequestLength == null)
{
iFTPMaxRequestLength = Int32.Parse(strFTPMaxRequestLength);
}
//
if (FileLength > iFTPMaxRequestLength)
{
//Page.ClientScript.RegisterStartupScript(this.GetType(), "key4", "<script>alert('文件最大不能超过4M');</script>");
return "上传文件超过最大限制!";
}
if (File.Exists(sPath)) //判断文件是否寸在
{
//Page.ClientScript.RegisterStartupScript(this.GetType(), "key5", "<script>alert('文件上传FTP失败');</script>");
//return "当前路径下已经存在同名文件!";
}
else
{
//this.FileUpload1.SaveAs(sPath); //保存到服务器的目录,需要根据服务器具体情况修改FileUpload1.FileName会自动获取上传文件名.
this.FileUpload1.PostedFile.SaveAs(sPath);
}
OpSailingDateUrlEntity.GID = getBSNO("SUrl");// 惟一编号
OpSailingDateUrlEntity.LINKGID = strSeaBSNO;// 关联编号
OpSailingDateUrlEntity.AFFIXNAME = fuName;// 附件名称
OpSailingDateUrlEntity.AFFIXURL = "../SeaiInfo/FTPFiles/" + fuName;// 附件地址
OpSailingDateUrlEntity.AFFIXSIZE = FileLength.ToString().Trim();// 附件大小
OpSailingDateUrlEntity.TABLENAME = "op_seai";//
dvOrderNumVal_3.Value = strSeaBSNO;
}
return "";
}
protected String getBSNO(string strName)
{
string strBSNO = Guid.NewGuid().ToString();
strBSNO = strBSNO.Replace("-", "");
strBSNO = strName + strBSNO;
return strBSNO;
}
protected void getFuJianEnter()
{
string strError = getFU();
if (strError.Trim() != "")
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "key0", "<script>alert('" + strError.Trim() + "');</script>");
return;
}
int iResult = OpSailingDateDA.InserInfo(OpSailingDateUrlEntity);
}
#endregion
#region Unicode-GB Code转换
/// <summary>
/// Unicode-GB Code转换
/// </summary>
/// <param name="text">将Unicode编码字符转换成GB编码字符</param>
/// <returns>GB Code字符串</returns>
public string UnicodeToGB(string text)
{
UnicodeEncoding unicode = new UnicodeEncoding();
text = unicode.GetString(unicode.GetBytes(Regex.Unescape(text.Trim())));
return text;
}
/// <summary>
/// Unicode-GB Code转换
/// </summary>
/// <param name="text">将Unicode编码字符转换成GB编码字符</param>
/// <returns>GB Code字符串</returns>
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
}
}