You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Shipping/SeaeOrderInfo.aspx.cs

2501 lines
122 KiB
C#

3 years ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
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 JsonHelper;
using DSWeb.Log;
namespace DSWeb.Shipping
{
public partial class SeaeOrderInfo : PageBase
{
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();
CrmSeaeorderEntity CrmSeaeorderEntity = new CrmSeaeorderEntity();
CrmSeaeorderDA CrmSeaeorderDA = new CrmSeaeorderDA();
CrmSeaeorderctnDA CrmSeaeorderctnDA = new CrmSeaeorderctnDA();
TopSeaeEntity TopSeaeEntity = new TopSeaeEntity();
SeaExportInfoDA SeaExportInfoDA = new SeaExportInfoDA();
RangeDA RangeDA = new RangeDA();
private string recvJSON;
private string strSeaBSNO;
public string strUserID;//用户GID
private string strShowName;//用户登录名
private string strCompanyID;//分公司GID
private string strDeptName;//部门名称
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString().Trim();
this.hdUserID.Value = strUserID.Trim();
}
else
{
Server.Transfer("~/Error/FriendError.aspx");
return;
//strUserID = "";
}
if (Session["COMPANYID"] != null)
{
strCompanyID = Session["COMPANYID"].ToString();
}
if (Session["DEPTNAME"] != null)
{
strDeptName = Session["DEPTNAME"].ToString();
}
if (Session["SHOWNAME"] != null)
{
strShowName = Session["SHOWNAME"].ToString();
}
//
if (!IsPostBack)
{
if (Request.QueryString["handle"] != null)
{
Session["strHandleType"] = Request.QueryString["handle"].ToString();//"edit";
strHandleType = Session["strHandleType"].ToString().Trim();
this.hdHandle.Value = Session["strHandleType"].ToString().Trim();
//
if (Request.QueryString["id"] != null)
{
Session["ORDNO"] = Request.QueryString["id"].ToString();
this.hdGid.Value = Session["ORDNO"].ToString().Trim();
}
if (Request.QueryString["isAudit"] != null)
{
this.hdAudit.Value = Request.QueryString["isAudit"].ToString().Trim();
if (Request.QueryString["isAudit"].ToString().Trim().Equals("1"))
{
getKJFalse();
}
}
//分公司代码
DataSet ds = SqlHelper.OpenSqlDataSet(SqlHelper.ConnectionStringLocalTransaction, "select COMPANYID from user_company where USERID='" + strUserID.Trim() + "'");
if (ds != null)
{
if (ds.Tables[0].Rows.Count > 0)
{
this.hdCOMPANYID.Value = ds.Tables[0].Rows[0]["COMPANYID"].ToString().Trim();
}
else
{
this.hdCOMPANYID.Value = "";
}
}
else
{
this.hdCOMPANYID.Value = "";
}
//
switch (strHandleType)
{
case "add"://新增
getaddnull();
//
ibDel.Enabled = false;
ibAdd.Enabled = false;
ibFullAdd.Enabled = false;
btSubmit.Enabled = false;
break;
case "addfull"://新增
//
lbORSTATUS.Text = "提交审核";
lbORSTATUS.BackColor = System.Drawing.Color.FromArgb(221, 233, 250);
this.isEnabled.Value = "9";
getDivDisplay();
//ddlBLTYPE.Enabled = true;
//服务项目名读取
ISFUMIGATION.Checked = false;//熏蒸
ISSTORAGE.Checked = false;//仓储
ISLAND.Checked = false;//陆运
ISCUSTOMS.Checked = false;//报关
ISBOOKING.Checked = false;//订舱
ISINSPECTION.Checked = false;//报检
ISAGENT.Checked = false;//使用代理
ISHBLNO.Checked = false;//分单签单
//
CrmSeaeorderEntity = CrmSeaeorderDA.GetID(Session["ORDNO"].ToString().Trim());
if (CrmSeaeorderEntity.ORDNO != null)
{
//服务项目名读取
if (CrmSeaeorderEntity.ISFUMIGATION.ToString().Trim() == "True")
{
ISFUMIGATION.Checked = true;//熏蒸
}
if (CrmSeaeorderEntity.ISSTORAGE.ToString().Trim() == "True")
{
ISSTORAGE.Checked = true;//仓储
}
if (CrmSeaeorderEntity.ISLAND.ToString().Trim() == "True")
{
ISLAND.Checked = true;//陆运
}
if (CrmSeaeorderEntity.ISCUSTOMS.ToString().Trim() == "True")
{
ISCUSTOMS.Checked = true;//报关
}
if (CrmSeaeorderEntity.ISINSPECTION.ToString().Trim() == "True")
{
ISINSPECTION.Checked = true;//报检
}
if (CrmSeaeorderEntity.ISBOOKING.ToString().Trim() == "True")
{
ISBOOKING.Checked = true;//订舱
}
if (CrmSeaeorderEntity.ISAGENT.ToString().Trim() == "True")
{
ISAGENT.Checked = true;//使用代理
}
if (CrmSeaeorderEntity.ISHBLNO.ToString().Trim() == "True")
{
ISHBLNO.Checked = true;//分单签单
}
//
this.hd_comboCUSTOMERNAME.Value = CrmSeaeorderEntity.CUSTOMERNAME.ToString().Trim();
this.hd_comboOP.Value = CrmSeaeorderEntity.OP.ToString().Trim();
this.hd_comboDOC.Value = CrmSeaeorderEntity.DOC.ToString().Trim();
//ddlBLTYPE.Text = CrmSeaeorderEntity.BLTYPE.ToString().Trim();
this.hd_comboBLTYPE.Value=CrmSeaeorderEntity.BLTYPE.ToString().Trim();
this.hd_comboSHIPPERID.Value = CrmSeaeorderEntity.SHIPPERID.ToString().Trim();
this.hd_comboCONSIGNEEID.Value = CrmSeaeorderEntity.CONSIGNEEID.ToString().Trim();
this.hd_comboNOTIFYPARTYID.Value = CrmSeaeorderEntity.NOTIFYPARTYID.ToString().Trim();
tbSHIPPER.Text = CrmSeaeorderEntity.SHIPPER.ToString().Trim();
tbCONSIGNEE.Text = CrmSeaeorderEntity.CONSIGNEE.ToString().Trim();
tbNOTIFYPARTY.Text = CrmSeaeorderEntity.NOTIFYPARTY.ToString().Trim();
//
if (CrmSeaeorderEntity.ETD.ToString().Trim().IndexOf("0001")>-1)
{
tbETD.Text = "";
}
else
{
tbETD.Text = CrmSeaeorderEntity.ETD.ToString("yyyy-MM-dd").Trim();
}
//
this.hd_comboPORTLOADID.Value = CrmSeaeorderEntity.PORTLOADID.ToString().Trim();
this.hd_comboPORTLOAD.Value = CrmSeaeorderEntity.PORTLOAD.ToString().Trim();
this.hd_comboPORTDISCHARGEID.Value = CrmSeaeorderEntity.PORTDISCHARGEID.ToString().Trim();
this.hd_comboPORTDISCHARGE.Value = CrmSeaeorderEntity.PORTDISCHARGE.ToString().Trim();
ddlISSUETYPE.Text = CrmSeaeorderEntity.ISSUETYPE.ToString().Trim();
//
tbMARKS.Text = CrmSeaeorderEntity.MARKS.ToString().Trim();
tbDESCRIPTION.Text = CrmSeaeorderEntity.DESCRIPTION.ToString().Trim();
tbPKGS.Text = CrmSeaeorderEntity.PKGS.ToString().Trim();
tbKGS.Text = CrmSeaeorderEntity.KGS.ToString().Trim();
tbCBM.Text = CrmSeaeorderEntity.CBM.ToString().Trim();
tbTOTALNO.Text = CrmSeaeorderEntity.TOTALNO.ToString().Trim();
tbREMARK.Text = CrmSeaeorderEntity.REMARK.ToString().Trim();
//集装箱信息
//gvCNTRBind();
//
this.hd_comboSALE.Value = CrmSeaeorderEntity.SALE.ToString().Trim();
DataSet ds2 = SqlHelper.OpenSqlDataSet(SqlHelper.ConnectionStringLocalTransaction, "select SHOWNAME from [user] where GID ='" + strUserID.Trim() + "'");
if (ds2 != null)
{
if (ds2.Tables[0].Rows.Count > 0)
{
this.hd_comboSALE.Value = ds2.Tables[0].Rows[0]["SHOWNAME"].ToString().Trim();
}
}
this.hd_comboCARRIER.Value = CrmSeaeorderEntity.CARRIER.ToString().Trim();
this.hd_comboFORWARDER.Value = CrmSeaeorderEntity.FORWARDER.ToString().Trim();
if (CrmSeaeorderEntity.ISCOMMISSIONBACK)
{
CheckBox1.Checked = true;
}
else
{
CheckBox1.Checked = false;
}
//结算方式
ddlSTLNAME.Text = CrmSeaeorderEntity.STLNAME.ToString().Trim();
this.hdSTLNAME.Value = CrmSeaeorderEntity.STLNAME.ToString().Trim();
if (CrmSeaeorderEntity.STLDATE.ToString().Trim().IndexOf("0001")>-1)
{
tbSTLDATE.Text = "";
this.hd_STLDATE.Value = "";
}
else
{
tbSTLDATE.Text = CrmSeaeorderEntity.STLDATE.ToString("yyyy-MM-dd").Trim();
this.hd_STLDATE.Value = CrmSeaeorderEntity.STLDATE.ToString("yyyy-MM-dd").Trim();
}
//ddlSTLNAME.Text = T_ALL_DA.GetStrSQL("STLNAME", "select STLNAME from info_client where SHORTNAME='" + CrmSeaeorderEntity.CUSTOMERNAME.ToString().Trim() + "'");
//tbSTLDATE.Text = T_ALL_DA.GetStrSQL("STLDATE", "select STLDATE from info_client where SHORTNAME='" + CrmSeaeorderEntity.CUSTOMERNAME.ToString().Trim() + "'");
//
this.hd_comboBLFRT.Value = CrmSeaeorderEntity.BLFRT.ToString().Trim();
//
Session["ORDNO"] = getBSNO();
this.hdGid.Value = Session["ORDNO"].ToString().Trim();
//
ibDel.Enabled = false;
ibAdd.Enabled = false;
ibFullAdd.Enabled = false;
btSubmit.Enabled = false;
}
else
{
Session["strHandleType"] = "add";
strHandleType = "add";
this.hdHandle.Value = Session["strHandleType"].ToString().Trim();
getaddnull();
//
ibDel.Enabled = false;
ibAdd.Enabled = false;
ibFullAdd.Enabled = false;
btSubmit.Enabled = false;
}
break;
case "edit"://录入
//ddlBLTYPE.Enabled = false;
//服务项目名读取
ISFUMIGATION.Checked = false;//熏蒸
ISSTORAGE.Checked = false;//仓储
ISLAND.Checked = false;//陆运
ISCUSTOMS.Checked = false;//报关
ISBOOKING.Checked = false;//订舱
ISINSPECTION.Checked = false;//报检
ISAGENT.Checked = false;//使用代理
ISHBLNO.Checked = false;//分单签单
//
CrmSeaeorderEntity = CrmSeaeorderDA.GetID(Session["ORDNO"].ToString().Trim());
if (CrmSeaeorderEntity.ORDNO != null)
{
//服务项目名读取
if (CrmSeaeorderEntity.ISFUMIGATION.ToString().Trim() == "True")
{
ISFUMIGATION.Checked = true;//熏蒸
}
if (CrmSeaeorderEntity.ISSTORAGE.ToString().Trim() == "True")
{
ISSTORAGE.Checked = true;//仓储
}
if (CrmSeaeorderEntity.ISLAND.ToString().Trim() == "True")
{
ISLAND.Checked = true;//陆运
}
if (CrmSeaeorderEntity.ISCUSTOMS.ToString().Trim() == "True")
{
ISCUSTOMS.Checked = true;//报关
}
if (CrmSeaeorderEntity.ISINSPECTION.ToString().Trim() == "True")
{
ISINSPECTION.Checked = true;//报检
}
if (CrmSeaeorderEntity.ISBOOKING.ToString().Trim() == "True")
{
ISBOOKING.Checked = true;//订舱
}
if (CrmSeaeorderEntity.ISAGENT.ToString().Trim() == "True")
{
ISAGENT.Checked = true;//使用代理
}
if (CrmSeaeorderEntity.ISHBLNO.ToString().Trim() == "True")
{
ISHBLNO.Checked = true;//分单签单
}
//
if (CrmSeaeorderEntity.ORSTATUS.ToString().Trim().Equals("0"))
{
lbORSTATUS.Text = "审核通过";
}
else if (CrmSeaeorderEntity.ORSTATUS.ToString().Trim().Equals("2"))
{
lbORSTATUS.Text = "驳回,原因:"+CrmSeaeorderEntity.ORREASON.ToString().Trim();
}
else if (CrmSeaeorderEntity.ORSTATUS.ToString().Trim().Equals("1"))
{
lbORSTATUS.Text = "提交审核";
}
else if (CrmSeaeorderEntity.ORSTATUS.ToString().Trim().Equals("9"))
{
lbORSTATUS.Text = "录入状态";
}
this.hd_comboCUSTOMERNAME.Value = CrmSeaeorderEntity.CUSTOMERNAME.ToString().Trim();
this.hd_comboOP.Value = CrmSeaeorderEntity.OP.ToString().Trim();
this.hd_comboDOC.Value = CrmSeaeorderEntity.DOC.ToString().Trim();
//ddlBLTYPE.Text = CrmSeaeorderEntity.BLTYPE.ToString().Trim();
this.hd_comboBLTYPE.Value=CrmSeaeorderEntity.BLTYPE.ToString().Trim();
this.hd_comboSHIPPERID.Value = CrmSeaeorderEntity.SHIPPERID.ToString().Trim();
this.hd_comboCONSIGNEEID.Value = CrmSeaeorderEntity.CONSIGNEEID.ToString().Trim();
this.hd_comboNOTIFYPARTYID.Value = CrmSeaeorderEntity.NOTIFYPARTYID.ToString().Trim();
tbSHIPPER.Text = CrmSeaeorderEntity.SHIPPER.ToString().Trim();
tbCONSIGNEE.Text = CrmSeaeorderEntity.CONSIGNEE.ToString().Trim();
tbNOTIFYPARTY.Text = CrmSeaeorderEntity.NOTIFYPARTY.ToString().Trim();
//
if (CrmSeaeorderEntity.ETD.ToString().Trim().IndexOf("0001")>-1)
{
tbETD.Text = "";
}
else
{
tbETD.Text = CrmSeaeorderEntity.ETD.ToString("yyyy-MM-dd").Trim();
}
//
this.hd_comboPORTLOADID.Value = CrmSeaeorderEntity.PORTLOADID.ToString().Trim();
this.hd_comboPORTLOAD.Value = CrmSeaeorderEntity.PORTLOAD.ToString().Trim();
this.hd_comboPORTDISCHARGEID.Value = CrmSeaeorderEntity.PORTDISCHARGEID.ToString().Trim();
this.hd_comboPORTDISCHARGE.Value = CrmSeaeorderEntity.PORTDISCHARGE.ToString().Trim();
//
tbMARKS.Text = CrmSeaeorderEntity.MARKS.ToString().Trim();
tbDESCRIPTION.Text = CrmSeaeorderEntity.DESCRIPTION.ToString().Trim();
tbPKGS.Text = CrmSeaeorderEntity.PKGS.ToString().Trim();
this.hd_comboKINDPKGS.Value = CrmSeaeorderEntity.KINDPKGS.ToString().Trim();
tbKGS.Text = CrmSeaeorderEntity.KGS.ToString().Trim();
tbCBM.Text = CrmSeaeorderEntity.CBM.ToString().Trim();
tbTOTALNO.Text = CrmSeaeorderEntity.TOTALNO.ToString().Trim();
tbREMARK.Text = CrmSeaeorderEntity.REMARK.ToString().Trim();
//集装箱信息
//gvCNTRBind();
//
this.hd_comboSALE.Value = CrmSeaeorderEntity.SALE.ToString().Trim();
this.hd_comboCARRIER.Value = CrmSeaeorderEntity.CARRIER.ToString().Trim();
this.hd_comboFORWARDER.Value = CrmSeaeorderEntity.FORWARDER.ToString().Trim();
tbOCEANFEE.Text = CrmSeaeorderEntity.OCEANFEE.ToString().Trim();
tbCARRIERATTN.Text=CrmSeaeorderEntity.CARRIERATTN;
tbCARRIERTEL.Text=CrmSeaeorderEntity.CARRIERTEL;
tbCARRIEREMAIL.Text=CrmSeaeorderEntity.CARRIEREMAIL;
tbFORWARDERATTN.Text=CrmSeaeorderEntity.FORWARDERATTN;
tbFORWARDERTEL.Text=CrmSeaeorderEntity.FORWARDERTEL;
tbFORWARDEREMAIL.Text=CrmSeaeorderEntity.FORWARDEREMAIL;
if (CrmSeaeorderEntity.ISCOMMISSIONBACK)
{
CheckBox1.Checked = true;
}
else
{
CheckBox1.Checked = false;
}
//结算方式
ddlSTLNAME.Text = CrmSeaeorderEntity.STLNAME.ToString().Trim();
this.hdSTLNAME.Value = CrmSeaeorderEntity.STLNAME.ToString().Trim();
if (CrmSeaeorderEntity.STLDATE.ToString().Trim().IndexOf("0001")>-1)
{
tbSTLDATE.Text = "";
this.hd_STLDATE.Value = "";
}
else
{
tbSTLDATE.Text = CrmSeaeorderEntity.STLDATE.ToString("yyyy-MM-dd").Trim();
this.hd_STLDATE.Value = CrmSeaeorderEntity.STLDATE.ToString("yyyy-MM-dd").Trim();
}
//ddlSTLNAME.Text = T_ALL_DA.GetStrSQL("STLNAME", "select STLNAME from info_client where SHORTNAME='" + CrmSeaeorderEntity.CUSTOMERNAME.ToString().Trim() + "'");
//tbSTLDATE.Text = T_ALL_DA.GetStrSQL("STLDATE", "select STLDATE from info_client where SHORTNAME='" + CrmSeaeorderEntity.CUSTOMERNAME.ToString().Trim() + "'");
//
this.hd_comboBLFRT.Value = CrmSeaeorderEntity.BLFRT.ToString().Trim();
//业务状态的颜色值
if (CrmSeaeorderEntity.ORSTATUS.Trim().Equals("0"))//审核通过
{
if (this.hdAudit.Value.Trim().Equals("1"))
{
lbORSTATUS.BackColor = System.Drawing.Color.FromArgb(99, 255, 66);
this.isEnabled.Value = "0";
btAudit.Visible = false;
btRejected.Visible = true;
getKJFalse();
}
else
{
lbORSTATUS.BackColor = System.Drawing.Color.FromArgb(99, 255, 66);
this.isEnabled.Value = "0";
getKJFalse();
}
}
else if (CrmSeaeorderEntity.ORSTATUS.Trim().Equals("2"))//驳回
{
if (this.hdAudit.Value.Trim().Equals("1"))
{
lbORSTATUS.BackColor = System.Drawing.Color.FromArgb(255, 255, 66);
this.isEnabled.Value = "2";
btAudit.Visible = true;
btRejected.Visible = false;
getKJFalse();
}
else
{
lbORSTATUS.BackColor = System.Drawing.Color.FromArgb(255, 255, 66);
this.isEnabled.Value = "2";
getKJTrue();
}
}
else if (CrmSeaeorderEntity.ORSTATUS.Trim().Equals("1"))//提交审核
{
if (this.hdAudit.Value.Trim().Equals("1"))
{
lbORSTATUS.BackColor = System.Drawing.Color.FromArgb(255, 255, 66);
this.isEnabled.Value = "1";
btAudit.Visible = true;
btRejected.Visible = true;
getKJFalse();
}
else
{
lbORSTATUS.BackColor = System.Drawing.Color.FromArgb(255, 255, 255);
this.isEnabled.Value = "1";
getKJFalse();
}
}
else
{
if (this.hdAudit.Value.Trim().Equals("1"))
{
this.isEnabled.Value = "9";
getKJFalse();
btAudit.Visible = false;
btRejected.Visible = false;
}
else
{
this.isEnabled.Value = "9";
getKJTrue();
}
}
//
getDivDisplay();
//
ibDel.Enabled = true;
ibAdd.Enabled = true;
ibFullAdd.Enabled = true;
btSubmit.Enabled = true;
}
else
{
Session["strHandleType"] = "add";
strHandleType = "add";
this.hdHandle.Value = Session["strHandleType"].ToString().Trim();
getaddnull();
//
ibDel.Enabled = false;
ibAdd.Enabled = false;
ibFullAdd.Enabled = false;
btSubmit.Enabled = false;
}
break;
}
//权限可视范围
if (this.hdAudit.Value == "0")
{
if (strHandleType.Trim() == "edit")
{
string strV = RangeDA.GetVISIBLERANGE(strUserID.Trim(), "modSeaeOrderList");//销售订舱列表
string strO = RangeDA.GetOPERATERANGE(strUserID.Trim(), "modSeaeOrderList");//销售订舱列表
string alt = "";
if (strV.Trim() != strO.Trim())
{
if (strO.Trim().Equals("0"))//全部
{
}
else if (strO.Trim().Equals("1"))//分公司
{
alt = RangeDA.GetCrmSeaeOrderCompany(strUserID.Trim(), Session["ORDNO"].ToString().Trim());
if (alt == "")
{
getEnabled();
}
ibAdd.Enabled = true;
ibFullAdd.Enabled = true;
}
else if (strO.Trim().Equals("2"))//部门
{
alt = RangeDA.GetCrmSeaeOrderDEPT(strUserID.Trim(), Session["ORDNO"].ToString().Trim());
if (alt == "")
{
getEnabled();
}
ibAdd.Enabled = true;
ibFullAdd.Enabled = true;
}
else if (strO.Trim().Equals("3"))//个人
{
alt = RangeDA.GetCrmSeaeOrderPerson(strUserID.Trim(), Session["ORDNO"].ToString().Trim());
if (alt == "")
{
getEnabled();
}
ibAdd.Enabled = true;
ibFullAdd.Enabled = true;
}
else if (strO.Trim().Equals("4"))//无
{
getEnabled();
}
}
}
else
{
//getEnabledTrue();
}
}
else if (this.hdAudit.Value == "1")
{
if (strHandleType.Trim() == "edit")
{
string strV = RangeDA.GetVISIBLERANGE(strUserID.Trim(), "modSeaeOrderAudit");//销售订舱审核
string strO = RangeDA.GetOPERATERANGE(strUserID.Trim(), "modSeaeOrderAudit");//销售订舱审核
string alt = "";
if (strV.Trim() != strO.Trim())
{
if (strO.Trim().Equals("0"))//全部
{
}
else if (strO.Trim().Equals("1"))//分公司
{
alt = RangeDA.GetCrmSeaeOrderCompany(strUserID.Trim(), Session["ORDNO"].ToString().Trim());
if (alt == "")
{
btAudit.Enabled = false;
divbtRejected.Disabled = true;
}
}
else if (strO.Trim().Equals("2"))//部门
{
alt = RangeDA.GetCrmSeaeOrderDEPT(strUserID.Trim(), Session["ORDNO"].ToString().Trim());
if (alt == "")
{
btAudit.Enabled = false;
divbtRejected.Disabled = true;
}
}
else if (strO.Trim().Equals("3"))//个人
{
alt = RangeDA.GetCrmSeaeOrderPerson(strUserID.Trim(), Session["ORDNO"].ToString().Trim());
if (alt == "")
{
btAudit.Enabled = false;
divbtRejected.Disabled = true;
}
}
else if (strO.Trim().Equals("4"))//无
{
btAudit.Enabled = false;
divbtRejected.Disabled = true;
}
}
}
else
{
btAudit.Enabled = true;
divbtRejected.Disabled = false;
}
}
//
}
else
{
}
}
//集装箱
recvJSON = "";
recvJSON = this.recvContainer.Value.Trim();
if (Session["ORDNO"] != null)
{
if (this.hdEnter.Value != "")
{
getEnter();
}
if (Session["ORDNO"].ToString().Trim().Equals(""))
{
strSeaBSNO = Session["ORDNO"].ToString().Trim();
this.dvOrderNumVal.Value = Session["ORDNO"].ToString().Trim();
}
else
{
strSeaBSNO = Session["ORDNO"].ToString().Trim();
this.dvOrderNumVal.Value = Session["ORDNO"].ToString().Trim();
}
if (!recvJSON.Trim().Equals(""))
{
//应收账户保存
JsonCrmSeaeorderctnGroupEntity CrmSeaeorderctnGroupRecvEntity = GetPostEntity(recvJSON);
List<JsonCrmSeaeorderctnEntity> CrmSeaeorderctnRecvEntities = new List<JsonCrmSeaeorderctnEntity>();
CrmSeaeorderctnRecvEntities = CrmSeaeorderctnGroupRecvEntity.JsonCrmSeaeorderctnEntities;
SaveRecvCrmSeaeorderctn(CrmSeaeorderctnGroupRecvEntity);
//更新完初始化
recvJSON = "";
}
}
else
{
//Response.Write("-1");
//Response.End();
}
//加载下拉框
Page.ClientScript.RegisterStartupScript(this.GetType(), "key0", "<script>initComboOP();initComboDOC();initComboSALE();initComboCUSTOMERNAME();initComboSHIPPERID();initComboCONSIGNEEID();initComboNOTIFYPARTYID();initComboKINDPKGS();initComboCARRIER();initComboFORWARDER();initComboPORTLOAD();initComboPORTDISCHARGE();initComboBLFRT();initComboBLTYPE();</script>");
}
protected void getEnabled()
{
ibAdd.Enabled = false;
ibFullAdd.Enabled = false;
divibEnter.Disabled = true;
imgFresh.Disabled = true;
ibDel.Enabled = false;
btSubmit.Enabled = false;
//
this.hdEnabled.Value = "false";
//
//ddlCUSTOMERNAME.Enabled = false;
//ddlSALE.Enabled = false;
//ddlOP.Enabled = false;
//ddlDOC.Enabled = false;
//ddlBLTYPE.Enabled = false;
ISFUMIGATION.Enabled = false;
ISSTORAGE.Enabled = false;
ISLAND.Enabled = false;
ISCUSTOMS.Enabled = false;
ISINSPECTION.Enabled = false;
ISBOOKING.Enabled = false;
ISAGENT.Enabled = false;
ISHBLNO.Enabled = false;
ddlSTLNAME.Enabled = false;
tbSTLDATE.Enabled = false;
tbOCEANFEE.Enabled = false;
CheckBox1.Enabled = false;
//ddlCARRIER.Enabled = false;
tbCARRIERATTN.Enabled = false;
tbCARRIERTEL.Enabled = false;
tbCARRIEREMAIL.Enabled = false;
//ddlFORWARDER.Enabled = false;
tbFORWARDERATTN.Enabled = false;
tbFORWARDERTEL.Enabled = false;
tbFORWARDEREMAIL.Enabled = false;
//ddlSHIPPERID.Enabled = false;
tbSHIPPER.Enabled = false;
//ddlCONSIGNEEID.Enabled = false;
tbCONSIGNEE.Enabled = false;
//ddlNOTIFYPARTYID.Enabled = false;
tbNOTIFYPARTY.Enabled = false;
tbETD.Enabled = false;
ddlISSUETYPE.Enabled = false;
//ddlPORTLOAD.Enabled = false;
//ddlPORTDISCHARGE.Enabled = false;
tbPKGS.Enabled = false;
//ddlKINDPKGS.Enabled = false;
tbTOTALNO.Enabled = false;
tbKGS.Enabled = false;
tbCBM.Enabled = false;
//
divadd.Disabled = true;
divsave.Disabled = true;
divdel.Disabled = true;
divrollback.Disabled = true;
divrefresh.Disabled = true;
mygrid_container_recv.Disabled = true;
//
tbMARKS.Enabled = false;
tbDESCRIPTION.Enabled = false;
tbREMARK.Enabled = false;
}
protected void getEnabledTrue()
{
ibAdd.Enabled = true;
ibFullAdd.Enabled = true;
divibEnter.Disabled = false;
imgFresh.Disabled = false;
ibDel.Enabled = true;
btSubmit.Enabled = true;
//
this.hdEnabled.Value = "true";
//
//ddlCUSTOMERNAME.Enabled = true;
//ddlSALE.Enabled = true;
//ddlOP.Enabled = true;
//ddlDOC.Enabled = true;
//ddlBLTYPE.Enabled = true;
ISFUMIGATION.Enabled = true;
ISSTORAGE.Enabled = true;
ISLAND.Enabled = true;
ISCUSTOMS.Enabled = true;
ISINSPECTION.Enabled = true;
ISBOOKING.Enabled = true;
ISAGENT.Enabled = true;
ISHBLNO.Enabled = true;
//ddlSTLNAME.Enabled = true;
//tbSTLDATE.Enabled = true;
tbOCEANFEE.Enabled = true;
CheckBox1.Enabled = true;
//ddlCARRIER.Enabled = true;
tbCARRIERATTN.Enabled = true;
tbCARRIERTEL.Enabled = true;
tbCARRIEREMAIL.Enabled = true;
//ddlFORWARDER.Enabled = true;
tbFORWARDERATTN.Enabled = true;
tbFORWARDERTEL.Enabled = true;
tbFORWARDEREMAIL.Enabled = true;
//ddlSHIPPERID.Enabled = true;
tbSHIPPER.Enabled = true;
//ddlCONSIGNEEID.Enabled = true;
tbCONSIGNEE.Enabled = true;
//ddlNOTIFYPARTYID.Enabled = true;
tbNOTIFYPARTY.Enabled = true;
tbETD.Enabled = true;
ddlISSUETYPE.Enabled = true;
//ddlPORTLOAD.Enabled = true;
//ddlPORTDISCHARGE.Enabled = true;
tbPKGS.Enabled = true;
//ddlKINDPKGS.Enabled = true;
tbTOTALNO.Enabled = true;
tbKGS.Enabled = true;
tbCBM.Enabled = true;
//
divadd.Disabled = false;
divsave.Disabled = false;
divdel.Disabled = false;
divrollback.Disabled = false;
divrefresh.Disabled = false;
mygrid_container_recv.Disabled = false;
//
tbMARKS.Enabled = true;
tbDESCRIPTION.Enabled = true;
tbREMARK.Enabled = true;
}
protected void getDivDisplay()
{
if (this.hdAudit.Value.Trim() == "0")
{
this.divadd.Style["display"] = "";
//this.divsave.Style["display"] = "";
this.divrefresh.Style["display"] = "";
this.divdel.Style["display"] = "";
this.divrollback.Style["display"] = "";
//
this.divbtAudit.Style["display"] = "none";
this.divbtRejected.Style["display"] = "none";
//
this.divibAdd.Style["display"] = "";
this.divibAdd.Style["display"] = "";
this.divibFullAdd.Style["display"] = "";
this.divibEnter.Style["display"] = "";
this.imgFresh.Style["display"] = "";
this.divibDel.Style["display"] = "";
this.divbtsSubmit.Style["display"] = "";
//
if (this.isEnabled.Value.Trim() == "0" || this.isEnabled.Value.Trim() == "1")
{
this.divadd.Disabled = true;
//this.divsave.Disabled=true;
this.divrefresh.Disabled = true;
this.divdel.Disabled = true;
this.divrollback.Disabled = true;
//
this.divibAdd.Disabled = false;
this.divibFullAdd.Disabled = false;
this.divibEnter.Disabled = true;
this.imgFresh.Disabled = true;
this.divibDel.Disabled = true;
this.divbtsSubmit.Disabled = true;
//
//ibAdd.Enabled = true;
//ibFullAdd.Enabled = true;
ibDel.Enabled = false;
btSubmit.Enabled = false;
}
else if (this.isEnabled.Value.Trim() == "9")
{
this.divadd.Disabled = false;
//this.divsave.Style["display"] = "";
this.divrefresh.Disabled = false;
this.divdel.Disabled = false;
this.divrollback.Disabled = false;
//
this.divbtAudit.Disabled = true;
btAudit.Enabled = false;
this.divbtRejected.Disabled = true;
//
this.divibAdd.Disabled = false;
this.divibFullAdd.Disabled = false;
this.divibEnter.Disabled = false;
this.imgFresh.Disabled = false;
this.divibDel.Disabled = false;
this.divbtsSubmit.Disabled = false;
//
//ibAdd.Enabled = true;
//ibFullAdd.Enabled = true;
ibDel.Enabled = false;
btSubmit.Enabled = false;
}
else
{
this.divadd.Disabled = false;
//this.divsave.Style["display"] = "";
this.divrefresh.Disabled = false;
this.divdel.Disabled = false;
this.divrollback.Disabled = false;
//
this.divbtAudit.Disabled = true;
btAudit.Enabled = false;
this.divbtRejected.Disabled = true;
//
this.divibAdd.Disabled = false;
this.divibFullAdd.Disabled = false;
this.divibEnter.Disabled = false;
this.imgFresh.Disabled = false;
this.divibDel.Disabled = false;
this.divbtsSubmit.Disabled = false;
//
//ibAdd.Enabled = true;
//ibFullAdd.Enabled = true;
ibDel.Enabled = true;
btSubmit.Enabled = true;
}
}
else if(this.hdAudit.Value.Trim()=="1")
{
this.divadd.Style["display"] = "none";
//this.divsave.Style["display"] = "none";
this.divrefresh.Style["display"] = "none";
this.divdel.Style["display"] = "none";
this.divrollback.Style["display"] = "none";
//
this.divbtAudit.Style["display"] = "";
this.divbtRejected.Style["display"] = "";
//
this.divibAdd.Style["display"] = "none";
this.divibAdd.Style["display"] = "none";
this.divibFullAdd.Style["display"] = "none";
this.divibEnter.Style["display"] = "none";
this.imgFresh.Style["display"] = "none";
this.divibDel.Style["display"] = "none";
this.divbtsSubmit.Style["display"] = "none";
//
if (this.isEnabled.Value.Trim() == "0")
{
this.divbtAudit.Disabled = true;
this.divbtRejected.Disabled = false;
btAudit.Enabled = false;
}
else if (this.isEnabled.Value.Trim() == "1")
{
this.divbtAudit.Disabled = false;
this.divbtRejected.Disabled = false;
btAudit.Enabled = true;
}
else if (this.isEnabled.Value.Trim() == "2")
{
this.divbtAudit.Disabled = false;
this.divbtRejected.Disabled = false;
btAudit.Enabled = true;
}
else
{
this.divbtAudit.Disabled = true;
this.divbtRejected.Disabled = true;
btAudit.Enabled = false;
}
}
}
protected void getKJFalse()
{
ibAdd.Enabled=true;
ibFullAdd.Enabled=true;
ibDel.Enabled = false;
btSubmit.Enabled = false;
//
lbORSTATUS.Enabled=false;
//ddlBLTYPE.Enabled=false;
//cblSERVICE.Enabled = false;
ISFUMIGATION.Enabled = false;//熏蒸
ISSTORAGE.Enabled = false;//仓储
ISLAND.Enabled = false;//陆运
ISCUSTOMS.Enabled = false;//报关
ISBOOKING.Enabled = false;//订舱
ISINSPECTION.Enabled = false;//报检
ISAGENT.Enabled = false;//使用代理
ISHBLNO.Enabled = false;//分单签单
//ddlSTLNAME.Enabled=false;
//tbSTLDATE.Enabled=false;
tbOCEANFEE.Enabled=false;
CheckBox1.Enabled=false;
tbCARRIERATTN.Enabled=false;
tbCARRIERTEL.Enabled=false;
tbCARRIEREMAIL.Enabled=false;
tbFORWARDERATTN.Enabled=false;
tbFORWARDERTEL.Enabled=false;
tbFORWARDEREMAIL.Enabled=false;
tbSHIPPER.Enabled=false;
tbCONSIGNEE.Enabled=false;
tbNOTIFYPARTY.Enabled=false;
tbETD.Enabled=false;
ddlISSUETYPE.Enabled=false;
tbPKGS.Enabled=false;
tbTOTALNO.Enabled=false;
tbKGS.Enabled=false;
tbCBM.Enabled=false;
tbMARKS.Enabled=false;
tbDESCRIPTION.Enabled=false;
tbREMARK.Enabled = false;
//ddlCUSTOMERNAME.Enabled=false;
//ddlSALE.Enabled = false;
//ddlCARRIER.EnableTheming = false;
//ddlFORWARDER.EnableTheming = false;
//ddlSHIPPERID.EnableTheming = false;
//ddlCONSIGNEEID.EnableTheming = false;
//ddlNOTIFYPARTYID.EnableTheming = false;
//ddlPORTLOAD.EnableTheming = false;
//ddlPORTDISCHARGE.EnableTheming = false;
//ddlKINDPKGS.EnableTheming = false;
}
protected void getKJTrue()
{
//ibAdd.Enabled = true;
//ibFullAdd.Enabled = true;
//ibEnter.Enabled = false;
//ibDel.Enabled = false;
//btSubmit.Enabled = false;
//
lbORSTATUS.Enabled = true;
//ddlBLTYPE.Enabled = true;
//cblSERVICE.Enabled = true;
ISFUMIGATION.Enabled = true;//熏蒸
ISSTORAGE.Enabled = true;//仓储
ISLAND.Enabled = true;//陆运
ISCUSTOMS.Enabled = true;//报关
ISBOOKING.Enabled = true;//订舱
ISINSPECTION.Enabled = true;//报检
ISAGENT.Enabled = true;//使用代理
ISHBLNO.Enabled = true;//分单签单
//ddlSTLNAME.Enabled = true;
//tbSTLDATE.Enabled = true;
tbOCEANFEE.Enabled = true;
CheckBox1.Enabled = true;
tbCARRIERATTN.Enabled = true;
tbCARRIERTEL.Enabled = true;
tbCARRIEREMAIL.Enabled = true;
tbFORWARDERATTN.Enabled = true;
tbFORWARDERTEL.Enabled = true;
tbFORWARDEREMAIL.Enabled = true;
tbSHIPPER.Enabled = true;
tbCONSIGNEE.Enabled = true;
tbNOTIFYPARTY.Enabled = true;
tbETD.Enabled = true;
ddlISSUETYPE.Enabled = true;
tbPKGS.Enabled = true;
tbTOTALNO.Enabled = true;
tbKGS.Enabled = true;
tbCBM.Enabled = true;
tbMARKS.Enabled = true;
tbDESCRIPTION.Enabled = true;
tbREMARK.Enabled = true;
//ddlCUSTOMERNAME.EnableTheming=false;
//ddlSALE.EnableTheming = false;
//ddlCARRIER.EnableTheming = false;
//ddlFORWARDER.EnableTheming = false;
//ddlSHIPPERID.EnableTheming = false;
//ddlCONSIGNEEID.EnableTheming = false;
//ddlNOTIFYPARTYID.EnableTheming = false;
//ddlPORTLOAD.EnableTheming = false;
//ddlPORTDISCHARGE.EnableTheming = false;
//ddlKINDPKGS.EnableTheming = false;
}
protected void getaddnull()
{
getEnabledTrue();
//
Session["ORDNO"] = getBSNO();
this.hdGid.Value = Session["ORDNO"].ToString().Trim();
//
lbORSTATUS.Text = "提交审核";
lbORSTATUS.BackColor = System.Drawing.Color.FromArgb(221, 233, 250);
this.isEnabled.Value = "9";
getDivDisplay();
//
this.hd_comboCUSTOMERNAME.Value = "";
this.hd_comboSALE.Value = "";
DataSet ds1 = SqlHelper.OpenSqlDataSet(SqlHelper.ConnectionStringLocalTransaction, "select SHOWNAME from [user] where GID ='" + strUserID.Trim() + "'");
if (ds1 != null)
{
if (ds1.Tables[0].Rows.Count > 0)
{
this.hd_comboSALE.Value = ds1.Tables[0].Rows[0]["SHOWNAME"].ToString().Trim();
}
}
this.hd_comboOP.Value = "";
this.hd_comboDOC.Value = "";
//ddlBLTYPE.Enabled = true;
//ddlBLTYPE.SelectedValue = "整箱";
this.hd_comboBLTYPE.Value="整箱";
//
ddlSTLNAME.SelectedValue = "";
tbSTLDATE.Text = "";
this.hdSTLNAME.Value = "";
this.hd_STLDATE.Value = "";
//
tbOCEANFEE.Text = "";
CheckBox1.Checked = false;
this.hd_comboCARRIER.Value = "";
tbCARRIERATTN.Text = ""; ;
tbCARRIERTEL.Text = ""; ;
tbCARRIEREMAIL.Text = ""; ;
this.hd_comboFORWARDER.Value = "";
tbFORWARDERATTN.Text = ""; ;
tbFORWARDERTEL.Text = ""; ;
tbFORWARDEREMAIL.Text = ""; ;
this.hd_comboSHIPPERID.Value = "";
this.hd_comboCONSIGNEEID.Value = "";
this.hd_comboNOTIFYPARTYID.Value = "";
tbSHIPPER.Text = "";
tbCONSIGNEE.Text = "";
tbNOTIFYPARTY.Text = "";
tbETD.Text = "";
ddlISSUETYPE.SelectedValue = "海运单";
this.hd_comboPORTLOADID.Value = T_ALL_DA.GetStrSQL("PORTLOADID", "select PORTLOADID from subcomp_seae_def where CORPID=(select GID from company where GID='" + this.hdCOMPANYID.Value.Trim() + "' and ISDELETED=0)");
this.hd_comboPORTLOAD.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_comboPORTDISCHARGEID.Value = "";
this.hd_comboPORTDISCHARGE.Value = "";
tbPKGS.Text = "0";
tbTOTALNO.Text = "";
tbKGS.Text = "0";
tbCBM.Text = "0";
tbMARKS.Text = "N/M";
tbDESCRIPTION.Text = "";
tbREMARK.Text = "";
//
this.hd_comboBLFRT.Value = T_ALL_DA.GetStrSQL("BLFRT", "select BLFRT from subcomp_seae_def where CORPID=(select GID from company where GID='" + this.hdCOMPANYID.Value.Trim() + "' and ISDELETED=0)");
//gvCNTRBind();
//服务项目名读取
ISFUMIGATION.Checked = false;//熏蒸
ISSTORAGE.Checked = false;//仓储
ISLAND.Checked = false;//陆运
ISCUSTOMS.Checked = false;//报关
ISBOOKING.Checked = false;//订舱
ISINSPECTION.Checked = false;//报检
ISAGENT.Checked = false;//使用代理
ISHBLNO.Checked = false;//分单签单
//
ibDel.Enabled = false;
ibAdd.Enabled = false;
ibFullAdd.Enabled = false;
btSubmit.Enabled = false;
}
protected String getBSNO()
{
string strBSNO = Guid.NewGuid().ToString();
strBSNO = strBSNO.Replace("-", "");
strBSNO = "Crm" + strBSNO;
return strBSNO;
}
protected bool getAdd()
{
CrmSeaeorderEntity.ORDNO = Session["ORDNO"].ToString().Trim();
CrmSeaeorderEntity.BSNO = Session["ORDNO"].ToString().Trim();
CrmSeaeorderEntity.ORSTATUS = "9";
CrmSeaeorderEntity.BSDATE = DateTime.Today.Date;
CrmSeaeorderEntity.MBLNO = "";
CrmSeaeorderEntity.CUSTOMERNAME = this.hd_comboCUSTOMERNAME.Value.Trim();
CrmSeaeorderEntity.OP = this.hd_comboOP.Value.Trim();
CrmSeaeorderEntity.DOC = this.hd_comboDOC.Value.Trim();
//CrmSeaeorderEntity.BLTYPE = ddlBLTYPE.Text.Trim();
CrmSeaeorderEntity.BLTYPE = this.hd_comboBLTYPE.Value.Trim();
CrmSeaeorderEntity.SHIPPERID = this.hd_comboSHIPPERID.Value.Trim();
CrmSeaeorderEntity.CONSIGNEEID = this.hd_comboCONSIGNEEID.Value.Trim();
CrmSeaeorderEntity.NOTIFYPARTYID = this.hd_comboNOTIFYPARTYID.Value.Trim();
CrmSeaeorderEntity.SHIPPER = tbSHIPPER.Text.Trim();
CrmSeaeorderEntity.CONSIGNEE = tbCONSIGNEE.Text.Trim();
CrmSeaeorderEntity.NOTIFYPARTY = tbNOTIFYPARTY.Text.Trim();
CrmSeaeorderEntity.VESSEL = "";
CrmSeaeorderEntity.VOYNO = "";
if (tbETD.Text.Trim() != "")
{
CrmSeaeorderEntity.ETD = DateTime.Parse(tbETD.Text.Trim());
}
CrmSeaeorderEntity.PlACERECEIPT = "";
CrmSeaeorderEntity.PORTLOADID = this.hd_comboPORTLOADID.Value.Trim();
CrmSeaeorderEntity.PORTLOAD = this.hd_comboPORTLOAD.Value.Trim();
CrmSeaeorderEntity.PORTDISCHARGEID = this.hd_comboPORTDISCHARGEID.Value.Trim();
CrmSeaeorderEntity.PORTDISCHARGE = this.hd_comboPORTDISCHARGE.Value.Trim();
CrmSeaeorderEntity.PLACEDELIVERYID = "";
CrmSeaeorderEntity.PLACEDELIVERY = "";
CrmSeaeorderEntity.DESTINATIONID = "";
CrmSeaeorderEntity.DESTINATION = "";
CrmSeaeorderEntity.NOBILL = "";
CrmSeaeorderEntity.ISSUETYPE = ddlISSUETYPE.Text.Trim();
CrmSeaeorderEntity.ISSUEPLACE = "";
CrmSeaeorderEntity.BLFRT = this.hd_comboBLFRT.Value.Trim();
CrmSeaeorderEntity.SERVICE = T_ALL_DA.GetStrSQL("SERVICE", "select SERVICE from subcomp_seae_def where CORPID=(select GID from company where GID='" + this.hdCOMPANYID.Value.Trim() + "' and ISDELETED=0)");
CrmSeaeorderEntity.MARKS = tbMARKS.Text.Trim();
CrmSeaeorderEntity.NOPKGS = "";
CrmSeaeorderEntity.DESCRIPTION = tbDESCRIPTION.Text.Trim();
CrmSeaeorderEntity.GOODSNAME = "";
if (tbPKGS.Text.Trim() == "")
{
CrmSeaeorderEntity.PKGS = 0;
}
else
{
CrmSeaeorderEntity.PKGS = int.Parse(tbPKGS.Text.Trim());
}
CrmSeaeorderEntity.KINDPKGS = this.hd_comboKINDPKGS.Value.Trim();
if (tbKGS.Text.Trim() == "")
{
CrmSeaeorderEntity.KGS = 0;
}
else
{
CrmSeaeorderEntity.KGS = Decimal.Parse(tbKGS.Text.Trim());
}
if (tbCBM.Text.Trim() == "")
{
CrmSeaeorderEntity.CBM = 0;
}
else
{
CrmSeaeorderEntity.CBM = Decimal.Parse(tbCBM.Text.Trim());
}
CrmSeaeorderEntity.TOTALNO = tbTOTALNO.Text.Trim();
CrmSeaeorderEntity.REMARK = tbREMARK.Text.Trim();
if (ViewState["CNTRTOTAL"] != null)
{
CrmSeaeorderEntity.CNTRTOTAL = ViewState["CNTRTOTAL"].ToString().Trim();
}
else
{
CrmSeaeorderEntity.CNTRTOTAL = "";
}
CrmSeaeorderEntity.GROSSWEIGHT = CrmSeaeorderEntity.KGS.ToString().Trim();
CrmSeaeorderEntity.MEASUREMENT = CrmSeaeorderEntity.CBM.ToString().Trim();
//
CrmSeaeorderEntity.INPUTBY = "";
DataSet ds1 = SqlHelper.OpenSqlDataSet(SqlHelper.ConnectionStringLocalTransaction, "select SHOWNAME from [user] where GID ='" + strUserID.Trim() + "'");
if (ds1 != null)
{
if (ds1.Tables[0].Rows.Count > 0)
{
CrmSeaeorderEntity.INPUTBY = ds1.Tables[0].Rows[0]["SHOWNAME"].ToString().Trim();
}
}
//
CrmSeaeorderEntity.SALE = this.hd_comboSALE.Value.Trim();
CrmSeaeorderEntity.CARRIER = this.hd_comboCARRIER.Value.Trim();
CrmSeaeorderEntity.FORWARDER = this.hd_comboFORWARDER.Value.Trim();
CrmSeaeorderEntity.INVNO = "";
CrmSeaeorderEntity.CARGOID = "";
CrmSeaeorderEntity.DCLASS = "";
CrmSeaeorderEntity.DUNNO = "";
CrmSeaeorderEntity.REEFERF = "";
CrmSeaeorderEntity.TEMPID = "";
CrmSeaeorderEntity.TEMPSET = "";
CrmSeaeorderEntity.TEMPMAX = "";
CrmSeaeorderEntity.TEMPMIN = "";
CrmSeaeorderEntity.CUSTOMSNUM = 0;
CrmSeaeorderEntity.ORDTYPE = "";
CrmSeaeorderEntity.REMARK = "";
CrmSeaeorderEntity.STATUS1 = false;
CrmSeaeorderEntity.STATUS2 = false;
CrmSeaeorderEntity.STATUS3 = false;
CrmSeaeorderEntity.STATUS4 = false;
CrmSeaeorderEntity.STATUS5 = false;
//
CrmSeaeorderEntity.ISFUMIGATION = false;
CrmSeaeorderEntity.ISSTORAGE = false;
CrmSeaeorderEntity.ISLAND = false;
CrmSeaeorderEntity.ISCUSTOMS = false;
CrmSeaeorderEntity.ISINSPECTION = false;
CrmSeaeorderEntity.ISBOOKING = false;
CrmSeaeorderEntity.ISAGENT = false;
CrmSeaeorderEntity.ISHBLNO = false;
CrmSeaeorderEntity.SERVICE9 = false;
CrmSeaeorderEntity.SERVICE10 = false;
//服务项目名读取
CrmSeaeorderEntity.ISFUMIGATION = ISFUMIGATION.Checked;//熏蒸
CrmSeaeorderEntity.ISSTORAGE = ISSTORAGE.Checked;//仓储
CrmSeaeorderEntity.ISLAND = ISLAND.Checked;//陆运
CrmSeaeorderEntity.ISCUSTOMS = ISCUSTOMS.Checked;//报关
CrmSeaeorderEntity.ISINSPECTION = ISINSPECTION.Checked;//报检
CrmSeaeorderEntity.ISBOOKING = ISBOOKING.Checked;//订舱
CrmSeaeorderEntity.ISAGENT = ISAGENT.Checked;//使用代理
CrmSeaeorderEntity.ISHBLNO = ISHBLNO.Checked;//分单签单
//
//CrmSeaeorderEntity.BLTYPE = ddlBLTYPE.Text.Trim();
CrmSeaeorderEntity.BLTYPE = this.hd_comboBLTYPE.Value.Trim();
CrmSeaeorderEntity.PREPARDAT = "";
CrmSeaeorderEntity.PAYABLEAT = "";
//
//CrmSeaeorderEntity.STLNAME = ddlSTLNAME.SelectedValue.Trim();
//if (tbSTLDATE.Text.Trim() != "")
//{
// CrmSeaeorderEntity.STLDATE = DateTime.Parse(tbSTLDATE.Text.Trim());
//}
//else
//{
// CrmSeaeorderEntity.STLDATE = DateTime.Parse("0001-01-01 00:00:00");
//}
CrmSeaeorderEntity.STLNAME = this.hdSTLNAME.Value.Trim();
if (this.hd_STLDATE.Value.Trim() != "")
{
CrmSeaeorderEntity.STLDATE = DateTime.Parse(this.hd_STLDATE.Value.Trim());
}
else
{
CrmSeaeorderEntity.STLDATE = DateTime.Parse("0001-01-01 00:00:00");
}
//
CrmSeaeorderEntity.CARRIERATTN = tbCARRIERATTN.Text.Trim();
CrmSeaeorderEntity.CARRIERTEL = tbCARRIERTEL.Text.Trim();
CrmSeaeorderEntity.CARRIEREMAIL = tbCARRIEREMAIL.Text.Trim();
CrmSeaeorderEntity.FORWARDERATTN = tbFORWARDERATTN.Text.Trim();
CrmSeaeorderEntity.FORWARDERTEL = tbFORWARDERTEL.Text.Trim();
CrmSeaeorderEntity.FORWARDEREMAIL = tbFORWARDEREMAIL.Text.Trim();
if (CheckBox1.Checked)
{
CrmSeaeorderEntity.ISCOMMISSIONBACK = true;
}
else
{
CrmSeaeorderEntity.ISCOMMISSIONBACK = false;
}
//
if (tbOCEANFEE.Text.Trim() == "")
{
CrmSeaeorderEntity.OCEANFEE = 0;
}
else
{
CrmSeaeorderEntity.OCEANFEE = System.Convert.ToDecimal(tbOCEANFEE.Text.Trim());
}
//
int iResult = CrmSeaeorderDA.InserInfo(CrmSeaeorderEntity);
if (iResult > 0)
{
Session["strHandleType"] = "edit";
this.hdHandle.Value = Session["strHandleType"].ToString().Trim();
return true;
}
else
{
return false;
}
}
protected bool getEdit()
{
CrmSeaeorderEntity.ORDNO = Session["ORDNO"].ToString().Trim();
CrmSeaeorderEntity.BSNO = Session["ORDNO"].ToString().Trim();
//
if (lbORSTATUS.Text.Trim().Equals("审核通过"))
{
CrmSeaeorderEntity.ORSTATUS="0";
}
else if (lbORSTATUS.Text.Trim().Equals("驳回"))
{
CrmSeaeorderEntity.ORSTATUS = "9";
}
else if (lbORSTATUS.Text.Trim().Equals("提交审核"))
{
CrmSeaeorderEntity.ORSTATUS = "1";
}
else
{
CrmSeaeorderEntity.ORSTATUS = "9";
}
//
CrmSeaeorderEntity.MBLNO = "";
CrmSeaeorderEntity.CUSTOMERNAME = this.hd_comboCUSTOMERNAME.Value.Trim();
CrmSeaeorderEntity.OP = this.hd_comboOP.Value.Trim();
CrmSeaeorderEntity.DOC = this.hd_comboDOC.Value.Trim();
CrmSeaeorderEntity.SHIPPERID = this.hd_comboSHIPPERID.Value.Trim();
CrmSeaeorderEntity.CONSIGNEEID = this.hd_comboCONSIGNEEID.Value.Trim();
CrmSeaeorderEntity.NOTIFYPARTYID = this.hd_comboNOTIFYPARTYID.Value.Trim();
CrmSeaeorderEntity.SHIPPER = tbSHIPPER.Text.Trim();
CrmSeaeorderEntity.CONSIGNEE = tbCONSIGNEE.Text.Trim();
CrmSeaeorderEntity.NOTIFYPARTY = tbNOTIFYPARTY.Text.Trim();
CrmSeaeorderEntity.VESSEL = "";
CrmSeaeorderEntity.VOYNO = "";
if (tbETD.Text.Trim() != "")
{
CrmSeaeorderEntity.ETD = DateTime.Parse(tbETD.Text.Trim());
}
CrmSeaeorderEntity.PlACERECEIPT = "";
CrmSeaeorderEntity.PORTLOADID = this.hd_comboPORTLOADID.Value.Trim();
CrmSeaeorderEntity.PORTLOAD = this.hd_comboPORTLOAD.Value.Trim();
CrmSeaeorderEntity.PORTDISCHARGEID = this.hd_comboPORTDISCHARGEID.Value.Trim();
CrmSeaeorderEntity.PORTDISCHARGE = this.hd_comboPORTDISCHARGE.Value.Trim();
CrmSeaeorderEntity.PLACEDELIVERYID = "";
CrmSeaeorderEntity.PLACEDELIVERY = "";
CrmSeaeorderEntity.DESTINATIONID = "";
CrmSeaeorderEntity.DESTINATION = "";
CrmSeaeorderEntity.NOBILL = "";
CrmSeaeorderEntity.ISSUETYPE = ddlISSUETYPE.Text.Trim();
CrmSeaeorderEntity.ISSUEPLACE = "";
CrmSeaeorderEntity.BLFRT = this.hd_comboBLFRT.Value.Trim();
CrmSeaeorderEntity.SERVICE = T_ALL_DA.GetStrSQL("SERVICE", "select SERVICE from subcomp_seae_def where CORPID=(select GID from company where GID='" + this.hdCOMPANYID.Value.Trim() + "' and ISDELETED=0)");
CrmSeaeorderEntity.MARKS = tbMARKS.Text.Trim();
CrmSeaeorderEntity.NOPKGS = "";
CrmSeaeorderEntity.DESCRIPTION = tbDESCRIPTION.Text.Trim();
CrmSeaeorderEntity.GOODSNAME = "";
if (tbPKGS.Text.Trim() == "")
{
CrmSeaeorderEntity.PKGS = 0;
}
else
{
CrmSeaeorderEntity.PKGS = int.Parse(tbPKGS.Text.Trim());
}
CrmSeaeorderEntity.KINDPKGS = this.hd_comboKINDPKGS.Value.Trim();
if (tbKGS.Text.Trim() == "")
{
CrmSeaeorderEntity.KGS = 0;
}
else
{
CrmSeaeorderEntity.KGS = Decimal.Parse(tbKGS.Text.Trim());
}
if (tbCBM.Text.Trim() == "")
{
CrmSeaeorderEntity.CBM = 0;
}
else
{
CrmSeaeorderEntity.CBM = Decimal.Parse(tbCBM.Text.Trim());
}
CrmSeaeorderEntity.GROSSWEIGHT = CrmSeaeorderEntity.KGS.ToString().Trim();
CrmSeaeorderEntity.MEASUREMENT = CrmSeaeorderEntity.CBM.ToString().Trim();
//
CrmSeaeorderEntity.TOTALNO = tbTOTALNO.Text.Trim();
CrmSeaeorderEntity.REMARK = tbREMARK.Text.Trim();
if (ViewState["CNTRTOTAL"] != null)
{
CrmSeaeorderEntity.CNTRTOTAL = ViewState["CNTRTOTAL"].ToString().Trim();
}
else
{
CrmSeaeorderEntity.CNTRTOTAL = "";
}
//
CrmSeaeorderEntity.INPUTBY = "";
DataSet ds1 = SqlHelper.OpenSqlDataSet(SqlHelper.ConnectionStringLocalTransaction, "select SHOWNAME from [user] where GID ='" + strUserID.Trim() + "'");
if (ds1 != null)
{
if (ds1.Tables[0].Rows.Count > 0)
{
CrmSeaeorderEntity.INPUTBY = ds1.Tables[0].Rows[0]["SHOWNAME"].ToString().Trim();
}
}
//
CrmSeaeorderEntity.SALE = this.hd_comboSALE.Value.Trim();
CrmSeaeorderEntity.CARRIER = this.hd_comboCARRIER.Value.Trim();
CrmSeaeorderEntity.FORWARDER = this.hd_comboFORWARDER.Value.Trim();
CrmSeaeorderEntity.INVNO = "";
CrmSeaeorderEntity.CARGOID = "";
CrmSeaeorderEntity.DCLASS = "";
CrmSeaeorderEntity.DUNNO = "";
CrmSeaeorderEntity.REEFERF = "";
CrmSeaeorderEntity.TEMPID = "";
CrmSeaeorderEntity.TEMPSET = "";
CrmSeaeorderEntity.TEMPMAX = "";
CrmSeaeorderEntity.TEMPMIN = "";
CrmSeaeorderEntity.CUSTOMSNUM = 0;
CrmSeaeorderEntity.ORDTYPE = "";
CrmSeaeorderEntity.REMARK = "";
CrmSeaeorderEntity.STATUS1 = false;
CrmSeaeorderEntity.STATUS2 = false;
CrmSeaeorderEntity.STATUS3 = false;
CrmSeaeorderEntity.STATUS4 = false;
CrmSeaeorderEntity.STATUS5 = false;
//
CrmSeaeorderEntity.ISFUMIGATION = false;
CrmSeaeorderEntity.ISSTORAGE = false;
CrmSeaeorderEntity.ISLAND = false;
CrmSeaeorderEntity.ISCUSTOMS = false;
CrmSeaeorderEntity.ISINSPECTION = false;
CrmSeaeorderEntity.ISBOOKING = false;
CrmSeaeorderEntity.ISAGENT = false;
CrmSeaeorderEntity.ISHBLNO = false;
CrmSeaeorderEntity.SERVICE9 = false;
CrmSeaeorderEntity.SERVICE10 = false;
//服务项目名读取
CrmSeaeorderEntity.ISFUMIGATION = ISFUMIGATION.Checked;//熏蒸
CrmSeaeorderEntity.ISSTORAGE = ISSTORAGE.Checked;//仓储
CrmSeaeorderEntity.ISLAND = ISLAND.Checked;//陆运
CrmSeaeorderEntity.ISCUSTOMS = ISCUSTOMS.Checked;//报关
CrmSeaeorderEntity.ISINSPECTION = ISINSPECTION.Checked;//报检
CrmSeaeorderEntity.ISBOOKING = ISBOOKING.Checked;//订舱
CrmSeaeorderEntity.ISAGENT = ISAGENT.Checked;//使用代理
CrmSeaeorderEntity.ISHBLNO = ISHBLNO.Checked;//分单签单
//
//CrmSeaeorderEntity.BLTYPE = ddlBLTYPE.Text.Trim();
CrmSeaeorderEntity.BLTYPE = this.hd_comboBLTYPE.Value.Trim();
CrmSeaeorderEntity.PREPARDAT = "";
CrmSeaeorderEntity.PAYABLEAT = "";
//
//CrmSeaeorderEntity.STLNAME = ddlSTLNAME.SelectedValue.Trim();
//if (tbSTLDATE.Text.Trim() != "")
//{
// CrmSeaeorderEntity.STLDATE = DateTime.Parse(tbSTLDATE.Text.Trim());
//}
//else
//{
// CrmSeaeorderEntity.STLDATE = DateTime.Parse("0001-01-01 00:00:00");
//}
CrmSeaeorderEntity.STLNAME = this.hdSTLNAME.Value.Trim();
if (this.hd_STLDATE.Value.Trim() != "")
{
CrmSeaeorderEntity.STLDATE = DateTime.Parse(this.hd_STLDATE.Value.Trim());
}
else
{
CrmSeaeorderEntity.STLDATE = DateTime.Parse("0001-01-01 00:00:00");
}
//
CrmSeaeorderEntity.CARRIERATTN = tbCARRIERATTN.Text.Trim();
CrmSeaeorderEntity.CARRIERTEL = tbCARRIERTEL.Text.Trim();
CrmSeaeorderEntity.CARRIEREMAIL = tbCARRIEREMAIL.Text.Trim();
CrmSeaeorderEntity.FORWARDERATTN = tbFORWARDERATTN.Text.Trim();
CrmSeaeorderEntity.FORWARDERTEL = tbFORWARDERTEL.Text.Trim();
CrmSeaeorderEntity.FORWARDEREMAIL = tbFORWARDEREMAIL.Text.Trim();
if (CheckBox1.Checked)
{
CrmSeaeorderEntity.ISCOMMISSIONBACK = true;
}
else
{
CrmSeaeorderEntity.ISCOMMISSIONBACK = false;
}
//
if (tbOCEANFEE.Text.Trim() == "")
{
CrmSeaeorderEntity.OCEANFEE = 0;
}
else
{
CrmSeaeorderEntity.OCEANFEE = System.Convert.ToDecimal(tbOCEANFEE.Text.Trim());
}
//
int iResult = CrmSeaeorderDA.UpdateInfo(CrmSeaeorderEntity);
if (iResult > 0)
{
//Response.Write("<script>alert('成功提交!');window.opener.location.reload();history.back();</script>");
return true;
}
else
{
//Response.Write("<script>alert('出错,请重新填写!');history.back();</script>");
return false;
}
}
protected void getEnter()
{
if (this.hd_comboOP.Value == "")
{
Response.Write("<script>alert('操作不允许为空!');history.back();</script>");
return;
}
if (this.hd_comboDOC.Value == "")
{
Response.Write("<script>alert('单证不允许为空!');history.back();</script>");
return;
}
bool bl = false;
strHandleType = Session["strHandleType"].ToString();
this.hdHandle.Value = Session["strHandleType"].ToString().Trim();
if (strHandleType.Equals("add"))//新增
{
bl = getAdd();
}
else if (strHandleType.Equals("addfull"))//新增
{
bl = getAdd();
}
else if (strHandleType.Equals("edit"))//录入
{
bl = getEdit();
}
this.hdEnter.Value = "";
//
if (bl)
{
//
ibDel.Enabled = true;
ibAdd.Enabled = true;
ibFullAdd.Enabled = true;
//window.opener.location.reload();history.back();
//Response.Write("<script>alert('成功提交!');</script>");
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>reloadParent('" + Session["ORDNO"].ToString().Trim() + "','" + strHandleType.Trim()+ "');</script>");
return;
}
else
{
Response.Write("<script>alert('出错,请重新填写!');history.back();</script>");
return;
}
}
protected void ibFullAdd_Click(object sender, EventArgs e)
{
getEnabledTrue();
//Session["USERID"] = "04eaeac5-f271-45d1-b17b-ad4ccbab63d0";
Session["strHandleType"] = "addfull";
this.hdHandle.Value = Session["strHandleType"].ToString().Trim();
Session["ORDNO"] = getBSNO();
this.hdGid.Value = Session["ORDNO"].ToString().Trim();
this.dvOrderNumVal.Value = Session["ORDNO"].ToString().Trim();
//
lbORSTATUS.Text = "提交审核";
lbORSTATUS.BackColor = System.Drawing.Color.FromArgb(221, 233, 250);
this.isEnabled.Value = "9";
//ddlBLTYPE.Enabled = true;
//
getDivDisplay();
//
ibDel.Enabled = false;
ibAdd.Enabled = false;
ibFullAdd.Enabled = false;
btSubmit.Enabled = false;
getKJTrue();
}
protected void ibAdd_Click(object sender, EventArgs e)
{
getEnabledTrue();
//Session["USERID"] = "04eaeac5-f271-45d1-b17b-ad4ccbab63d0";
Session["strHandleType"] = "add";
this.hdHandle.Value = Session["strHandleType"].ToString().Trim();
Session["ORDNO"] = getBSNO();
this.hdGid.Value = Session["ORDNO"].ToString().Trim();
this.dvOrderNumVal.Value = Session["ORDNO"].ToString().Trim();
lbORSTATUS.Text = "提交审核";
lbORSTATUS.BackColor = System.Drawing.Color.FromArgb(221, 233, 250);
this.isEnabled.Value = "9";
//ddlBLTYPE.Enabled = true;
//
tbETD.Text = "";
//
tbPKGS.Text = "0";
tbKGS.Text = "0";
tbCBM.Text = "0";
this.hd_comboKINDPKGS.Value = "PKGS";
tbREMARK.Text="";
//gvCNTRBind();
//
this.hd_comboCUSTOMERNAME.Value = "";
this.hd_comboOP.Value = "";
this.hd_comboDOC.Value = "";
this.hd_comboSHIPPERID.Value = "";
this.hd_comboCONSIGNEEID.Value = "";
this.hd_comboNOTIFYPARTYID.Value = "";
tbSHIPPER.Text = "";
tbCONSIGNEE.Text = "";
tbNOTIFYPARTY.Text = "";
this.hd_comboPORTLOADID.Value = T_ALL_DA.GetStrSQL("PORTLOADID", "select PORTLOADID from subcomp_seae_def where CORPID=(select GID from company where GID='" + this.hdCOMPANYID.Value.Trim() + "' and ISDELETED=0)");
this.hd_comboPORTLOAD.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_comboPORTDISCHARGEID.Value = "";
this.hd_comboPORTDISCHARGE.Value = "";
tbMARKS.Text = "N/M";
tbDESCRIPTION.Text = "";
tbTOTALNO.Text = "";
this.hd_comboSALE.Value = "";
this.hd_comboCARRIER.Value = "";
this.hd_comboFORWARDER.Value = "";
//服务项目名读取
ISFUMIGATION.Checked = false;//熏蒸
ISSTORAGE.Checked = false;//仓储
ISLAND.Checked = false;//陆运
ISCUSTOMS.Checked = false;//报关
ISBOOKING.Checked = false;//订舱
ISINSPECTION.Checked = false;//报检
ISAGENT.Checked = false;//使用代理
ISHBLNO.Checked = false;//分单签单
//
//ddlBLTYPE.SelectedValue = "整箱";
this.hd_comboBLTYPE.Value="整箱";
ddlISSUETYPE.SelectedValue = "海运单";
CheckBox1.Checked = false;
//
getDivDisplay();
//
ibDel.Enabled = false;
ibAdd.Enabled = false;
ibFullAdd.Enabled = false;
btSubmit.Enabled = false;
getKJTrue();
}
protected void ibDel_Click(object sender, EventArgs e)
{
if (this.isEnabled.Value.Trim().Equals("0") || this.isEnabled.Value.Trim().Equals("1"))
{
Response.Write("<script>alert('此业务已经提交或已经审核,不允许删除!');history.back();</script>");
return;
}
string alt = CrmSeaeorderDA.GetCrmSeaeorderDel(Session["ORDNO"].ToString().Trim(), strUserID.Trim());
if (alt != "")
{
Response.Write("<script>alert('" + alt + "');history.back();</script>");
return;
}
//
getEnabledTrue();
//Session["USERID"] = "04eaeac5-f271-45d1-b17b-ad4ccbab63d0";
Session["strHandleType"] = "add";
this.hdHandle.Value = Session["strHandleType"].ToString().Trim();
Session["ORDNO"] = getBSNO();
this.hdGid.Value = Session["ORDNO"].ToString().Trim();
lbORSTATUS.Text = "提交审核";
lbORSTATUS.BackColor = System.Drawing.Color.FromArgb(221, 233, 250);
this.isEnabled.Value = "9";
//ddlBLTYPE.Enabled = true;
//
tbETD.Text = "";
tbPKGS.Text = "0";
tbKGS.Text = "0";
tbCBM.Text = "0";
this.hd_comboKINDPKGS.Value = "PKGS";
tbREMARK.Text = "";
//gvCNTRBind();
//
this.hd_comboCUSTOMERNAME.Value = "";
this.hd_comboOP.Value = "";
this.hd_comboDOC.Value = "";
this.hd_comboSHIPPERID.Value = "";
this.hd_comboCONSIGNEEID.Value = "";
this.hd_comboNOTIFYPARTYID.Value = "";
tbSHIPPER.Text = "";
tbCONSIGNEE.Text = "";
tbNOTIFYPARTY.Text = "";
this.hd_comboPORTLOADID.Value = T_ALL_DA.GetStrSQL("PORTLOADID", "select PORTLOADID from subcomp_seae_def where CORPID=(select GID from company where GID='" + this.hdCOMPANYID.Value.Trim() + "' and ISDELETED=0)");
this.hd_comboPORTLOAD.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_comboPORTDISCHARGEID.Value = "";
this.hd_comboPORTDISCHARGE.Value = "";
tbMARKS.Text = "N/M";
tbDESCRIPTION.Text = "";
tbTOTALNO.Text = "";
this.hd_comboSALE.Value = "";
this.hd_comboCARRIER.Value = "";
this.hd_comboFORWARDER.Value = "";
//服务项目名读取
ISFUMIGATION.Checked = false;//熏蒸
ISSTORAGE.Checked = false;//仓储
ISLAND.Checked = false;//陆运
ISCUSTOMS.Checked = false;//报关
ISBOOKING.Checked = false;//订舱
ISINSPECTION.Checked = false;//报检
ISAGENT.Checked = false;//使用代理
ISHBLNO.Checked = false;//分单签单
//
//ddlBLTYPE.SelectedValue = "整箱";
this.hd_comboBLTYPE.Value="整箱";
ddlISSUETYPE.SelectedValue = "海运单";
//
getDivDisplay();
//
ibDel.Enabled = false;
ibAdd.Enabled = false;
ibFullAdd.Enabled = false;
btSubmit.Enabled = false;
getKJTrue();
}
public bool IsNumeric(string s)
{
bool bReturn = true;
try
{
int inum = int.Parse(s);
}
catch
{
bReturn = false;
}
return bReturn;
}
/////////集装箱///////////////////////////////////////////////////////////////////////////////////////////////////
#region 保存应收账户列表更改结果
/// <summary>
/// 保存应收账户列表更改结果
/// </summary>
/// <param name="tempGroupEntity"></param>
private void SaveRecvCrmSeaeorderctn(JsonCrmSeaeorderctnGroupEntity tempGroupEntity)
{
ViewState["CNTRTOTAL"] = "";
if (tempGroupEntity != null)
{
List<JsonCrmSeaeorderctnEntity> CrmSeaeorderctnEntities = new List<JsonCrmSeaeorderctnEntity>();
CrmSeaeorderctnEntities = tempGroupEntity.JsonCrmSeaeorderctnEntities;
CrmSeaeorderctnDA CrmSeaeorderctnDA = new CrmSeaeorderctnDA();
DataTable CrmSeaeorderctnTable = new DataTable();
string strInitSql = "";
if (tempGroupEntity.JsonCrmSeaeorderctnEntities.Count > 0)
{
string ORDNO = tempGroupEntity.JsonCrmSeaeorderctnEntities[0].CrmSeaeorderctn5.Trim();
if (ORDNO == "")
{
strInitSql = " SELECT CTN_ID,CTNALL,CTNNUM,REMARK FROM crm_seaeorderctn WHERE 1=1 AND ORDNO = '" + Session["ORDNO"].ToString().Trim() + "'";
}
else
{
strInitSql = " SELECT CTN_ID,CTNALL,CTNNUM,REMARK FROM crm_seaeorderctn WHERE 1=1 AND ORDNO = '" + ORDNO + "'";
}
}
else
{
return;
}
CrmSeaeorderctnTable = CrmSeaeorderctnDA.GetExcuteSql(strInitSql).Tables[0];
//更新操作SQL语句
ArrayList sqlList = new ArrayList();
//日志操作SQL语句
ArrayList logList = new ArrayList();
//日志记录
Logger log = Logger.Instance;
for (int i = 0; i < CrmSeaeorderctnTable.Rows.Count; i++)
{
foreach (JsonCrmSeaeorderctnEntity CrmSeaeorderctn in CrmSeaeorderctnEntities)
{
if (CrmSeaeorderctnTable.Rows[i]["CTN_ID"].ToString().Trim().Equals(CrmSeaeorderctn.CrmSeaeorderctn1.Trim()))
{
string strSql = "";
string LogContent = "";
LogEntity logEntity = new LogEntity();
#region 更改前后信息对比
//箱型
string strCrmSeaeorderctnCTNALL = CrmSeaeorderctn.CrmSeaeorderctn2.Trim().ToLower().Equals("null") ? "" : CrmSeaeorderctn.CrmSeaeorderctn2.Trim();
if (strCrmSeaeorderctnCTNALL.Trim().Equals(""))
{
continue;
}
else
{
if (!CrmSeaeorderctnTable.Rows[i]["CTNALL"].ToString().Trim().Equals(strCrmSeaeorderctnCTNALL))
{
strSql += String.Format(" CTNALL = '{0}'", strCrmSeaeorderctnCTNALL);
LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "箱型", CrmSeaeorderctnTable.Rows[i]["CTNALL"].ToString().Trim(), strCrmSeaeorderctnCTNALL);
}
}
//箱量
int strCrmSeaeorderctnCTNNUM = CrmSeaeorderctn.CrmSeaeorderctn3.Equals("null") ? 0 : CrmSeaeorderctn.CrmSeaeorderctn3;
if (strCrmSeaeorderctnCTNNUM==0)
{
continue;
}
else
{
if (!CrmSeaeorderctnTable.Rows[i]["CTNNUM"].ToString().Trim().Equals(strCrmSeaeorderctnCTNNUM))
{
strSql += String.Format(",CTNNUM = '{0}'", strCrmSeaeorderctnCTNNUM);
LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "箱量", CrmSeaeorderctnTable.Rows[i]["CTNNUM"].ToString().Trim(), strCrmSeaeorderctnCTNNUM);
}
}
//备注
string strCrmSeaeorderctnREMARK = CrmSeaeorderctn.CrmSeaeorderctn4.Trim().ToLower().Equals("null") ? "" : CrmSeaeorderctn.CrmSeaeorderctn4.Trim();
if (!CrmSeaeorderctnTable.Rows[i]["REMARK"].ToString().Trim().Equals(strCrmSeaeorderctnREMARK))
{
strSql += String.Format(",REMARK = '{0}'", strCrmSeaeorderctnREMARK);
LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "备注", CrmSeaeorderctnTable.Rows[i]["REMARK"].ToString().Trim(), strCrmSeaeorderctnREMARK);
}
#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}'", "crm_seaeorderctn", strSql, CrmSeaeorderctn.CrmSeaeorderctn1.Trim());
sqlList.Add(strUpdateSql);
logList.Add(String.Format("更新账户标识 {0} {1}", CrmSeaeorderctn.CrmSeaeorderctn1.Trim(), LogContent));
}
CrmSeaeorderctnEntities.Remove(CrmSeaeorderctn);
break;
}
}
}
if (sqlList.Count > 0)
{
int iResult = CrmSeaeorderctnDA.UpdateCrmSeaeorderctnFromGrid(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 = strUserID.Trim();//测试使用数据,正式发布请删除
// logEntity.LogContent = logList[i].ToString();
// log.WriteLog(logEntity);
// }
//}
//
getCNTRTOTAL();
#endregion
}
}
//如果遍历完所有费用表数据,没有相对应的费用信息,则将剩余的费用信息插入到费用表中
if (CrmSeaeorderctnEntities.Count > 0)
{
//插入新的应收费用信息
InsertCrmSeaeorderctn(CrmSeaeorderctnEntities, 1);
}
recvJSON = "";
this.recvContainer.Value = "";
}
else
{
recvJSON = "";
this.recvContainer.Value = "";
return;
}
}
#endregion
#region 插入账户信息记录
/// <summary>
/// 插入账户信息记录
/// </summary>
/// <param name="CrmSeaeorderctnEntities">需要插入账户表的账户实体类</param>
/// <param name="iType">如果iType值为1则记录账户类型为收/否则记录为付</param>
public void InsertCrmSeaeorderctn(List<JsonCrmSeaeorderctnEntity> CrmSeaeorderctnEntities, int iType)
{
ViewState["CNTRTOTAL"] = "";
ArrayList sqlInsertList = new ArrayList();
CrmSeaeorderctnDA CrmSeaeorderctnDA = new CrmSeaeorderctnDA();
foreach (JsonCrmSeaeorderctnEntity CrmSeaeorderctn in CrmSeaeorderctnEntities)
{
string strItemSql = "";
string strValueSql = "";
string strInsertSql = "";
//编号
strItemSql += "CTN_ID";
strValueSql += String.Format("'{0}'", CrmSeaeorderctn.CrmSeaeorderctn1.Trim().Equals("null") ? "" : CrmSeaeorderctn.CrmSeaeorderctn1.Trim());
//订舱编号
strItemSql += ",ORDNO";
if (CrmSeaeorderctn.CrmSeaeorderctn5.Trim().Equals(""))
{
strValueSql += String.Format(",'{0}'", Session["ORDNO"].ToString().Trim());
}
else
{
strValueSql += String.Format(",'{0}'", CrmSeaeorderctn.CrmSeaeorderctn5.Trim().Equals("null") ? Session["ORDNO"].ToString().Trim() : CrmSeaeorderctn.CrmSeaeorderctn5.Trim());
}
//箱型
if (CrmSeaeorderctn.CrmSeaeorderctn2.Trim().Equals("null") || CrmSeaeorderctn.CrmSeaeorderctn2.Trim().Equals(""))
{
continue;
}
else
{
strItemSql += ",CTNALL";
strValueSql += String.Format(",'{0}'", CrmSeaeorderctn.CrmSeaeorderctn2.Trim().Equals("null") ? "" : CrmSeaeorderctn.CrmSeaeorderctn2.Trim());
}
//箱量
if (CrmSeaeorderctn.CrmSeaeorderctn3.ToString().Trim().Equals("null") || CrmSeaeorderctn.CrmSeaeorderctn3.ToString().Trim().Equals("") || CrmSeaeorderctn.CrmSeaeorderctn3.ToString().Trim().Equals("0"))
{
continue;
}
else
{
strItemSql += ",CTNNUM";
strValueSql += String.Format(",'{0}'", CrmSeaeorderctn.CrmSeaeorderctn3.Equals("null") ? 0 : CrmSeaeorderctn.CrmSeaeorderctn3);
}
//备注
strItemSql += ",REMARK";
strValueSql += String.Format(",'{0}'", CrmSeaeorderctn.CrmSeaeorderctn4.Trim().Equals("null") ? "" : CrmSeaeorderctn.CrmSeaeorderctn4.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})", "crm_seaeorderctn", strItemSql, strValueSql);
sqlInsertList.Add(strInsertSql);
}
}
if (sqlInsertList.Count > 0)
{
int iResult = CrmSeaeorderctnDA.InsertCrmSeaeorderctnFromGrid(sqlInsertList);
//为1表示更新成功
//为-1有异常,更新失败
//为-2更新异常,事务已回滚成功
//更新完成后,记录日志
if (iResult == 1)
{
getCNTRTOTAL();
}
}
}
#endregion
protected void getCNTRTOTAL()
{
DataSet ds = CrmSeaeorderctnDA.GetFieldAll(" and ORDNO='"+Session["ORDNO"].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
{
string strCNTRTOTAL = "";
foreach (DataTable myTable in ds.Tables)
{
foreach (DataRow myRow in myTable.Rows)//遍历表
{
strCNTRTOTAL += myRow["CTNALL"].ToString().Trim() + "*" + myRow["CTNNUM"].ToString().Trim() + " / ";
}
}
strCNTRTOTAL = strCNTRTOTAL.Trim().Substring(0, strCNTRTOTAL.Trim().Length - 1);
int iii = CrmSeaeorderDA.UpdateInfoCNTRTOTAL("update crm_seaeorder set CNTRTOTAL='" + strCNTRTOTAL + "' where ORDNO='" + Session["ORDNO"].ToString().Trim() + "'", strUserID.Trim());
}
}
}
#region 获取账户客户保存的账户信息
/// <summary>
/// 获取账户客户保存的账户信息
/// </summary>
/// <param name="tempValue"></param>
/// <returns></returns>
public JsonCrmSeaeorderctnGroupEntity GetPostEntity(string tempValue)
{
JsonCrmSeaeorderctnGroupEntity CrmSeaeorderctnGroupEntity = (JsonCrmSeaeorderctnGroupEntity)JSON.Instance.ToObject(tempValue);
return CrmSeaeorderctnGroupEntity;
}
#endregion
protected void btAudit_Click(object sender, EventArgs e)
{
CrmSeaeorderEntity = CrmSeaeorderDA.GetID(Session["ORDNO"].ToString().Trim());
TopSeaeEntity.BSNO = CrmSeaeorderEntity.ORDNO.ToString().Trim();
if (CrmSeaeorderEntity.ORDNO != null)
{
//服务项目名读取
TopSeaeEntity.ISFUMIGATION = CrmSeaeorderEntity.ISFUMIGATION;
TopSeaeEntity.ISSTORAGE = CrmSeaeorderEntity.ISSTORAGE;
TopSeaeEntity.ISLAND = CrmSeaeorderEntity.ISLAND;
TopSeaeEntity.ISCUSTOMS = CrmSeaeorderEntity.ISCUSTOMS;
TopSeaeEntity.ISINSPECTION = CrmSeaeorderEntity.ISINSPECTION;
TopSeaeEntity.ISBOOKING = CrmSeaeorderEntity.ISBOOKING;
TopSeaeEntity.ISAGENT = CrmSeaeorderEntity.ISAGENT;
TopSeaeEntity.ISHBLNO = CrmSeaeorderEntity.ISHBLNO;
TopSeaeEntity.SERVICE9 = CrmSeaeorderEntity.SERVICE9;
TopSeaeEntity.SERVICE10 = CrmSeaeorderEntity.SERVICE10;
//
TopSeaeEntity.CUSTOMERNAME = CrmSeaeorderEntity.CUSTOMERNAME.ToString().Trim();
TopSeaeEntity.SALE = CrmSeaeorderEntity.SALE.ToString().Trim();
TopSeaeEntity.BLTYPE = CrmSeaeorderEntity.BLTYPE.ToString().Trim();
TopSeaeEntity.CARRIER = CrmSeaeorderEntity.CARRIER.ToString().Trim();
TopSeaeEntity.FORWARDER = CrmSeaeorderEntity.FORWARDER.ToString().Trim();
TopSeaeEntity.REMARK = CrmSeaeorderEntity.REMARK.ToString().Trim();
TopSeaeEntity.SHIPPERID = CrmSeaeorderEntity.SHIPPERID.ToString().Trim();
TopSeaeEntity.CONSIGNEEID = CrmSeaeorderEntity.CONSIGNEEID.ToString().Trim();
TopSeaeEntity.NOTIFYPARTYID = CrmSeaeorderEntity.NOTIFYPARTYID.ToString().Trim();
TopSeaeEntity.SHIPPER = CrmSeaeorderEntity.SHIPPER.ToString().Trim();
TopSeaeEntity.CONSIGNEE = CrmSeaeorderEntity.CONSIGNEE.ToString().Trim();
TopSeaeEntity.NOTIFYPARTY = CrmSeaeorderEntity.NOTIFYPARTY.ToString().Trim();
TopSeaeEntity.ETD = CrmSeaeorderEntity.ETD;
TopSeaeEntity.ISSUETYPE = CrmSeaeorderEntity.ISSUETYPE.ToString().Trim();
TopSeaeEntity.PORTLOADID = CrmSeaeorderEntity.PORTLOADID.ToString().Trim();
TopSeaeEntity.PORTLOAD = CrmSeaeorderEntity.PORTLOAD.ToString().Trim();
TopSeaeEntity.PORTDISCHARGEID = CrmSeaeorderEntity.PORTDISCHARGEID.ToString().Trim();
TopSeaeEntity.PORTDISCHARGE = CrmSeaeorderEntity.PORTDISCHARGE.ToString().Trim();
TopSeaeEntity.PKGS = CrmSeaeorderEntity.PKGS;
TopSeaeEntity.KINDPKGS = CrmSeaeorderEntity.KINDPKGS.ToString().Trim();
TopSeaeEntity.NOPKGS = CrmSeaeorderEntity.PKGS + " " + CrmSeaeorderEntity.KINDPKGS.ToString().Trim();
TopSeaeEntity.TOTALNO = CrmSeaeorderEntity.TOTALNO.ToString().Trim();
TopSeaeEntity.KGS = CrmSeaeorderEntity.KGS;
TopSeaeEntity.CBM = CrmSeaeorderEntity.CBM;
TopSeaeEntity.MARKS = CrmSeaeorderEntity.MARKS.ToString().Trim();
TopSeaeEntity.DESCRIPTION = CrmSeaeorderEntity.DESCRIPTION.ToString().Trim();
TopSeaeEntity.OP = CrmSeaeorderEntity.OP.ToString().Trim();
TopSeaeEntity.DOC = CrmSeaeorderEntity.DOC.ToString().Trim();
//
TopSeaeEntity.STLNAME = CrmSeaeorderEntity.STLNAME.ToString().Trim();
TopSeaeEntity.STLDATE = CrmSeaeorderEntity.STLDATE;
//
TopSeaeEntity.ISSUEDATE = CrmSeaeorderEntity.ETD;
TopSeaeEntity.ISSUEPLACE = CrmSeaeorderEntity.PORTDISCHARGE.ToString().Trim();
TopSeaeEntity.REMARK = CrmSeaeorderEntity.REMARK.ToString().Trim();
//
TopSeaeEntity.MASTERNO = CrmSeaeorderEntity.ORDNO.ToString().Trim();
TopSeaeEntity.BSSTATUS = false;//"接受委托";
TopSeaeEntity.FEESTATUS = false;//"未锁定";
TopSeaeEntity.ORDERTYPE = "销售订舱";
//TopSeaeEntity.BSDATE = DateTime.Today.Date;
string strdate = T_ALL_DA.GetStrSQL("strdate", "select getdate() as strdate");
TopSeaeEntity.ACCDATE = DateTime.Parse(strdate).Year.ToString().Trim() + "-" + DateTime.Parse(strdate).Month.ToString().Trim();
TopSeaeEntity.MBLNO = "";
TopSeaeEntity.HBLNO = getCodeRule("分提单号", "HBLNO");//调用编码规则
TopSeaeEntity.CUSTNO = getCodeRule("委托编号", "CUSTNO");//调用编码规则
TopSeaeEntity.TRANSNO = "";
TopSeaeEntity.AGENTID = "";
TopSeaeEntity.AGENT = "";
TopSeaeEntity.YARD = "";
TopSeaeEntity.VESSEL = "";
TopSeaeEntity.VOYNO = "";
TopSeaeEntity.PlACERECEIPTID = "";
TopSeaeEntity.PlACERECEIPT = "";
TopSeaeEntity.PLACEDELIVERYID = "";
TopSeaeEntity.PLACEDELIVERY = "";
TopSeaeEntity.DESTINATIONID = "";
TopSeaeEntity.DESTINATION = "";
TopSeaeEntity.NOBILL = "";
TopSeaeEntity.BLFRT = CrmSeaeorderEntity.BLFRT.ToString().Trim();
TopSeaeEntity.PREPARDAT = "";
TopSeaeEntity.PAYABLEAT = "";
TopSeaeEntity.SERVICE = T_ALL_DA.GetStrSQL("SERVICE", "select SERVICE from subcomp_seae_def where CORPID=(select GID from company where GID='" + this.hdCOMPANYID.Value.Trim() + "' and ISDELETED=0)");
TopSeaeEntity.CNTRSEALNO = "";
TopSeaeEntity.GOODSNAME = "";
TopSeaeEntity.GROSSWEIGHT = CrmSeaeorderEntity.KGS.ToString().Trim();
TopSeaeEntity.MEASUREMENT = CrmSeaeorderEntity.CBM.ToString().Trim();
TopSeaeEntity.CNTRNO = "";
TopSeaeEntity.CNTR1 = 0;
TopSeaeEntity.CNTR2 = 0;
TopSeaeEntity.CNTR3 = 0;
TopSeaeEntity.CNTR4 = 0;
TopSeaeEntity.CNTR5 = 0;
TopSeaeEntity.CNTR6 = 0;
TopSeaeEntity.CNTR7 = 0;
TopSeaeEntity.CNTR8 = 0;
TopSeaeEntity.CNTR9 = 0;
TopSeaeEntity.CNTR10 = 0;
TopSeaeEntity.OTCNTR = 0;
TopSeaeEntity.TEU = 0;
TopSeaeEntity.CNTRTOTAL = "";
TopSeaeEntity.INPUTBY = CrmSeaeorderEntity.INPUTBY.Trim();
TopSeaeEntity.LANE = T_ALL_DA.GetStrSQL("LANE", "SELECT code_lanes.LANE FROM code_lanes INNER JOIN code_disport ON code_lanes.GID = code_disport.LANEGID WHERE (code_disport.PORT = '" + CrmSeaeorderEntity.PORTDISCHARGE.ToString().Trim() + "')");
TopSeaeEntity.CUSTOMSER = "";
TopSeaeEntity.TRUCKER = "";
TopSeaeEntity.INVNO = "";
TopSeaeEntity.CARGOID = "";
TopSeaeEntity.DCLASS = "";
TopSeaeEntity.DUNNO = "";
TopSeaeEntity.REEFERF = "";
TopSeaeEntity.TEMPID = "";
TopSeaeEntity.TEMPSET = "";
TopSeaeEntity.TEMPMAX = "";
TopSeaeEntity.TEMPMIN = "";
TopSeaeEntity.BSSOURCE = "";
TopSeaeEntity.BSSOURCEDETAIL = "";
TopSeaeEntity.CUSTOMSNUM = 0;
TopSeaeEntity.CONTRACTNO = "";
TopSeaeEntity.ORDTYPE = "";
TopSeaeEntity.ORDERNO = "";
TopSeaeEntity.INSURANCEER = "";
TopSeaeEntity.INSURANCENO = "";
TopSeaeEntity.INAMOUT = 0;
TopSeaeEntity.ISVOU = false;
TopSeaeEntity.VOUNO = "";
TopSeaeEntity.STATUS1 = false;
TopSeaeEntity.STATUS2 = false;
TopSeaeEntity.STATUS3 = false;
TopSeaeEntity.STATUS4 = false;
TopSeaeEntity.STATUS5 = false;
TopSeaeEntity.CUSTSERVICE ="";
TopSeaeEntity.PACKINGTYPE = "";
TopSeaeEntity.WAREHOUSE = "";
TopSeaeEntity.CORPID = "";
TopSeaeEntity.SALEDEPT = "";
TopSeaeEntity.MBLFRT = "";
//
TopSeaeEntity.OPERATOR = "";
TopSeaeEntity.OPERATORTEL = "";
TopSeaeEntity.OPERATORFAX = "";
TopSeaeEntity.OPERATOREMAIL = "";
TopSeaeEntity.FINANCIALSTAFF = "";
TopSeaeEntity.FINANCIALSTAFFTEL = "";
TopSeaeEntity.FINANCIALSTAFFFAX = "";
TopSeaeEntity.FINANCIALSTAFFEMAIL = "";
TopSeaeEntity.OPERATORCODE = "";
TopSeaeEntity.FINANCIALSTAFFCODE = "";
//获取订舱信息关联的费用信息
IList<CrmOrderFeeEntity> crmOrderFeeEntities = new List<CrmOrderFeeEntity>();
CrmOrderFeeDA crmOrderFeeDA = new CrmOrderFeeDA();
crmOrderFeeEntities = crmOrderFeeDA.GetFeeByBSNO(TopSeaeEntity.BSNO);
//将订舱信息和订舱费用分别插入海运出口委托表和费用表
int iResult = CrmSeaeorderDA.AuditPassCopyToOpSeae(TopSeaeEntity, crmOrderFeeEntities, strUserID);//SeaExportInfoDA.InserInfo(TopSeaeEntity);
if (iResult > 0)
{
UserDA userDA = new UserDA();
UserEntity userEntity = new UserEntity();
userEntity = userDA.GetUserAllBySHOWNAME(CrmSeaeorderEntity.INPUTBY);
IList<MessageEntity> messageEntities = new List<MessageEntity>();
MessageDA messageDA = new MessageDA();
//插入消息提醒
MessageEntity messageEntity = new MessageEntity();
messageEntity.GID = Guid.NewGuid().ToString();
messageEntity.Name = "SeaOrderAudit";
messageEntity.Description = "销售订舱审核通知";
messageEntity.IsRead = false;
messageEntity.ReadCount = 0;
messageEntity.MessageContent = strShowName + " 已批准通过您的 [销售订舱审核] 申请 ";
messageEntity.TaskID = "";
messageEntity.Receiver = userEntity.Gid;
messageEntity.TaskUrl = "shipping/SeaeOrderList.aspx";
messageEntity.Type = messageDA.GetMessageType(MessageType.SEAORDERAUDIT);
messageEntity.RecvType = 3;//审核完成类型
messageEntities.Add(messageEntity);
if (messageEntities.Count > 0)
{
messageDA.CreateMessage(MessageType.SEAORDERAUDIT, messageEntities);
}
string strORDNO = Session["ORDNO"].ToString().Trim();
Page.ClientScript.RegisterStartupScript(this.GetType(), "key3", "<script>reloadParent('" + strORDNO + "','" + strHandleType.Trim() + "');</script>");
return;
}
else if (iResult == -3)
{
Response.Write("<script>alert('订舱信息写入委托表出错!');history.back();</script>");
return;
}
else if (iResult == -4)
{
Response.Write("<script>alert('插入订舱的费用!');history.back();</script>");
return;
}
else if (iResult == -5)
{
Response.Write("<script>alert('更新订舱费用ISSUBMIT2FEE字段出错');history.back();</script>");
return;
}
else if (iResult == -6)
{
Response.Write("<script>alert('更新委托的集装箱大写和TEU出错');history.back();</script>");
return;
}
else if (iResult == -7)
{
Response.Write("<script>alert('插入集装箱明细出错!');history.back();</script>");
return;
}
else if (iResult == -8)
{
Response.Write("<script>alert('更改销售订舱状态、审核人、审核时间!');history.back();</script>");
return;
}
else if (iResult == -9)
{
Response.Write("<script>alert('更新委托的集装箱大写和箱封号!');history.back();</script>");
return;
}
else
{
Response.Write("<script>alert('提交销售订舱委托出错!');history.back();</script>");
return;
}
}
}
/// <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=1");
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 (TopSeaeEntity.ACCDATE.ToString().Trim() == "")
{
return "";
}
else
{
DateTime dACCDATE = System.Convert.ToDateTime(TopSeaeEntity.ACCDATE.ToString().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_seae] 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 void btSubmit_Click(object sender, EventArgs e)
{
string strOrderNO = Session["ORDNO"].ToString().Trim();
if (CrmSeaeorderDA.GetCrmOrderFeeCountByOrderNO(strOrderNO) > 0)
{
int iii = CrmSeaeorderDA.UpdateInfoCNTRTOTAL("update crm_seaeorder set ORREASON='',ORSTATUS='1' where ORDNO='" + Session["ORDNO"].ToString().Trim() + "'", strUserID.Trim());
if (iii == 1)
{
IList<UserAuthorityRangeEntity> userAuthorityRangeEntities = new List<UserAuthorityRangeEntity>();
UserAuthorityDA userAuthorityDA = new UserAuthorityDA();
userAuthorityRangeEntities = userAuthorityDA.GetAuthorityUsersByNameAndRange("modSeaeOrderAudit", 2);
IList<MessageEntity> messageEntities = new List<MessageEntity>();
MessageDA messageDA = new MessageDA();
if (userAuthorityRangeEntities.Count > 0)
{
foreach (UserAuthorityRangeEntity userAuthorityRangeEntity in userAuthorityRangeEntities)
{
UserDA userDA = new UserDA();
CompanyDA companyDA = new CompanyDA();
CompanyEntity companyEntity = new CompanyEntity();
//先获取提交销售订舱申请人的分公司、部门信息
string applyCompanyID = strCompanyID;
string applyDeptName = userDA.GetUserDepartmentName(strUserID);
//再获取具有销售订舱审核权限的审核人分公司、部门信息
companyEntity = companyDA.GetCompanyByUserID(userAuthorityRangeEntity.UserID);
if (companyEntity != null)
{
if (companyEntity.GID != null)
{
string auditorCompanyID = companyEntity.GID;
string auditorDeptName = userDA.GetUserDepartmentName(userAuthorityRangeEntity.UserID);
if (applyCompanyID == auditorCompanyID)
{
//相同分公司下
if (applyDeptName == auditorDeptName)
{
//插入消息提醒
MessageEntity messageEntity = new MessageEntity();
messageEntity.GID = Guid.NewGuid().ToString();
messageEntity.Name = "SeaOrderAudit";
messageEntity.Description = "销售订舱待审核通知";
messageEntity.IsRead = false;
messageEntity.ReadCount = 0;
messageEntity.MessageContent = strShowName + " 提交 [销售订舱审核] 申请,请审核 ";
messageEntity.TaskID = "";
messageEntity.Receiver = userAuthorityRangeEntity.UserID;
messageEntity.TaskUrl = "shipping/SeaeOrderAudit.aspx";
messageEntity.Type = messageDA.GetMessageType(MessageType.SEAORDERAUDIT);
messageEntity.RecvType = 2;//申请审核类型
messageEntities.Add(messageEntity);
}
}
}
}
}
}
if (messageEntities.Count > 0)
{
messageDA.CreateMessage(MessageType.SEAORDERAUDIT, messageEntities);
}
CrmSeaeorderEntity.ORSTATUS = "1";
this.isEnabled.Value = "1";
btSubmit.Enabled = false;
getEnabled();
//Response.Write("<script>window.opener.location.reload();history.back();</script>");
Page.ClientScript.RegisterStartupScript(this.GetType(), "key4", "<script>reloadParent('" + Session["ORDNO"].ToString().Trim() + "','" + strHandleType.Trim() + "');</script>");
return;
}
else
{
Response.Write("<script>alert('销售订舱状态改变出错!');</script>");
return;
}
}
else
{
Response.Write("<script>alert('销售订舱未录费用不能提交审核');</script>");
return;
}
}
}
}