using System ;
using System.Linq ;
using System.Web.Mvc ;
using DSWeb.MvcShipping.DAL.MsOpSeaeEdiDAL ;
using DSWeb.MvcShipping.Models.MsOpSeaeEdi ;
using DSWeb.MvcShipping.Models.MsOpSeae ;
using DSWeb.MvcShipping.Helper ;
using DSWeb.MvcShipping.Comm.Cookie ;
using HcUtility.Comm ;
using HcUtility.Core ;
using System.Collections.Generic ;
using DSWeb.MvcShipping.DAL.MsCodeFtpSet ;
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL ;
using System.IO ;
using DSWeb.MvcShipping.Models.FtpSet ;
using DSWeb.MvcShipping.DAL.MsOpSeaeDAL ;
using System.Web ;
using DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL ;
using DSWeb.EntityDA ;
using DSWeb.MvcShipping.DAL.MsSysParamSet ;
using DSWeb.SoftMng.DAL.SoftSysTable ;
using DSWeb.Areas.Account.DAL.Chfee_Settlement ;
using DSWeb.MvcShipping.DAL.MsChFeeDAL ;
using DSWeb.Common.DB ;
using DSWeb.Areas.CommMng.DAL ;
using com.sun.jdi.@event ;
using DSWeb.Areas.CommMng.Models ;
namespace DSWeb.MvcShipping.Controllers
{
[JsonRequestBehavior]
public class MsOpSeaeEdiController : Controller
{
/ /
// GET:
public ActionResult Index ( )
{
return View ( ) ;
}
public ActionResult Edit ( )
{
return View ( ) ;
}
public ActionResult CustomIndex ( )
{
return View ( ) ;
}
public ActionResult CustomEdit ( )
{
return View ( ) ;
}
#region 查询列表、保存、删除
public ContentResult GetDataList ( int start , int limit , string sort , string condition )
{
var dataList = MsOpSeaeEdiDAL . GetDataList ( condition , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , sort ) ;
var list = dataList . Skip ( start ) . Take ( limit ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = dataList . Count , data = list . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetDataListStr ( string sort , string condition )
{
var dataListStr = MsOpSeaeEdiDAL . GetDataListStr ( condition , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , sort ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , data = dataListStr } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetData ( string handle , string condition )
{
MsOpSeaeEdi head = null ;
if ( handle = = "edit" )
{
head = MsOpSeaeEdiDAL . GetData ( condition ) ;
}
if ( head = = null )
{
head = new MsOpSeaeEdi ( ) ;
head . INPUTBY = Convert . ToString ( Session [ "SHOWNAME" ] ) ;
}
var json = JsonConvert . Serialize (
new { Success = true , Message = "查询成功" , data = head } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetBodyList ( string condition )
{
var dataList = MsOpSeaeEdiDAL . GetBodyList ( condition ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = dataList . Count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetCargoList ( string condition )
{
var dataList = MsOpSeaeEdiDAL . GetCargoList ( condition ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = dataList . Count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult Save ( string opstatus , string data , string data2 , string body , string cargobody )
{
var ss = Session [ "SHOWNAME" ] ;
if ( ss = = null )
{
var jsonRespose = new JsonResponse { Success = false , Message = "登录超时,请重新登录!" } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
var headData = JsonConvert . Deserialize < MsOpSeaeEdi > ( data . Replace ( "}" , "," ) + data2 . Replace ( "{" , "" ) ) ;
var bodyList = JsonConvert . Deserialize < List < MsOpSeaeEdiCtn > > ( body ) ;
var cargoList = JsonConvert . Deserialize < List < MsOpSeaeEdiCtnDetail > > ( cargobody ) ;
var isPost = true ;
var errorstr = "" ;
if ( headData . CORPID = = "" | | headData . CORPID = = null )
{
headData . CORPID = Convert . ToString ( Session [ "COMPANYID" ] ) ;
}
if ( opstatus = = "add" )
{
headData . INPUTBY = Convert . ToString ( Session [ "SHOWNAME" ] ) ;
headData . INPUTDATE = DateTime . Now . ToShortDateString ( ) ;
headData . DbOperationType = DbOperationType . DbotIns ;
}
else if ( opstatus = = "edit" )
{
headData . DbOperationType = DbOperationType . DbotUpd ;
headData . ModelUIStatus = "E" ;
}
else
{
headData . DbOperationType = DbOperationType . DbotDel ;
}
if ( headData . ETA = = "" ) headData . ETA = null ;
if ( headData . ETD = = "" ) headData . ETD = null ;
if ( ! string . IsNullOrEmpty ( headData . ETD ) ) {
headData . ETD = Convert . ToDateTime ( headData . ETD ) . ToString ( "yyyy-MM-dd" ) ;
}
if ( headData . LASTPORTOFCALLDATE = = "" ) headData . LASTPORTOFCALLDATE = null ;
if ( headData . FIRSTPORTOFCALLDATE = = "" ) headData . FIRSTPORTOFCALLDATE = null ;
headData . VESSEL = MsBaseInfoDAL . DelPortCn ( headData . VESSEL ) ;
headData . PORTLOAD = MsBaseInfoDAL . DelPortCn ( headData . PORTLOAD ) ;
headData . PORTDISCHARGE = MsBaseInfoDAL . DelPortCn ( headData . PORTDISCHARGE ) ;
headData . PORTDISCHARGE = MsBaseInfoDAL . DelPortCn ( headData . PORTDISCHARGE ) ;
headData . DESTINATION = MsBaseInfoDAL . DelPortCn ( headData . DESTINATION ) ;
#region 判断字段长度
if ( isPost )
{
var seaefield = MsSoftSysTableDAL . GetDefTableDetailList ( "OP_SEAE_EDI" ) ;
foreach ( var enumValue in seaefield )
{
if ( enumValue . FIELDNAME = = "MBLNO" & & headData . MBLNO . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "主提单号超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "HBLNO" & & headData . HBLNO . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "分提单号超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CUSTNO" & & headData . CUSTNO . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "委托编号超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "ORDERNO" & & headData . ORDERNO . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "订舱编号超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SHIPPER" & & headData . SHIPPER . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "发货人超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONSIGNEE" & & headData . CONSIGNEE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "收货人超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "NOTIFYPARTY" & & headData . NOTIFYPARTY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "通知人超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "AGENTID" & & headData . AGENTID . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "代理名称超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "VESSEL" & & headData . VESSEL . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "船名超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "VOYNO" & & headData . VOYNO . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "航次超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "PlACERECEIPT" & & headData . PLACERECEIPT . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "收货地超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "PORTLOADID" & & headData . PORTLOADID . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "装货港代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "PORTLOAD" & & headData . PORTLOAD . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "装货港超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "PORTDISCHARGEID" & & headData . PORTDISCHARGEID . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "卸货港代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "PORTDISCHARGE" & & headData . PORTDISCHARGE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "卸货港超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "PLACEDELIVERYID" & & headData . PLACEDELIVERYID . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "交货地代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "PLACEDELIVERY" & & headData . PLACEDELIVERY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "交货地超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "DESTINATIONID" & & headData . DESTINATIONID . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "目的地代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "DESTINATION" & & headData . DESTINATION . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "目的地超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "ISSUEPLACE" & & headData . ISSUEPLACE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "签单地点超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "BLFRT" & & headData . BLFRT . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "付费方式超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SERVICE" & & headData . SERVICE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "运输条款超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "MARKS" & & headData . MARKS . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "唛头超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "DESCRIPTION" & & headData . DESCRIPTION . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "货物描述超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "KINDPKGS" & & headData . KINDPKGS . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "包装超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "DCLASS" & & headData . DCLASS . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "危险品类别超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "DUNNO" & & headData . DUNNO . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "危险品编号超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "REEFERF" & & headData . REEFERF . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "冷藏通风量超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "TEMPID" & & headData . TEMPID . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "温度单位超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "TEMPSET" & & headData . TEMPSET . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "设置温度超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "TEMPMAX" & & headData . TEMPMAX . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "最高温度超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "TEMPMIN" & & headData . TEMPMIN . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "最低温度超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "LINKMAN" & & headData . LINKMAN . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "客户联系人超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "DPAGE" & & headData . DPAGE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "危险品页号超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "HUMIDITY" & & headData . HUMIDITY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "湿度超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "DLABEL" & & headData . DLABEL . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "危险品标签超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SHIPPERNAME" & & headData . SHIPPERNAME . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "发货人名称超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SHIPPERADDR1" & & headData . SHIPPERADDR1 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "发货人地址1超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SHIPPERADDR2" & & headData . SHIPPERADDR2 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "发货人地址2超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SHIPPERADDR3" & & headData . SHIPPERADDR3 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "发货人地址3超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SHIPPERCITY" & & headData . SHIPPERCITY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "发货人城市代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SHIPPERPOSTCODE" & & headData . SHIPPERPOSTCODE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "发货人邮编超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SHIPPERPROVINCE" & & headData . SHIPPERPROVINCE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "发货人省份超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SHIPPERCOUNTRY" & & headData . SHIPPERPOSTCODE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "发货人国家代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SHIPPERATTN" & & headData . SHIPPERATTN . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "发货人联系人超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SHIPPERTEL" & & headData . SHIPPERPOSTCODE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "发货人电话超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SHIPPERPOSTCODE" & & headData . SHIPPERPOSTCODE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "发货人邮编超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONSIGNEENAME" & & headData . CONSIGNEENAME . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "收货人名称超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONSIGNEEADDR1" & & headData . CONSIGNEEADDR1 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "收货人地址1超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONSIGNEEADDR2" & & headData . CONSIGNEEADDR2 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "收货人地址2超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONSIGNEEADDR3" & & headData . CONSIGNEEADDR3 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "收货人地址3超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONSIGNEECITY" & & headData . CONSIGNEECITY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "收货人城市代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONSIGNEEPOSTCODE" & & headData . CONSIGNEEPOSTCODE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "收货人邮编超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONSIGNEEPROVINCE" & & headData . CONSIGNEEPROVINCE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "收货人省份超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONSIGNEECOUNTRY" & & headData . CONSIGNEECOUNTRY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "收货人国家代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONSIGNEEATTN" & & headData . CONSIGNEEATTN . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "收货人联系人超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONSIGNEETEL" & & headData . CONSIGNEETEL . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "收货人电话超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONSIGNEEPOSTCODE" & & headData . CONSIGNEEPOSTCODE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "收货人邮编超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "NOTIFYPARTYNAME" & & headData . NOTIFYPARTYNAME . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "通知人名称超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "NOTIFYPARTYADDR1" & & headData . NOTIFYPARTYADDR1 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "通知人地址1超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "NOTIFYPARTYADDR2" & & headData . NOTIFYPARTYADDR2 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "通知人地址2超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "NOTIFYPARTYADDR3" & & headData . NOTIFYPARTYADDR3 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "通知人地址3超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "NOTIFYPARTYCITY" & & headData . NOTIFYPARTYCITY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "通知人城市代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "NOTIFYPARTYPOSTCODE" & & headData . NOTIFYPARTYPOSTCODE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "通知人邮编超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "NOTIFYPARTYPROVINCE" & & headData . NOTIFYPARTYPROVINCE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "通知人省份超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "NOTIFYPARTYCOUNTRY" & & headData . NOTIFYPARTYCOUNTRY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "通知人国家代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "NOTIFYPARTYATTN" & & headData . NOTIFYPARTYATTN . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "通知人联系人超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "NOTIFYPARTYTEL" & & headData . NOTIFYPARTYTEL . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "通知人电话超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "NOTIFYPARTYPOSTCODE" & & headData . NOTIFYPARTYPOSTCODE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "通知人邮编超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "LASTPORTOFCALLID" & & headData . LASTPORTOFCALLID . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "最后境外港超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "FIRSTPORTOFCALLID" & & headData . FIRSTPORTOFCALLID . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "第一个停靠港港口超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "LASTPORTOFCALLID" & & headData . LASTPORTOFCALLID . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "最后境外港代码超长,字段长度限制" + enumValue . FIELDLEN ; }
//if (enumValue.FIELDNAME == "LASTPORTOFCALLDATE" && headData.LASTPORTOFCALLDATE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "第一个停靠港港口代码超长,字段长度限制" + enumValue.FIELDLEN; }
//if (enumValue.FIELDNAME == "FIRSTPORTOFCALLDATE" && headData.FIRSTPORTOFCALLDATE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "离港日期超长,字段长度限制" + enumValue.FIELDLEN; }
if ( enumValue . FIELDNAME = = "SHIPIMO" & & headData . SHIPIMO . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "船舶呼号超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SHIPSERVICENO" & & headData . SHIPSERVICENO . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "船舶(IMO)号超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CARRIERID" & & headData . CARRIERID . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "船公司代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "ARVESSEL" & & headData . ARVESSEL . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "抵港船名超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "ARVOYNO" & & headData . ARVOYNO . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "抵港航次超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "ARSHIPIMO" & & headData . ARSHIPIMO . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "抵港呼号超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "ARSHIPSERVICENO" & & headData . ARSHIPSERVICENO . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "抵港(IMO)号超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "AGENTID" & & headData . AGENTID . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "代理代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "AMSSCACCODE" & & headData . AMSSCACCODE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "AMS SCAC超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SELLERNAME" & & headData . SELLERNAME . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "卖方名称超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SELLERADDR1" & & headData . SELLERADDR1 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "卖方地址1超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SELLERADDR2" & & headData . SELLERADDR2 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "卖方地址2超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SELLERCITY" & & headData . SELLERCITY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "卖方城市代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SELLERPROVINCE" & & headData . SELLERPROVINCE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "卖方省份代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SELLERCOUNTRY" & & headData . SELLERCOUNTRY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "卖方国家代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SELLEREMAIL" & & headData . SELLEREMAIL . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "卖方邮箱超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "BUYERNAME" & & headData . BUYERNAME . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "买方名称超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "BUYERADDR1" & & headData . BUYERADDR1 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "买方地址1超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "BUYERADDR2" & & headData . BUYERADDR2 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "买方地址2超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "BUYERCITY" & & headData . BUYERCITY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "买方城市代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "BUYERPROVINCE" & & headData . BUYERPROVINCE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "买方省份代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "BUYERCOUNTRY" & & headData . BUYERCOUNTRY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "买方国家代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "BUYEREMAIL" & & headData . BUYEREMAIL . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "买方邮箱超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SHIPTOPARTYNAME" & & headData . SHIPTOPARTYNAME . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "货物送达的公司名称超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SHIPTOPARTYADDR1" & & headData . SHIPTOPARTYADDR1 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "货物送达的公司地址1超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SHIPTOPARTYADDR2" & & headData . SHIPTOPARTYADDR2 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "货物送达的公司地址2超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SHIPTOPARTYCITY" & & headData . SHIPTOPARTYCITY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "货物送达的公司城市代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SHIPTOPARTYPROVINCE" & & headData . SHIPTOPARTYPROVINCE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "货物送达的公司省份代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SHIPTOPARTYCOUNTRY" & & headData . SHIPTOPARTYCOUNTRY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "货物送达的公司国家代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "SHIPTOPARTYEMAIL" & & headData . SHIPTOPARTYEMAIL . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "货物送达的公司邮箱超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONTAINERLOCATIONNAME" & & headData . CONTAINERLOCATIONNAME . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "装柜信息名称超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONTAINERLOCATIONADDR1" & & headData . CONTAINERLOCATIONADDR1 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "装柜信息地址1超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONTAINERLOCATIONADDR2" & & headData . CONTAINERLOCATIONADDR2 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "装柜信息地址2超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONTAINERLOCATIONCITY" & & headData . CONTAINERLOCATIONCITY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "装柜信息城市代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONTAINERLOCATIONPROVINCE" & & headData . CONTAINERLOCATIONPROVINCE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "装柜信息省份代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONTAINERLOCATIONCOUNTRY" & & headData . CONTAINERLOCATIONCOUNTRY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "装柜信息国家代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONTAINERLOCATIONEMAIL" & & headData . CONTAINERLOCATIONEMAIL . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "装柜信息邮箱超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "MANUFACTURERNAME" & & headData . MANUFACTURERNAME . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "工厂名称超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "MANUFACTURERADDR1" & & headData . MANUFACTURERADDR1 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "工厂地址1超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "MANUFACTURERADDR2" & & headData . MANUFACTURERADDR2 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "工厂地址2超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "MANUFACTURERCITY" & & headData . MANUFACTURERCITY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "工厂城市代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "MANUFACTURERPROVINCE" & & headData . MANUFACTURERPROVINCE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "工厂省份代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "MANUFACTURERCOUNTRY" & & headData . MANUFACTURERCOUNTRY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "工厂国家代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "MANUFACTUREREMAIL" & & headData . MANUFACTUREREMAIL . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "工厂邮箱超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONSOLIDATORNAME" & & headData . CONSOLIDATORNAME . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "拼箱公司名称超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONSOLIDATORADDR1" & & headData . CONSOLIDATORADDR1 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "拼箱公司地址1超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONSOLIDATORADDR2" & & headData . CONSOLIDATORADDR2 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "拼箱公司地址2超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONSOLIDATORCITY" & & headData . CONSOLIDATORCITY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "拼箱公司城市代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONSOLIDATORPROVINCE" & & headData . CONSOLIDATORPROVINCE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "拼箱公司省份代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONSOLIDATORCOUNTRY" & & headData . CONSOLIDATORCOUNTRY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "拼箱公司国家代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONSOLIDATOREMAIL" & & headData . CONSOLIDATOREMAIL . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "拼箱公司邮箱超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "IMPORTERNAME" & & headData . IMPORTERNAME . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "进口商名称超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "IMPORTERADDR1" & & headData . IMPORTERADDR1 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "进口商地址1超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "IMPORTERADDR2" & & headData . IMPORTERADDR2 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "进口商地址2超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "IMPORTERCITY" & & headData . IMPORTERCITY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "进口商城市代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "IMPORTERPROVINCE" & & headData . IMPORTERPROVINCE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "进口商省份代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "IMPORTERCOUNTRY" & & headData . IMPORTERCOUNTRY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "进口商国家代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "IMPORTEREMAIL" & & headData . IMPORTEREMAIL . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "进口商邮箱超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "BOOKINGPARTYNAME" & & headData . BOOKINGPARTYNAME . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "订舱方名称超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "BOOKINGPARTYADDR1" & & headData . BOOKINGPARTYADDR1 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "订舱方地址1超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "BOOKINGPARTYADDR2" & & headData . BOOKINGPARTYADDR2 . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "订舱方地址2超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "BOOKINGPARTYCITY" & & headData . BOOKINGPARTYCITY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "订舱方城市代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "BOOKINGPARTYPROVINCE" & & headData . BOOKINGPARTYPROVINCE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "订舱方省份代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "BOOKINGPARTYCOUNTRY" & & headData . BOOKINGPARTYCOUNTRY . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "订舱方国家代码超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "BOOKINGPARTYEMAIL" & & headData . BOOKINGPARTYEMAIL . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "订舱方邮箱超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "ISFIMPORTER_CODE" & & headData . ISFIMPORTER_CODE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "ISFImporter证件号超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "IMPORTER_CODE" & & headData . IMPORTER_CODE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "Importer证件号超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "CONSIGNEE_CODE" & & headData . CONSIGNEE_CODE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "Consignee证件号超长,字段长度限制" + enumValue . FIELDLEN ; }
if ( enumValue . FIELDNAME = = "BONDHOLDER_CODE" & & headData . BONDHOLDER_CODE . Length > Convert . ToInt32 ( enumValue . FIELDLEN ) ) { isPost = false ; errorstr = "Bond Holder((买方)证件号超长,字段长度限制" + enumValue . FIELDLEN ; }
}
}
# endregion
var BSNO = headData . MFNO ;
if ( isPost )
{
var modb = new ModelObjectDB ( ) ;
DBResult result = modb . Save ( headData ) ;
if ( result . Success = = true )
{
result = MsOpSeaeEdiDAL . SaveDetail ( headData , bodyList , cargoList ) ;
}
var jsonRespose = new JsonResponse
{
Success = result . Success ,
Message = result . Message ,
Data = MsOpSeaeEdiDAL . GetData ( "MFNO='" + BSNO + "'" )
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
else {
var jsonRespose = new JsonResponse { Success = false , Message = errorstr } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
}
public ContentResult DeleteDetail ( string data )
{
var head = JsonConvert . Deserialize < MsOpSeaeEdiCtn > ( data ) ;
DBResult result = MsOpSeaeEdiDAL . DeleteDetail2 ( head ) ;
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult DeleteDetailCargo ( string data )
{
var head = JsonConvert . Deserialize < MsOpSeaeEdiCtnDetail > ( data ) ;
DBResult result = MsOpSeaeEdiDAL . DeleteDetailCargo ( head ) ;
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult Delete ( string data )
{
var head = JsonConvert . Deserialize < MsOpSeaeEdi > ( data ) ;
var modb = new ModelObjectDB ( ) ;
DBResult result = modb . Delete ( head ) ;
if ( result . Success = = true ) { MsOpSeaeEdiDAL . DeleteDetail ( head ) ; }
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult DeletePiLiang ( string bsnos )
{
DBResult result = MsOpSeaeEdiDAL . DeletePiLiang ( bsnos ) ;
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
# endregion
#region AFR
public ContentResult AFRSendData ( string data , string data2 , string mblno )
{
var headData = JsonConvert . Deserialize < MsOpSeaeEdi > ( data . Replace ( "}" , "," ) + data2 . Replace ( "{" , "" ) ) ;
var headList = new List < MsOpSeaeEdi > ( ) ;
headList . Add ( headData ) ;
var path = Server . MapPath ( "../../EDIFiles/AFR" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
var result = new DBResult ( ) ;
var error = "" ;
if ( headList [ 0 ] . EDITYPE = = "AMS" | | headList [ 0 ] . EDITYPE = = "EMANIFEST" | | headList [ 0 ] . EDITYPE = = "ACI" | | headList [ 0 ] . EDITYPE = = "ISF" )
error = MsOpSeaeEdiDAL . IsCreateAMS ( headList , headList [ 0 ] . EDITYPE ) ;
else
error = MsOpSeaeEdiDAL . IsCreateAFR ( headList ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='AFR'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var filename = MsOpSeaeEdiDAL . CreateXmlStr ( headList , ftpset , Convert . ToString ( Session [ "CODENAME" ] ) , path , mblno ) ;
if ( ftpset . SERVERIP ! = "" & & ftpset . SERVERIP ! = null )
result = MsOpSeaeEdiDAL . FtpFile ( filename , ftpset ) ;
else
{
result . Success = false ;
result . Message = "FTP参数没有设置,请先设置FTP参数!" ;
}
if ( result . Success = = true ) { MsOpSeaeEdiDAL . UpSendStatus ( headList , "已发送" ) ;
T_ALL_DA T_ALL_DA = new EntityDA . T_ALL_DA ( ) ;
foreach ( var bill in headList )
{
var blUpSQL = " if (select CID from Op_SeaCover where bsno='" + bill . BSNO + "' AND COVERTITLE='发送AFR') is null insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + bill . BSNO + "','发送AFR','','" + Session [ "SHOWNAME" ] + "','" + DateTime . Now . ToString ( "yyyy-MM-dd HH:mm:ss" ) + "','1')" ;
bool bl = T_ALL_DA . GetExecuteSqlCommand ( blUpSQL ) ;
}
}
}
else
{
result . Success = false ;
result . Message = error ;
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult AFRSend ( string headData , string mblno )
{
var headList = JsonConvert . Deserialize < List < MsOpSeaeEdi > > ( headData ) ;
var path = Server . MapPath ( "../../EDIFiles/AFR" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
var result = new DBResult ( ) ;
var error = "" ;
if ( headList [ 0 ] . EDITYPE = = "AMS" | | headList [ 0 ] . EDITYPE = = "ACI" | | headList [ 0 ] . EDITYPE = = "EMANIFEST" | | headList [ 0 ] . EDITYPE = = "ISF" )
error = MsOpSeaeEdiDAL . IsCreateAMS ( headList , headList [ 0 ] . EDITYPE ) ;
else
error = MsOpSeaeEdiDAL . IsCreateAFR ( headList ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='AFR'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var filename = MsOpSeaeEdiDAL . CreateXmlStr ( headList , ftpset , Convert . ToString ( Session [ "CODENAME" ] ) , path , mblno ) ;
if ( ftpset . SERVERIP ! = "" & & ftpset . SERVERIP ! = null )
result = MsOpSeaeEdiDAL . FtpFile ( filename , ftpset ) ;
else
{
result . Success = false ;
result . Message = "FTP参数没有设置,请先设置FTP参数!" ;
}
if ( result . Success = = true ) { MsOpSeaeEdiDAL . UpSendStatus ( headList , "已发送" ) ;
T_ALL_DA T_ALL_DA = new EntityDA . T_ALL_DA ( ) ;
foreach ( var bill in headList )
{
var blUpSQL = " if (select CID from Op_SeaCover where bsno='" + bill . BSNO + "' AND COVERTITLE='发送AFR') is null insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + bill . BSNO + "','发送AFR','','" + Session [ "SHOWNAME" ] + "','" + DateTime . Now . ToString ( "yyyy-MM-dd HH:mm:ss" ) + "','1')" ;
bool bl = T_ALL_DA . GetExecuteSqlCommand ( blUpSQL ) ;
}
}
}
else {
result . Success = false ;
result . Message = error ;
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult AFREditSend ( string bsnos , string type , string filerole = "9" )
{
DBResult result = MsOpSeaeEdiPortDAL . CreateAfrList ( bsnos , type , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , filerole ) ;
if ( result . Success = = true )
{
var MFNOS = result . Data . ToString ( ) . Replace ( "," , "','" ) ;
var headList = MsOpSeaeEdiDAL . GetDataList ( "MFNO IN ('" + MFNOS + "')" , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
// var headList = JsonConvert.Deserialize<List<MsOpSeaeEdi>>(headData);
var path = Server . MapPath ( "../../EDIFiles/AFR" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
var error = "" ;
if ( type = = "AMS" | | type = = "ACI" | | type = = "EMANIFEST" | | type = = "CGAMS" | | type = = "ISF" )
error = MsOpSeaeEdiDAL . IsCreateAMS ( headList , type ) ;
else
error = MsOpSeaeEdiDAL . IsCreateAFR ( headList ) ;
if ( error = = "" )
{
var filename = "" ;
CodeFtpSet ftpset = new CodeFtpSet ( ) ;
if ( type = = "CGAFR" )
{
ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='CGAFR'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
}
else
{
ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='AFR'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
}
if ( ftpset . SERVERIP ! = "" & & ftpset . SERVERIP ! = null )
{
foreach ( var enumDetail in headList )
{
var headEdiList = new List < MsOpSeaeEdi > ( ) ;
headEdiList . Add ( enumDetail ) ;
if ( type = = "CGAFR" )
{
filename = MsOpSeaeEdiDAL . CreateCargoSmartXmlStr ( headEdiList , ftpset , Convert . ToString ( Session [ "CODENAME" ] ) , path , headEdiList [ 0 ] . MBLNO ) ;
}
else
{
filename = MsOpSeaeEdiDAL . CreateXmlStr ( headEdiList , ftpset , Convert . ToString ( Session [ "CODENAME" ] ) , path , headEdiList [ 0 ] . MBLNO ) ;
}
result = MsOpSeaeEdiDAL . FtpFile ( filename , ftpset ) ;
if ( result . Success = = true )
{
MsOpSeaeEdiDAL . UpSendStatus ( headEdiList , "已发送" ) ;
filename = Path . GetFileName ( filename ) ;
MsOpSeaeEdiPortDAL . InsertEdiLog ( headEdiList [ 0 ] . BSNO , type , "AFR" , "" , ftpset . SERVERIP , filename , "../../EDIFiles/AFR/" + filename , Convert . ToString ( Session [ "SHOWNAME" ] ) ) ;
T_ALL_DA T_ALL_DA = new EntityDA . T_ALL_DA ( ) ;
foreach ( var bill in headEdiList )
{
var blUpSQL = " if (select CID from Op_SeaCover where bsno='" + bill . BSNO + "' AND COVERTITLE='发送AFR') is null insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + bill . BSNO + "','发送AFR','','" + Session [ "SHOWNAME" ] + "','" + DateTime . Now . ToString ( "yyyy-MM-dd HH:mm:ss" ) + "','1')" ;
bool bl = T_ALL_DA . GetExecuteSqlCommand ( blUpSQL ) ;
}
}
}
}
else
{
result . Success = false ;
result . Message = "FTP参数没有设置,请先设置FTP参数!" ;
}
}
else
{
T_ALL_DA T_ALL_DA = new EntityDA . T_ALL_DA ( ) ;
string blUpSQL = "delete from op_seae_edi where MFNO IN ('" + MFNOS + "')" ;
bool bl = T_ALL_DA . GetExecuteSqlCommand ( blUpSQL ) ;
blUpSQL = "delete from op_seae_edi_ctn where MFNO IN ('" + MFNOS + "')" ;
bl = T_ALL_DA . GetExecuteSqlCommand ( blUpSQL ) ;
blUpSQL = "delete from op_seae_edi_ctndetail where MFNO IN ('" + MFNOS + "')" ;
bl = T_ALL_DA . GetExecuteSqlCommand ( blUpSQL ) ;
result . Success = false ;
result . Message = error ;
}
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult AFRSaveFile ( string headData , string mblno )
{
var headList = JsonConvert . Deserialize < List < MsOpSeaeEdi > > ( headData ) ;
var path = Server . MapPath ( "../../EDIFiles/AFR" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
var result = new DBResult ( ) ;
var error = "" ;
if ( headList [ 0 ] . EDITYPE = = "AMS" | | headList [ 0 ] . EDITYPE = = "EMANIFEST" | | headList [ 0 ] . EDITYPE = = "ACI" | | headList [ 0 ] . EDITYPE = = "CGAMS" )
error = MsOpSeaeEdiDAL . IsCreateAMS ( headList , headList [ 0 ] . EDITYPE ) ;
else
error = MsOpSeaeEdiDAL . IsCreateAFR ( headList ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='AFR'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var filename = MsOpSeaeEdiDAL . CreateXmlStr ( headList , ftpset , Convert . ToString ( Session [ "CODENAME" ] ) , path , mblno ) ;
filename = Path . GetFileName ( filename ) ;
result . Success = MsOpSeaeEdiDAL . UpSendStatus ( headList , "已保存文件" ) ;
result . Data = "../../EDIFiles/AFR/" + filename ;
result . Message = filename ;
}
else
{
result . Success = false ;
result . Message = error ;
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message , Data = result . Data } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult AFREditSaveFile ( string bsnos , string type , string filerole = "9" )
{
DBResult result = MsOpSeaeEdiPortDAL . CreateAfrList ( bsnos , type , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , filerole ) ;
if ( result . Success = = true )
{
var MFNOS = result . Data . ToString ( ) . Replace ( "," , "','" ) ;
var headList = MsOpSeaeEdiDAL . GetDataList ( "MFNO IN ('" + MFNOS + "')" , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
// var headList = JsonConvert.Deserialize<List<MsOpSeaeEdi>>(headData);
var path = Server . MapPath ( "../../EDIFiles/AFR" ) ;
var xsdfile = Server . MapPath ( "../../EDIFiles/CS-SYSINT-STD-IG-CUSTOMS-MANIFEST-NVO.xsd" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
var error = "" ;
if ( type = = "AMS" | | type = = "EMANIFEST" | | type = = "ACI" | | type = = "ISF" )
error = MsOpSeaeEdiDAL . IsCreateAMS ( headList , type ) ;
else
error = MsOpSeaeEdiDAL . IsCreateAFR ( headList ) ;
if ( error = = "" )
{
var filename = "" ;
CodeFtpSet ftpset = new CodeFtpSet ( ) ;
if ( type = = "CGAFR" )
{
ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='CGAFR'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
filename = MsOpSeaeEdiDAL . CreateCargoSmartXmlStr ( headList , ftpset , Convert . ToString ( Session [ "CODENAME" ] ) , path , headList [ 0 ] . MBLNO ) ;
//var xsderro = MsOpSeaeEdiDAL.XmlValidationByXsd(filename, xsdfile);
//if (xsderro == "")
//{
result = MsOpSeaeEdiDAL . FtpFile ( filename , ftpset ) ;
//}
//else
//{
// result.Success = false;
// result.Message = "验证错误!(" + xsderro + ")";
//}
}
else
{
ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='AFR'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
filename = MsOpSeaeEdiDAL . CreateXmlStr ( headList , ftpset , Convert . ToString ( Session [ "CODENAME" ] ) , path , headList [ 0 ] . MBLNO ) ;
}
filename = Path . GetFileName ( filename ) ;
result . Success = MsOpSeaeEdiDAL . UpSendStatus ( headList , "已保存文件" ) ;
result . Data = "../../EDIFiles/AFR/" + filename ;
result . Message = filename ;
}
else
{
result . Success = false ;
result . Message = error ;
}
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message , Data = result . Data } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
#region E-FREIGHT
public ContentResult AFREFSend ( string headData , string mblno )
{
var headList = JsonConvert . Deserialize < List < MsOpSeaeEdi > > ( headData ) ;
var path = Server . MapPath ( "../../EDIFiles/AFR" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
var result = new DBResult ( ) ;
var error = MsOpSeaeEdiDAL . IsCreateAFR ( headList , "EFAFR" ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='EFAFR'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( ftpset . SERVERIP = = "" ) error = error + " FTP服务地址没有设置;" ;
if ( ftpset . USERNAME = = "" ) error = error + " FTP服务地址用户名没有设置;" ;
if ( ftpset . SENDCODE = = "" ) error = error + " 发送方代码没有设置;" ;
if ( ftpset . SENDCOMPANYCODE = = "" ) error = error + " 发送方公司代码没有设置;" ;
if ( ftpset . SENDSUBCOMPANYCODE = = "" ) error = error + " 发送方分公司代码没有设置;" ;
if ( ftpset . SENDCODE = = "" ) error = error + " 发送方代码没有设置;" ;
if ( ftpset . RECEIVECODE = = "" ) error = error + " 接收方代码没有设置;" ;
if ( error = = "" )
{
var filename = MsOpSeaeEdiDAL . CreateEFXmlStr ( headList , Convert . ToString ( Session [ "USERCODE" ] ) , path , mblno , ftpset ) ;
result = MsOpSeaeEdiDAL . FtpFile ( filename , ftpset ) ;
}
else
{
result . Success = false ;
result . Message = "FTP参数没有设置,请先设置FTP参数!(" + error + ")" ;
}
if ( result . Success = = true ) {
MsOpSeaeEdiDAL . UpSendStatus ( headList , "已发送" ) ;
foreach ( var bill in headList )
{
if ( bill . PACKINGTYPE = = "MASTER" )
{
var houselist = MsOpSeaeEdiDAL . GetHouse ( bill ) ;
MsOpSeaeEdiDAL . UpSendStatus ( houselist , "已发送" ) ;
}
}
}
}
else
{
result . Success = false ;
result . Message = error ;
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult AFREFWEBSend ( string headData , string mblno )
{
var headList = JsonConvert . Deserialize < List < MsOpSeaeEdi > > ( headData ) ;
var path = Server . MapPath ( "../../EDIFiles/AFR" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
var result = new DBResult ( ) ;
var error = MsOpSeaeEdiDAL . IsCreateAFR ( headList , "EFAFR" ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='EFAFR'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
//if (ftpset.SERVERIP == "") error = error + " FTP服务地址没有设置;";
//if (ftpset.USERNAME == "") error = error + " FTP服务地址用户名没有设置;";
if ( ftpset . SENDCODE = = "" ) error = error + " 发送方代码没有设置;" ;
if ( ftpset . SENDCOMPANYCODE = = "" ) error = error + " 发送方公司代码没有设置;" ;
if ( ftpset . SENDSUBCOMPANYCODE = = "" ) error = error + " 发送方分公司代码没有设置;" ;
if ( ftpset . SENDCODE = = "" ) error = error + " 发送方代码没有设置;" ;
if ( ftpset . RECEIVECODE = = "" ) error = error + " 接收方代码没有设置;" ;
if ( error = = "" )
{
var filename = MsOpSeaeEdiDAL . CreateEFXmlStr ( headList , Convert . ToString ( Session [ "USERCODE" ] ) , path , mblno , ftpset ) ;
result = MsOpSeaeEdiDAL . EFWEBPOST ( filename , ftpset . USERNAME . ToUpper ( ) , "BFF37056D92DBE19" ) ;
}
else
{
result . Success = false ;
result . Message = "EDI参数没有设置,请先设置EDI参数!(" + error + ")" ;
}
if ( result . Success = = true )
{
MsOpSeaeEdiDAL . UpSendStatus ( headList , "已发送" ) ;
foreach ( var bill in headList )
{
if ( bill . PACKINGTYPE = = "MASTER" )
{
var houselist = MsOpSeaeEdiDAL . GetHouse ( bill ) ;
MsOpSeaeEdiDAL . UpSendStatus ( houselist , "已发送" ) ;
}
}
}
}
else
{
result . Success = false ;
result . Message = error ;
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult AFREFSaveFile ( string headData , string mblno )
{
var headList = JsonConvert . Deserialize < List < MsOpSeaeEdi > > ( headData ) ;
var path = Server . MapPath ( "../../EDIFiles/AFR" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
var result = new DBResult ( ) ;
var error = MsOpSeaeEdiDAL . IsCreateAFR ( headList , "EFAFR" ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='EFAFR'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( ftpset . SENDCODE = = "" ) error = error + " 发送方代码没有设置;" ;
if ( ftpset . SENDCOMPANYCODE = = "" ) error = error + " 发送方公司代码没有设置;" ;
if ( ftpset . SENDSUBCOMPANYCODE = = "" ) error = error + " 发送方分公司代码没有设置;" ;
if ( ftpset . SENDCODE = = "" ) error = error + " 发送方代码没有设置;" ;
if ( ftpset . RECEIVECODE = = "" ) error = error + " 接收方代码没有设置;" ;
if ( error = = "" )
{
var filename = MsOpSeaeEdiDAL . CreateEFXmlStr ( headList , Convert . ToString ( Session [ "USERCODE" ] ) , path , mblno , ftpset ) ;
filename = Path . GetFileName ( filename ) ;
result . Success = MsOpSeaeEdiDAL . UpSendStatus ( headList , "已保存文件" ) ;
result . Data = "../../EDIFiles/AFR/" + filename ;
result . Message = filename ;
foreach ( var bill in headList )
{
if ( bill . PACKINGTYPE = = "MASTER" )
{
var houselist = MsOpSeaeEdiDAL . GetHouse ( bill ) ;
MsOpSeaeEdiDAL . UpSendStatus ( houselist , "已保存文件" ) ;
}
}
}
else
{
result . Success = false ;
result . Message = "FTP参数没有设置,请先设置FTP参数!(" + error + ")" ;
}
}
else
{
result . Success = false ;
result . Message = error ;
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message , Data = result . Data } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult AMSEFSend ( string headData , string mblno )
{
var headList = JsonConvert . Deserialize < List < MsOpSeaeEdi > > ( headData ) ;
var path = Server . MapPath ( "../../EDIFiles/AFR" ) ;
var xsdfile = Server . MapPath ( "../../EDIFiles/EFT-GSF.xsd" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
var result = new DBResult ( ) ;
var error = MsOpSeaeEdiDAL . IsCreateAMS ( headList , "EFAMS" ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='EFAMS'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( ftpset . SERVERIP = = "" ) error = error + " FTP服务地址没有设置;" ;
if ( ftpset . USERNAME = = "" ) error = error + " FTP服务地址用户名没有设置;" ;
if ( ftpset . SENDCODE = = "" ) error = error + " 发送方代码没有设置;" ;
if ( ftpset . SENDCOMPANYCODE = = "" ) error = error + " 发送方公司代码没有设置;" ;
if ( ftpset . SENDSUBCOMPANYCODE = = "" ) error = error + " 发送方分公司代码没有设置;" ;
if ( ftpset . SENDCODE = = "" ) error = error + " 发送方代码没有设置;" ;
if ( ftpset . RECEIVECODE = = "" ) error = error + " 接收方代码没有设置;" ;
if ( error = = "" )
{
var filename = MsOpSeaeEdiDAL . CreateEFAMSXmlStr ( headList , Convert . ToString ( Session [ "USERCODE" ] ) , path , mblno , ftpset ) ;
var xsderro = MsOpSeaeEdiDAL . XmlValidationByXsd ( filename , xsdfile ) ;
if ( xsderro = = "" )
{
result = MsOpSeaeEdiDAL . FtpFile ( filename , ftpset ) ;
}
else
{
result . Success = false ;
result . Message = "验证错误!(" + xsderro + ")" ;
}
}
else
{
result . Success = false ;
result . Message = "FTP参数没有设置完整,请先设置FTP参数!(" + error + ")" ;
}
if ( result . Success = = true )
{
MsOpSeaeEdiDAL . UpSendStatus ( headList , "已发送" ) ;
}
}
else
{
result . Success = false ;
result . Message = error ;
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult AMSEFWEBSend ( string headData , string mblno )
{
var headList = JsonConvert . Deserialize < List < MsOpSeaeEdi > > ( headData ) ;
var path = Server . MapPath ( "../../EDIFiles/AFR" ) ;
var xsdfile = Server . MapPath ( "../../EDIFiles/EFT-GSF.xsd" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
var result = new DBResult ( ) ;
var error = MsOpSeaeEdiDAL . IsCreateAMS ( headList , "EFAMS" ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='EFAMS'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
//if (ftpset.SERVERIP == "") error = error + " FTP服务地址没有设置;";
//if (ftpset.USERNAME == "") error = error + " FTP服务地址用户名没有设置;";
if ( ftpset . SENDCODE = = "" ) error = error + " 发送方代码没有设置;" ;
if ( ftpset . SENDCOMPANYCODE = = "" ) error = error + " 发送方公司代码没有设置;" ;
if ( ftpset . SENDSUBCOMPANYCODE = = "" ) error = error + " 发送方分公司代码没有设置;" ;
if ( ftpset . SENDCODE = = "" ) error = error + " 发送方代码没有设置;" ;
if ( ftpset . RECEIVECODE = = "" ) error = error + " 接收方代码没有设置;" ;
if ( error = = "" )
{
var filename = MsOpSeaeEdiDAL . CreateEFAMSXmlStr ( headList , Convert . ToString ( Session [ "USERCODE" ] ) , path , mblno , ftpset ) ;
var xsderro = MsOpSeaeEdiDAL . XmlValidationByXsd ( filename , xsdfile ) ;
if ( xsderro = = "" )
{
result = MsOpSeaeEdiDAL . EFWEBPOST ( filename , ftpset . USERNAME . ToUpper ( ) , "BFF37056D92DBE19" ) ;
}
else
{
result . Success = false ;
result . Message = "验证错误!(" + xsderro + ")" ;
}
}
else
{
result . Success = false ;
result . Message = "FTP参数没有设置完整,请先设置FTP参数!(" + error + ")" ;
}
if ( result . Success = = true )
{
MsOpSeaeEdiDAL . UpSendStatus ( headList , "已发送" ) ;
}
}
else
{
result . Success = false ;
result . Message = error ;
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult AMSEFSaveFile ( string headData , string mblno )
{
var headList = JsonConvert . Deserialize < List < MsOpSeaeEdi > > ( headData ) ;
var path = Server . MapPath ( "../../EDIFiles/AFR" ) ;
var xsdfile = Server . MapPath ( "../../EDIFiles/EFT-GSF.xsd" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
var result = new DBResult ( ) ;
var error = MsOpSeaeEdiDAL . IsCreateAMS ( headList , "EFAMS" ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='EFAMS'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( ftpset . SENDCODE = = "" ) error = error + " 发送方代码没有设置;" ;
if ( ftpset . SENDCOMPANYCODE = = "" ) error = error + " 发送方公司代码没有设置;" ;
if ( ftpset . SENDSUBCOMPANYCODE = = "" ) error = error + " 发送方分公司代码没有设置;" ;
if ( ftpset . SENDCODE = = "" ) error = error + " 发送方代码没有设置;" ;
if ( ftpset . RECEIVECODE = = "" ) error = error + " 接收方代码没有设置;" ;
if ( error = = "" )
{
var filename = MsOpSeaeEdiDAL . CreateEFAMSXmlStr ( headList , Convert . ToString ( Session [ "USERCODE" ] ) , path , mblno , ftpset ) ;
filename = Path . GetFileName ( filename ) ;
var xsderro = MsOpSeaeEdiDAL . XmlValidationByXsd ( path + "\\" + filename , xsdfile ) ;
if ( xsderro = = "" )
{
result . Success = MsOpSeaeEdiDAL . UpSendStatus ( headList , "已保存文件" ) ;
result . Data = "../../EDIFiles/AFR/" + filename ;
result . Message = filename ;
MsOpSeaeEdiDAL . UpSendStatus ( headList , "已保存文件" ) ;
}
else {
result . Success = false ;
result . Message = "验证错误!(" + xsderro + ")" ;
}
}
else
{
result . Success = false ;
result . Message = "FTP参数没有设置,请先设置FTP参数!(" + error + ")" ;
}
}
else
{
result . Success = false ;
result . Message = error ;
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message , Data = result . Data } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult EFISFSaveFile ( string headData , string mblno )
{
var headList = JsonConvert . Deserialize < List < MsOpSeaeEdi > > ( headData ) ;
var path = Server . MapPath ( "../../EDIFiles/AFR" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
var result = new DBResult ( ) ;
var error = MsOpSeaeEdiDAL . IsCreateISF ( headList , "EFISF" ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='EFISF'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( ftpset . SENDCODE = = "" ) error = error + " 发送方代码没有设置;" ;
if ( ftpset . SENDCOMPANYCODE = = "" ) error = error + " 发送方公司代码没有设置;" ;
if ( ftpset . SENDSUBCOMPANYCODE = = "" ) error = error + " 发送方分公司代码没有设置;" ;
if ( ftpset . SENDCODE = = "" ) error = error + " 发送方代码没有设置;" ;
if ( ftpset . RECEIVECODE = = "" ) error = error + " 接收方代码没有设置;" ;
if ( error = = "" )
{
var filename = MsOpSeaeEdiDAL . CreateEFISFXmlStr ( headList , Convert . ToString ( Session [ "USERCODE" ] ) , path , mblno , ftpset ) ;
filename = Path . GetFileName ( filename ) ;
result . Success = MsOpSeaeEdiDAL . UpSendStatus ( headList , "已保存文件" ) ;
result . Data = "../../EDIFiles/AFR/" + filename ;
result . Message = filename ;
foreach ( var bill in headList )
{
if ( bill . PACKINGTYPE = = "MASTER" )
{
var houselist = MsOpSeaeEdiDAL . GetHouse ( bill ) ;
MsOpSeaeEdiDAL . UpSendStatus ( houselist , "已保存文件" ) ;
}
}
}
else
{
result . Success = false ;
result . Message = "FTP参数没有设置,请先设置FTP参数!(" + error + ")" ;
}
}
else
{
result . Success = false ;
result . Message = error ;
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message , Data = result . Data } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult EFISFSend ( string headData , string mblno )
{
var headList = JsonConvert . Deserialize < List < MsOpSeaeEdi > > ( headData ) ;
var path = Server . MapPath ( "../../EDIFiles/AFR" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
var result = new DBResult ( ) ;
var error = MsOpSeaeEdiDAL . IsCreateISF ( headList , "EFISF" ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='EFISF'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( ftpset . SERVERIP = = "" ) error = error + " FTP服务地址没有设置;" ;
if ( ftpset . USERNAME = = "" ) error = error + " FTP服务地址用户名没有设置;" ;
if ( ftpset . SENDCODE = = "" ) error = error + " 发送方代码没有设置;" ;
if ( ftpset . SENDCOMPANYCODE = = "" ) error = error + " 发送方公司代码没有设置;" ;
if ( ftpset . SENDSUBCOMPANYCODE = = "" ) error = error + " 发送方分公司代码没有设置;" ;
if ( ftpset . SENDCODE = = "" ) error = error + " 发送方代码没有设置;" ;
if ( ftpset . RECEIVECODE = = "" ) error = error + " 接收方代码没有设置;" ;
if ( error = = "" )
{
var filename = MsOpSeaeEdiDAL . CreateEFISFXmlStr ( headList , Convert . ToString ( Session [ "USERCODE" ] ) , path , mblno , ftpset ) ;
result = MsOpSeaeEdiDAL . FtpFile ( filename , ftpset ) ;
}
else
{
result . Success = false ;
result . Message = "FTP参数没有设置,请先设置FTP参数!(" + error + ")" ;
}
if ( result . Success = = true )
{
MsOpSeaeEdiDAL . UpSendStatus ( headList , "已发送" ) ;
foreach ( var bill in headList )
{
if ( bill . PACKINGTYPE = = "MASTER" )
{
var houselist = MsOpSeaeEdiDAL . GetHouse ( bill ) ;
MsOpSeaeEdiDAL . UpSendStatus ( houselist , "已发送" ) ;
}
}
}
}
else
{
result . Success = false ;
result . Message = error ;
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
# endregion
# endregion
#region 舱单申报
public ContentResult CustomEdiSend ( string headData , string mblno , string type , string filerole )
{
var headList = JsonConvert . Deserialize < List < MsOpSeaeEdi > > ( headData ) ;
var path = Server . MapPath ( "../../EDIFiles/CustomEdi" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
var result = new DBResult ( ) ;
var error = MsOpSeaeEdiDAL . IsCreateCustomEdi ( headList , type ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='" + type + "'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var filename = MsOpSeaeEdiDAL . CreateCustomEdi ( headList , Convert . ToString ( Session [ "USERCODE" ] ) , path , mblno , filerole , ftpset , type , 0 , 0 ) ;
if ( ftpset . SERVERIP ! = "" & & ftpset . SERVERIP ! = null )
result = MsOpSeaeEdiDAL . FtpFile ( filename , ftpset ) ;
else
{
result . Success = false ;
result . Message = "FTP参数没有设置,请先设置FTP参数!" ;
}
if ( result . Success = = true ) { MsOpSeaeEdiDAL . UpSendStatus ( headList , "已发送" ) ;
T_ALL_DA T_ALL_DA = new EntityDA . T_ALL_DA ( ) ;
foreach ( var bill in headList )
{
var blUpSQL = " if (select CID from Op_SeaCover where bsno='" + bill . BSNO + "' AND COVERTITLE='发送舱单') is null insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + bill . BSNO + "','发送舱单','','" + Session [ "SHOWNAME" ] + "','" + DateTime . Now . ToString ( "yyyy-MM-dd HH:mm:ss" ) + "','1')" ;
bool bl = T_ALL_DA . GetExecuteSqlCommand ( blUpSQL ) ;
}
}
}
else
{
result . Success = false ;
result . Message = error ;
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult CustomEdiSenddata ( string data , string data2 , string mblno , string type , string filerole )
{
var headData = JsonConvert . Deserialize < MsOpSeaeEdi > ( data . Replace ( "}" , "," ) + data2 . Replace ( "{" , "" ) ) ;
var headList = new List < MsOpSeaeEdi > ( ) ;
headList . Add ( headData ) ;
var path = Server . MapPath ( "../../EDIFiles/CustomEdi" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
var result = new DBResult ( ) ;
var error = MsOpSeaeEdiDAL . IsCreateCustomEdi ( headList , type ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='" + type + "'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var filename = MsOpSeaeEdiDAL . CreateCustomEdi ( headList , Convert . ToString ( Session [ "USERCODE" ] ) , path , mblno , filerole , ftpset , type , 0 , 0 ) ;
if ( ftpset . SERVERIP ! = "" & & ftpset . SERVERIP ! = null )
result = MsOpSeaeEdiDAL . FtpFile ( filename , ftpset ) ;
else
{
result . Success = false ;
result . Message = "FTP参数没有设置,请先设置FTP参数!" ;
}
if ( result . Success = = true ) { MsOpSeaeEdiDAL . UpSendStatus ( headList , "已发送" ) ;
T_ALL_DA T_ALL_DA = new EntityDA . T_ALL_DA ( ) ;
foreach ( var bill in headList )
{
var blUpSQL = " if (select CID from Op_SeaCover where bsno='" + bill . BSNO + "' AND COVERTITLE='发送舱单') is null insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + bill . BSNO + "','发送舱单','','" + Session [ "SHOWNAME" ] + "','" + DateTime . Now . ToString ( "yyyy-MM-dd HH:mm:ss" ) + "','1')" ;
bool bl = T_ALL_DA . GetExecuteSqlCommand ( blUpSQL ) ;
}
}
}
else
{
result . Success = false ;
result . Message = error ;
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult CustomEdiSave ( string headData , string mblno , string type , string filerole )
{
var headList = JsonConvert . Deserialize < List < MsOpSeaeEdi > > ( headData ) ;
var path = Server . MapPath ( "../../EDIFiles/CustomEdi" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
var result = new DBResult ( ) ;
var error = MsOpSeaeEdiDAL . IsCreateCustomEdi ( headList , type ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='" + type + "'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var filename = MsOpSeaeEdiDAL . CreateCustomEdi ( headList , Convert . ToString ( Session [ "USERCODE" ] ) , path , mblno , filerole , ftpset , type , 0 , 0 ) ;
filename = Path . GetFileName ( filename ) ;
result . Success = MsOpSeaeEdiDAL . UpSendStatus ( headList , "已保存文件" ) ;
result . Data = "../../EDIFiles/CustomEdi/" + filename ;
result . Message = filename ;
}
else
{
result . Success = false ;
result . Message = error ;
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message , Data = result . Data } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
#region 直发舱单
/// <summary>
/// 直发舱单EDI_主单
/// </summary>
/// <param name="bsnos"></param>
/// <param name="dcarrier"></param>
/// <param name="iscvessel"></param>
/// <param name="remarks"></param>
/// <returns></returns>
public ContentResult CustomEdiMail ( string bsnos , string dcarrier , int iscvessel , string remarks , string filetype = "" , string coscotype = "" )
{
bsnos = bsnos . Replace ( "," , "','" ) ;
var headList = MsOpSeaeDAL . GetFenList ( "BSNO IN ('" + bsnos + "')" , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var error = MsOpSeaeEdiDAL . IsCreateCustomEdiDs ( headList ) ;
//读取系统参数DSEDITYPE 如无或值为默认0则继续使用邮件方式, 否则改为用舱单平台
var DSEDITYPE = MsSysParamSetDAL . GetData ( "PARAMNAME='DSEDITYPE'" ) . PARAMVALUE ;
if ( DSEDITYPE = = "" | | DSEDITYPE = = "0" )
{
//如无或值为默认0则继续使用邮件方式
if ( error = = "" )
{
var path = Server . MapPath ( "../../EDIFiles/CustomEdi" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
var result = new DBResult ( ) ;
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='大简云舱单'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
//制作发送的列表
result = MsOpSeaeEdiDAL . CreateCustomList ( headList , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , path , Convert . ToString ( Session [ "COMPANYNAME" ] ) , dcarrier , iscvessel , ftpset , remarks , coscotype ) ;
//增加费用
if ( result . Success )
MakeFee ( headList , dcarrier , filetype , Convert . ToString ( Session [ "USERID" ] ) , false , 0 , coscotype ) ;
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message , Data = result . Data } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
else
{
var result = new DBResult ( ) ;
result . Success = false ;
result . Message = error ;
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
}
else
{ //否则改为用舱单平台
var result = new DBResult ( ) ;
//制作发送的列表
result = MsOpSeaeEdiDAL . SendPingTaiCustomList ( headList , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , dcarrier , remarks , filetype ) ;
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message , Data = result . Data } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
}
/// <summary>
/// 用于给对应业务增加费用
/// bsnos
/// </summary>
/// <param name="bsnos">业务编号 逗号隔开的文本</param>
/// <param name="filetype">修改类型 B:新增 E:修改 D:删除</param>
public static void MakeFee ( List < MsOpSeae > headlist , string dcarrier , string filetype , string USERID , bool isfen = false , int billcount = 0 , string coscotype = "" )
{
var 已 发 单 号 list = new List < string > ( ) ;
var cdc = new CommonDataContext ( ) ;
//var 船公司价格表 = cdc.tSysEnumValue.Where(x => x.EnumTypeID == 80003).ToList();
var pricehelper = new 船 公 司 舱 单 价 格 helper ( ) ;
foreach ( var item in headlist )
{
var 单 号 = item . MBLNO ;
if ( ! string . IsNullOrWhiteSpace ( item . HBLNO ) ) 单 号 = item . HBLNO ;
if ( 已 发 单 号 list . Exists ( x = > x = = 单 号 ) )
{
continue ;
}
else
{
已 发 单 号 list . Add ( 单 号 ) ;
}
var amount = pricehelper . getPrice ( dcarrier , filetype , item . PORTLOAD , isfen , coscotype ) ;
//var amount = 0M;
//if (filetype == "B")
//{
// amount = 35M;
//}
//if (filetype == "E")
//{
// amount = 10M;
//}
//if (filetype == "D")
//{
// amount = 0M;
//}
//var USERID = USERID;//Convert.ToString(Session["USERID"]);
var enter = MsOpSeaeDAL . getUserId ( " SHOWNAME='自动化'" , "" ) ;
var 单 量 = 1 ;
if ( isfen )
{
//var 分单列表 = MsOpSeaeDAL.GetManifestList($" BSNO='{item.BSNO}' ");
//var 分单号list = 分单列表.Select(s => s.MBLNO).Distinct().ToList();
//单量 = 分单号list.Count();
单 量 = billcount ;
}
var cangdaninfo = new CangDanPriceParam ( ) ;
if ( ! item . FEESTATUS )
MsChFeeDAL . MakeNewFee ( enter , item . BSNO , cangdaninfo . DJYName , "船代" , 2 , "舱单费" , amount * 单 量 , "单票" , 单 量 ) ;
}
}
class 船 公 司 舱 单 价 格 helper
{
public List < SysEnumValue > DetailList { get ; set ; }
private string carrier { get ; set ; }
private string filetype { get ; set ; }
private bool isfen { get ; set ; } = false ;
public 船 公 司 舱 单 价 格 helper ( )
{
//var cdc = new CommonDataContext();
DetailList = PubSysDAL . GetEnumValueList ( 81003 , "" ) ;
}
public decimal getPrice ( string carrier , string filetype , string portload , bool isfen = false , string coscotype = "" )
{
var result = 0 M ;
try
{
//Zi.LAN.CARRIER = "Carrier"; //"船公司";
//Zi.LAN.CARRIER_COSU = "COSCO";
//Zi.LAN.CARRIER_HaiFeng = "SITC";
//Zi.LAN.CARRIER_HuaGang = "华港";
//Zi.LAN.CARRIER_LianDai = "联代";
//Zi.LAN.CARRIER_PX = "鹏信";
//Zi.LAN.CARRIER_DongSheng = "东胜";
//Zi.LAN.CARRIER_WaiDai = "外代";
//Zi.LAN.CARRIER_WaiYun = "外运";
//Zi.LAN.CARRIER_ZC = "正常";
//Zi.LAN.CARRIER_ZhenHua = "振华";
//Zi.LAN.CARRIER_ZhongChuang = "中创";
//Zi.LAN.CARRIER_ZhongHaiQinggang = "中海(青港)";
//Zi.LAN.CARRIER_ZhongHai = "中海";
//Zi.LAN.CARRIER_ZhongTong = "中通";
//Zi.LAN.CARRIER_ZhongYuan = "中远";
var _d = DetailList . Find ( x = > x . EnumValueId = = "其他" ) ;
// DetailList.First(x => x.EnumValueID == "其他");
if ( portload . ToUpper ( ) . IndexOf ( "SHANGHAI" ) > 0 ) {
_d = DetailList . Find ( x = > x . EnumValueId = = "上海" ) ;
}
if ( DetailList . Exists ( x = > x . EnumValueId = = carrier ) )
{
_d = DetailList . Find ( x = > x . EnumValueId = = carrier ) ;
}
if ( ! string . IsNullOrEmpty ( coscotype ) ) {
_d = DetailList . Find ( x = > x . EnumValueId = = coscotype ) ;
}
if ( _d = = null ) return result ;
var priceList = _d . EnumValueName . Split ( ',' ) . ToList ( ) ;
if ( isfen )
{
priceList = _d . EnumValueName_2 . Split ( ',' ) . ToList ( ) ;
}
var amount = "0" ;
if ( filetype = = "B" )
{
amount = priceList [ 0 ] ;
}
if ( filetype = = "E" )
{
amount = priceList [ 1 ] ;
}
if ( filetype = = "D" )
{
amount = priceList [ 2 ] ;
}
result = Convert . ToDecimal ( amount ) ;
}
catch ( Exception ex )
{
}
return result ;
}
}
private class CangDanPriceParam
{
public decimal Price1 { get ; set ; } = 35 M ;
public decimal Price2 { get ; set ; } = 10 M ;
public decimal Price3 { get ; set ; } = 0 M ;
public string DJYName { get ; set ; } = "大简云" ;
public bool NeedYingFu { get ; set ; } = false ;
public decimal Price4 { get ; set ; } = 35 M ;
public decimal Price5 { get ; set ; } = 10 M ;
public decimal Price6 { get ; set ; } = 0 M ;
public decimal FenPrice1 { get ; set ; } = 35 M ;
public decimal FenPrice2 { get ; set ; } = 10 M ;
public decimal FenPrice3 { get ; set ; } = 0 M ;
public CangDanPriceParam ( )
{
var paramvalue = MsSysParamSetDAL . GetSysParamValue ( "CangDanPrice" ) ;
var paramvalueList = paramvalue . Split ( ',' ) ;
Price1 = Convert . ToDecimal ( paramvalueList [ 0 ] ) ;
Price2 = Convert . ToDecimal ( paramvalueList [ 1 ] ) ;
Price3 = Convert . ToDecimal ( paramvalueList [ 2 ] ) ;
DJYName = paramvalueList [ 3 ] ;
NeedYingFu = paramvalueList [ 4 ] = = "产生应收(是)" ? true : false ;
Price4 = Convert . ToDecimal ( paramvalueList [ 5 ] ) ;
Price5 = Convert . ToDecimal ( paramvalueList [ 6 ] ) ;
Price6 = Convert . ToDecimal ( paramvalueList [ 7 ] ) ;
FenPrice1 = Convert . ToDecimal ( paramvalueList [ 8 ] ) ;
FenPrice2 = Convert . ToDecimal ( paramvalueList [ 9 ] ) ;
FenPrice3 = Convert . ToDecimal ( paramvalueList [ 10 ] ) ;
}
public CangDanPriceParam ( string paramvalue )
{
}
}
/// <summary>
/// 直发舱单EDI_提单信息
/// </summary>
/// <param name="bsnos"></param>
/// <param name="dcarrier"></param>
/// <param name="iscvessel"></param>
/// <param name="remarks"></param>
/// <returns></returns>
public ContentResult CustomBillEdiMail ( string bsnos , string dcarrier , int iscvessel , string remarks )
{
bsnos = bsnos . Replace ( "," , "','" ) ;
var headList = MsOpSeaeDAL . GetBillList ( "AS_ID IN ('" + bsnos + "')" ) ;
var path = Server . MapPath ( "../../EDIFiles/CustomEdi" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
var result = new DBResult ( ) ;
if ( headList = = null & & headList . Count = = 0 ) {
var jsonRespose = new JsonResponse { Success = false , Message = "没有要生成的业务!" } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
//读取系统参数DSEDITYPE 如无或值为默认0则继续使用邮件方式, 否则改为用舱单平台
var DSEDITYPE = MsSysParamSetDAL . GetData ( "PARAMNAME='DSEDITYPE'" ) . PARAMVALUE ;
var bs = DSWeb . MvcShipping . DAL . MsOpSeaeDAL . MsOpSeaeDAL . GetData ( "BSNO='" + headList [ 0 ] . BSNO + "'" ) ;
if ( DSEDITYPE = = "" | | DSEDITYPE = = "0" )
{
//如无或值为默认0则继续使用邮件方式
var error = MsOpSeaeEdiDAL . IsCreateCustomBillEdiDs ( bs , headList ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME=''" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
result = MsOpSeaeEdiDAL . CreateCustomListBill ( bs , headList , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , path , Convert . ToString ( Session [ "COMPANYNAME" ] ) , dcarrier , iscvessel , ftpset , remarks ) ;
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message , Data = result . Data } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
else
{
result . Success = false ;
result . Message = error ;
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
}
else
{ //否则改为用舱单平台
//制作发送的列表
result = MsOpSeaeEdiDAL . SendPingTaiCustomListBill ( bs , headList , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , dcarrier , iscvessel , remarks ) ;
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message , Data = result . Data } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
}
# endregion
#region 导出舱单( 不同船代的EDI格式)
public ContentResult onExportManifest ( string bsnos , int FILEROLE )
{
bsnos = bsnos . Replace ( "," , "','" ) ;
var result = new DBResult ( ) ;
var headList = MsOpSeaeDAL . GetFenList ( "BSNO IN ('" + bsnos + "')" , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( headList = = null ) {
result . Success = false ;
result . Message = "没有要发送的数据!" ;
var jsonRespose2 = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
var path = Server . MapPath ( "../../EDIFiles/ExportManifest" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
/ /
var dcarrier = headList [ 0 ] . SHIPAGENCY . ToString ( ) ;
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='导出船代舱单'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( ftpset . SERVERIP = = "" | | ftpset . SERVERIP = = null )
{
result . Success = false ;
result . Message = "请先设置EDI参数!" ;
}
MsOpSeaeEdiDAL . CreateExportManifestSFT ( headList ) ;
/ /
var error = MsOpSeaeEdiDAL . IsCreateExportManifest ( headList , ftpset , false ) ;
if ( error = = "" )
{
if ( dcarrier . IndexOf ( "外代" ) > - 1 | | dcarrier . IndexOf ( "联代" ) > - 1 | | dcarrier . IndexOf ( "外运" ) > - 1 )
{
var filename = "" ;
filename = MsOpSeaeEdiDAL . CreateExportManifestList ( headList , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , path , Convert . ToString ( Session [ "COMPANYNAME" ] ) , dcarrier , FILEROLE , ftpset ) ;
if ( filename ! = "" )
{
filename = Path . GetFileName ( filename ) ;
result . Data = "../../EDIFiles/ExportManifest/" + filename ;
result . Success = true ;
result . Message = filename ;
}
else
{
result . Success = false ;
result . Message = "无当前船代匹配的导出文件,<br />现有船代(外代、外运、联代、华港、中创、中远、海丰、振华、中通、青港物流)!" ;
}
} else if ( dcarrier . IndexOf ( "振华" ) > - 1 ) {
var templatepath = Server . MapPath ( "../../EDIFiles" ) ;
result = MsOpSeaeEdiDAL . SaveZhenHuaExcel ( headList [ 0 ] , path , templatepath ) ;
}
else if ( dcarrier . IndexOf ( "中创" ) > - 1 | | dcarrier . IndexOf ( "青港物流" ) > - 1 | | dcarrier . IndexOf ( "海丰" ) > - 1 )
{
result . Data = dcarrier ;
result . Success = true ;
result . Message = "" ;
}
else
{
result . Success = false ;
result . Message = "无当前船代匹配的导出文件,<br />现有船代(外代、外运、联代、振华、中创、海丰、青港物流)!" ; //、华港、中通、中远
}
}
else
{
result . Success = false ;
result . Message = error ;
}
/ /
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message , Data = result . Data } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
# endregion
#region 导出分票舱单EDI( XML格式) , 海关一点通
public ContentResult onExportXmlManifest ( string sBSNO , string strGIDs , int FILEROLE )
{
strGIDs = strGIDs . Replace ( "," , "','" ) ;
List < MsOpSeae > headList = MsOpSeaeDAL . GetFenList ( "bsno='" + sBSNO + "'" , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
List < MsOpSeaeManifest > billList = MsOpSeaeDAL . GetManifestSumList ( "GID IN ('" + strGIDs + "')" ) ;
var path = Server . MapPath ( "../../EDIFiles/ExportXmlManifest" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
/ /
var result = new DBResult ( ) ;
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='HGYDT'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( ftpset . SERVERIP = = "" | | ftpset . SERVERIP = = null )
{
result . Success = false ;
result . Message = "请先设置EDI参数!" ;
}
/ /
var error = MsOpSeaeEdiDAL . IsCreateExportManifest ( headList , ftpset , false ) ;
var billmsum = MsOpSeaeDAL . GetManifestBsNoSumList ( "BSNO='" + headList [ 0 ] . BSNO + "'" ) ;
if ( Convert . ToDecimal ( headList [ 0 ] . PKGS ) ! = billmsum [ 0 ] . PKGS )
{
error = error + "<br /> 分票件数合计:" + billmsum [ 0 ] . PKGS + " 与件数:" + headList [ 0 ] . PKGS + ",不一致。" ;
}
if ( Convert . ToDecimal ( headList [ 0 ] . KGS ) ! = billmsum [ 0 ] . KGS )
{
error = error + " <br />分票毛重合计:" + billmsum [ 0 ] . KGS + " 与毛重:" + headList [ 0 ] . KGS + ",不一致。" ;
}
//if (Convert.ToDecimal(headList[0].CBM) != billmsum[0].CBM)
//{
// error = error + " <br />分票体积合计:" + billmsum[0].CBM + " 与体积:" + headList[0].CBM + ",不一致。";
//}
if ( error = = "" )
{
var filename = "" ;
filename = MsOpSeaeEdiDAL . CreateExportXmlManifestList ( headList , billList , FILEROLE , ftpset , path ) ;
if ( filename ! = "" )
{
filename = Path . GetFileName ( filename ) ;
result . Data = "../../EDIFiles/ExportXmlManifest/" + filename ;
result . Success = true ;
result . Message = filename ;
}
else
{
result . Success = false ;
result . Message = "无当前匹配的导出文件!" ;
}
}
else
{
result . Success = false ;
result . Message = error ;
}
/ /
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message , Data = result . Data } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
# endregion
#region 直发舱单_分单
public ContentResult CustomBillEdiMail_HBLNO ( string bsnos , string dcarrier , int iscvessel , string remarks , string strGIDs , string filetype = "" , string coscotype = "" )
{
//bsnos = bsnos.Replace(",", "','");
strGIDs = strGIDs . Replace ( "," , "','" ) ;
List < MsOpSeae > headList = MsOpSeaeDAL . GetFenList ( "bsno='" + bsnos + "'" , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
List < MsOpSeaeManifest > billList = MsOpSeaeDAL . GetManifestSumList ( "GID IN ('" + strGIDs + "')" ) ;
//var headList = MsOpSeaeDAL.GetBillList("AS_ID IN ('" + bsnos + "')");
var path = Server . MapPath ( "../../EDIFiles/CustomEdi" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
var result = new DBResult ( ) ;
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME=''" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
result = MsOpSeaeEdiDAL . CreateCustomListBill_HBLNO ( headList , billList , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , path , Convert . ToString ( Session [ "COMPANYNAME" ] ) , dcarrier , iscvessel , ftpset , remarks , filetype , coscotype ) ;
BasicDataRefDAL . SaveLog ( JsonConvert . Serialize ( result ) , "" , "直发舱单_分单" , "结果" ) ;
//增加费用
if ( result . Success )
MakeFee ( headList , dcarrier , filetype , Convert . ToString ( Session [ "USERID" ] ) , true , billList . Count , coscotype ) ;
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message , Data = result . Data } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
# endregion
# endregion
/ /
public ContentResult CheckCangDanIsSend ( string bsno )
{
var rst = MsOpSeaeEdiDAL . CheckCangDanIsSend ( bsno ) ;
if ( rst )
{
var jsonRespose = new JsonResponse { Success = true , Message = "" } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
else
{
var jsonRespose = new JsonResponse { Success = false , Message = "" } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
}
}
}