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/FeeCodes/INTTRAEDIExportAdapter.aspx.cs

601 lines
25 KiB
C#

2 years ago
using System;
using System.Collections;
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.Xml.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Xml;
using DSWeb.Models;
using DSWeb.EntityDA;
using System.IO;
namespace DSWeb.FeeCodes
{
public partial class INTTRAEDIExportAdapter : System.Web.UI.Page
{
public string shandle = "";
public string strPortName = "";
public string strUserID = "";
public string strGIDS = "";
public string sRadioGroup1 = "";
public string sRadioGroup3 = "";
public string strBSNO = "";
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString().Trim();
}
else
{
Server.Transfer("~/Error/FriendError.aspx");
return;
}
if (Request.QueryString["handle"] != null)
{
shandle = Request.QueryString["handle"].ToString();
}
if (Request.QueryString["ids"] != null)
{
strGIDS = Request.QueryString["ids"].ToString();
}
if (Request.QueryString["sRadioGroup1"] != null)
{
sRadioGroup1 = Request.QueryString["sRadioGroup1"].ToString();
}
if (Request.QueryString["sRadioGroup3"] != null)
{
sRadioGroup3 = Request.QueryString["sRadioGroup3"].ToString();
}
if (Request.QueryString["bsno"] != null)
{
strBSNO = Request.QueryString["bsno"].ToString();
}
//
UnicodeEncoding unicode = new UnicodeEncoding();
if (shandle.Trim() != "")
{
if (shandle.Trim() == "isexport")//判断是否为空
{
strPortName = isExport();
}
}
Response.Write(strPortName);
}
protected string isExport()
{
SeaExportInfoDA SeaExportInfoDA = new SeaExportInfoDA();
T_ALL_DA T_ALL_DA = new T_ALL_DA();
EDIExportDA EDIExportDA = new EDIExportDA();
TopSeaeEntity TopSeaeEntity = new TopSeaeEntity();
//
string alt0 = "";
string alt2 = "";
string alt4 = "";
string alt5 = "";
string alt6 = "";
string ls = "";
string sVESSEL = "";
string sVOYNO = "";
string[] itmGIDS = strGIDS.Trim().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < itmGIDS.Length; i++)
{
string alt = "";
TopSeaeEntity = SeaExportInfoDA.GetID(itmGIDS[i].ToString().Trim());
//
if (TopSeaeEntity.MBLNO.ToString().Trim() == "")//主提单号
{
alt += "主提单号、";
}
//
if (TopSeaeEntity.VESSEL.ToString().Trim() == "")//10船名
{
alt += "船名、";
}
else
{
if (i == 0)
{
sVESSEL = TopSeaeEntity.VESSEL.ToString().Trim();
}
else
{
if (sVESSEL.Trim() != TopSeaeEntity.VESSEL.ToString().Trim())
{
alt = "请注意:只能导出同一船名、航次的业务!";
return alt;
}
}
}
//
if (TopSeaeEntity.VOYNO.ToString().Trim() == "")//10航次
{
alt += "航次、";
}
else
{
if (i == 0)
{
sVOYNO = TopSeaeEntity.VOYNO.ToString().Trim();
}
else
{
if (sVOYNO.Trim() != TopSeaeEntity.VOYNO.ToString().Trim())
{
alt = "请注意:只能导出同一船名、航次的业务!";
return alt;
}
}
}
//
if (TopSeaeEntity.VESSELID.ToString().Trim() == "")//10船舶呼号
{
alt += "船舶呼号、";
}
//
if (TopSeaeEntity.PORTLOADID.ToString().Trim() == "")//12装货港代码
{
alt += "装货港代码、";
}
//
if (TopSeaeEntity.PORTDISCHARGEID.ToString().Trim() == "")//12卸货港代码
{
alt += "卸货港代码、";
}
//
if (TopSeaeEntity.PLACEDELIVERYID.ToString().Trim() == "")//12交货地代码
{
alt += "交货地代码、";
}
//
if (TopSeaeEntity.DESTINATIONID.ToString().Trim() == "")//12目的地代码
{
alt += "目的地代码、";
}
//
if (TopSeaeEntity.PORTLOAD.ToString().Trim() == "")//12装货港
{
alt += "装货港、";
}
//
if (TopSeaeEntity.PORTDISCHARGE.ToString().Trim() == "")//12卸货港
{
alt += "卸货港、";
}
//
if (TopSeaeEntity.PLACEDELIVERY.ToString().Trim() == "")//12交货地
{
alt += "交货地、";
}
//
//if (sRadioGroup1.Trim() == "0")//订舱号标识//货代向船公司订舱时即标记3订舱号标识R1404为F货代向船代订舱时标记9、标记5/4订舱号标识R1404为B
//{
// if (TopSeaeEntity.ORDERNO.ToString().Trim() == "")//14订舱号
// {
// alt += "订舱号、";
// }
//}
//else
//{
// if (TopSeaeEntity.MBLNO.ToString().Trim() == "")//14提单号
// {
// alt += "主提单号、";
// }
//}
//
if (TopSeaeEntity.SERVICE.ToString().Trim() == "")//14交货条款
{
alt += "交货条款、";
}
//
ls = T_ALL_DA.GetStrSQL("EDICODE", "select EDICODE from code_frt where FRT='" + TopSeaeEntity.BLFRT.ToString().Trim() + "'").Trim();//14付款方式
if (ls.Trim() == "")//14付款方式
{
alt += "付款方式代码、";
}
//20发货人
if (TopSeaeEntity.SHIPPER.ToString().Trim() == "")//20发货人内容
{
alt += "发货人内容、";
}
else
{
if (EDIExportDA.getISCN(TopSeaeEntity.SHIPPER.ToString().Trim()))//发货人内容
{
alt4 += "发货人内容、";
}
string[] itms = TopSeaeEntity.SHIPPER.ToString().Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
for (int j=0; j < itms.Length;j++ )
{
if (itms[j].Length > 36)
{
alt5 += "发货人内容、";
break;
}
}
}
//21收货人
if (TopSeaeEntity.CONSIGNEE.ToString().Trim() == "")//21收货人内容
{
alt += "收货人内容、";
}
else
{
if (EDIExportDA.getISCN(TopSeaeEntity.CONSIGNEE.ToString().Trim()))//收货人内容
{
alt4 += "收货人内容、";
}
string[] itms = TopSeaeEntity.CONSIGNEE.ToString().Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
for (int j = 0; j < itms.Length; j++)
{
if (itms[j].Length > 36)
{
alt5 += "收货人内容、";
break;
}
}
}
//22通知人
if (TopSeaeEntity.NOTIFYPARTY.ToString().Trim() == "")//21通知人内容
{
alt += "通知人内容、";
}
else
{
if (EDIExportDA.getISCN(TopSeaeEntity.NOTIFYPARTY.ToString().Trim()))//通知人内容
{
alt4 += "通知人内容、";
}
string[] itms = TopSeaeEntity.NOTIFYPARTY.ToString().Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
for (int j = 0; j < itms.Length; j++)
{
if (itms[j].Length > 36)
{
alt5 += "通知人内容、";
break;
}
}
}
//41订舱货物
if (sRadioGroup1.Trim() == "1")
{
DataSet ds1 = T_ALL_DA.GetAllSQL("select *,pkEDICODE1=(select EDICODE from code_package where PKGS=op_seae_hs.KINDPKGS1),pkEDICODE2=(select EDICODE from code_package where PKGS=op_seae_hs.KINDPKGS2) from op_seae_hs where bsno='" + TopSeaeEntity.BSNO.ToString().Trim() + "'");
if (ds1 != null)
{
foreach (DataTable myTable in ds1.Tables)
{
foreach (DataRow myRow in myTable.Rows)//遍历表
{
if (myRow["CARGOID"].ToString().Trim() == "")
{
alt6 += "货物标识、";
}
if (myRow["PKGS1"].ToString().Trim() == "")
{
alt6 += "第一层包装件数、";
}
if (myRow["pkEDICODE1"].ToString().Trim() == "")
{
alt6 += "第一层包装类型、";
}
if (myRow["NOPKGS1"].ToString().Trim() == "")
{
alt6 += "第一层包装说明、";
}
if (myRow["CARGOGROSSWT1"].ToString().Trim() == "")
{
alt6 += "第一层包装皮重、";
}
if (myRow["CARGOMEASUREMENT1"].ToString().Trim() == "")
{
alt6 += "第一层包装尺码、";
}
if (myRow["KGS"].ToString().Trim() == "")
{
alt6 += "货净重、";
}
if (myRow["CBM"].ToString().Trim() == "")
{
alt6 += "货物体积、";
}
}
}
}
else
{
if (TopSeaeEntity.CARGOID.ToString().Trim() == "")//41货物标识
{
alt += "货物标识、";
}
if (TopSeaeEntity.PKGS.ToString().Trim() == "")//41包装件数
{
alt += "包装件数、";
}
if (TopSeaeEntity.KINDPKGS.ToString().Trim() == "")//41包装类型
{
alt += "包装类型、";
}
if (TopSeaeEntity.NOPKGS.ToString().Trim() == "")//41包装说明
{
alt += "包装说明、";
}
if (TopSeaeEntity.CBM.ToString().Trim() == "")//41包装尺码
{
alt += "包装尺码、";
}
if (TopSeaeEntity.KGS.ToString().Trim() == "")//41货净重
{
alt += "货净重、";
}
if (TopSeaeEntity.CBM.ToString().Trim() == "")//41货净重
{
alt += "货物体积、";
}
}
}
//43危险品,冷藏和超标信息
if (TopSeaeEntity.CARGOID.ToString().Trim() == "D")//危险
{
if (TopSeaeEntity.DCLASS.ToString().Trim() == "")//41危险品分类
{
alt += "危险品分类、";
}
if (TopSeaeEntity.DUNNO.ToString().Trim() == "")//41联合国危险品编号
{
alt += "联合国危险品编号、";
}
else
{
if (TopSeaeEntity.DUNNO.ToString().Trim().Length!=4)//41联合国危险品编号
{
alt2 += "联合国危险品编号必须是4位数字、";
}
}
//危险品页号
if (TopSeaeEntity.DPAGE.ToString().Trim() == "")//危险品页号
{
alt += "危险品页号、";
}
//危险品标签
if (TopSeaeEntity.DLABEL.ToString().Trim() == "")//危险品标签
{
alt += "危险品标签、";
}
//危险品联系人
if (TopSeaeEntity.LINKMAN.ToString().Trim() == "")//危险品联系人
{
alt += "危险品联系人、";
}
}
else if (TopSeaeEntity.CARGOID.ToString().Trim() == "R")//冷冻
{
if (TopSeaeEntity.TEMPID.ToString().Trim() == "")//温度计量单位C=摄氏 F=华氏
{
alt += "温度计量单位、";
}
if (TopSeaeEntity.TEMPSET.ToString().Trim() == "")//温度计量单位C=摄氏 F=华氏
{
alt += "设置温度、";
}
//if (TopSeaeEntity.TEMPMIN.ToString().Trim() == "")//冷藏最低温度
//{
// alt += "冷藏最低温度、";
//}
//if (TopSeaeEntity.TEMPMAX.ToString().Trim() == "")//冷藏最高温度
//{
// alt += "冷藏最高温度、";
//}
}
//44唛头
if (TopSeaeEntity.MARKS.ToString().Trim() == "")//唛头
{
alt += "唛头、";
}
else
{
if (EDIExportDA.getISCN(TopSeaeEntity.MARKS.ToString().Trim()))//唛头
{
alt4 += "唛头、";
}
string[] itms = TopSeaeEntity.MARKS.ToString().Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
for (int j = 0; j < itms.Length; j++)
{
if (itms[j].Length > 36)
{
alt5 += "唛头、";
break;
}
}
}
//47货物描述
if (TopSeaeEntity.DESCRIPTION.ToString().Trim() == "")//货物描述
{
alt += "货物描述、";
}
else
{
if (EDIExportDA.getISCN(TopSeaeEntity.MARKS.ToString().Trim()))//唛头
{
alt4 += "货物描述、";
}
}
//48集装箱细目
string alt3 = "";
if (sRadioGroup1.Trim() == "1")
{
DataSet ds = T_ALL_DA.GetAllSQL("select *,EDICODE=isnull((select EDICODE from code_ctn where ctn=op_ctn.CTNALL),CTNALL),pkEDICODE=(select EDICODE from code_package where pkgs=op_ctn.KINDPKGS) from op_ctn where BSNO='" + TopSeaeEntity.BSNO.ToString().Trim() + "' order by CTNALL");
if (ds != null)
{
foreach (DataTable myTable in ds.Tables)
{
foreach (DataRow myRow in myTable.Rows)//遍历表
{
alt3 = "";
if (myRow["CNTRNO"].ToString().Trim() == "")//箱号
{
alt3 += "集装箱箱号、";
}
if (myRow["EDICODE"].ToString().Trim() == "")//集装箱尺寸类型
{
alt3 += "集装箱尺寸类型、";
}
if (myRow["PKGS"].ToString().Trim() == "")//货物件数
{
alt3 += "集装箱货物件数、";
}
if (myRow["pkEDICODE"].ToString().Trim() == "")//包装类型代码
{
alt3 += "集装箱包装类型代码、";
}
if (myRow["KGS"].ToString().Trim() == "")//箱内货重
{
alt3 += "集装箱箱内货重、";
}
if (myRow["TAREWEIGHT"].ToString().Trim() == "")//箱皮重
{
alt3 += "集装箱箱皮重、";
}
if (TopSeaeEntity.SOURCECODE.ToString().Trim() == "")//集装箱(器)来源代码
{
alt3 += "集装箱箱皮重、";
}
}
}
}
}
alt += alt3;
//60运费条款
if (TopSeaeEntity.BLFRT.ToString().Trim() == "")//运费条款
{
alt += "运费条款、";
}
//71提单信息
if (TopSeaeEntity.BLTYPE.ToString().Trim() == "")//提单类型
{
alt += "提单类型、";
}
if (TopSeaeEntity.ISSUEDATE.ToString().Trim() == "" || TopSeaeEntity.ISSUEDATE.ToString().Trim().IndexOf("0001") > -1)//签发日期
{
alt += "签发日期、";
}
if (TopSeaeEntity.NOBILL.ToString().Trim() == "")//正本提单份数
{
alt += "正本提单份数、";
}
if (TopSeaeEntity.ISSUETYPE.ToString().Trim() == "")//签单方式
{
alt += "签单方式、";
}
if (TopSeaeEntity.ETD.ToString().Trim() == "" || TopSeaeEntity.ETD.ToString().Trim().IndexOf("0001")>-1)//开船日期
{
alt += "开船日期、";
}
else
{
DateTime dt0 = DateTime.Parse(TopSeaeEntity.ETD.ToString("yyyy-MM-dd").Trim());
DateTime dt1 = DateTime.Parse(T_ALL_DA.GetStrSQL("sdate", "select convert(char(10),getdate()-120,20) as sdate ").Trim());
if (dt0 < dt1)//开船日期
{
alt2 += "开船日期必须在今日的120天内";
}
}
if (TopSeaeEntity.KINDPKGS.ToString().Trim() == "")//包装
{
alt += "包装、";
}
ls = T_ALL_DA.GetStrSQL("EDICODE", "select EDICODE from code_package where PKGS='" + TopSeaeEntity.KINDPKGS.ToString().Trim() + "'").Trim();//包装
if (ls.Trim() == "")//包装
{
alt += "包装类型编码 、";
}
if (TopSeaeEntity.PKGS.ToString().Trim() == "")//件数
{
alt += "件数、";
}
if (TopSeaeEntity.KGS.ToString().Trim() == "")//毛重
{
alt += "毛重、";
}
if (TopSeaeEntity.CBM.ToString().Trim() == "")//尺码
{
alt += "尺码、";
}
if (TopSeaeEntity.PREPARDAT.ToString().Trim() == "" && TopSeaeEntity.PAYABLEAT.ToString().Trim() == "")//付款地点
{
alt += "付款地点、";
}
if (TopSeaeEntity.SERVICE.ToString().Trim()=="")//运输条款
{
alt += "运输条款、";
}
if (TopSeaeEntity.CONTRACTNO.ToString().Trim()=="")//运费协议号
{
alt += "运费协议号、";
}
if (sRadioGroup1 == "1")
{
if (TopSeaeEntity.ISSUEPLACE.ToString().Trim() == "")//提单签发地代码
{
alt += "签单地点、";
}
if (TopSeaeEntity.ISSUEPLACEID.ToString().Trim() == "")//提单签发地代码
{
alt += "签单地代码、";
}
}
if (EDIExportDA.getISCN(TopSeaeEntity.REMARK.ToString().Trim()))//备注
{
alt4 += "备注、";
}
//尾部
if (alt.Trim() == "" && alt2.Trim() == "" && alt4.Trim() == "" && alt5.Trim() == "" && alt6.Trim() == "")
{
alt0 += "";
}
else
{
alt0 += "主提单号:" + TopSeaeEntity.MBLNO.ToString().Trim() +",其中";
if (alt.Trim() != "")
{
alt = alt.Trim().Substring(0, alt.Trim().Length - 1);
alt0 += alt + "不能为空!";
}
if (alt2.Trim() != "")
{
alt0 += alt2;
}
if (alt4.Trim() != "")
{
alt4 = alt4.Trim().Substring(0, alt4.Trim().Length - 1);
alt0 += alt4 + "中不能有中文字符!";
}
if (alt5.Trim() != "")
{
alt5 = alt5.Trim().Substring(0, alt5.Trim().Length - 1);
alt0 += alt5 + "中每行字符不能超过35个字符";
}
if (alt6.Trim() != "")
{
alt6 = alt6.Trim().Substring(0, alt6.Trim().Length - 1);
alt0 += "集装箱列表中的" + alt6 + "都不允许空!";
}
alt0 += "\r\n";
}
}
return alt0;
}
//
}
}