@ -4275,176 +4275,6 @@ namespace DSWeb.MvcShipping.Controllers
}
}
# endregion
# endregion
#region 马士基MAERSK导出
public ContentResult CreateMAERSKList ( string bsnos , string mblno , string filetype , string filerole , int isbill , string carrier )
{
bsnos = bsnos . Replace ( "," , "','" ) ;
var headList = MsOpSeaeDAL . GetDataList ( "BSNO IN ('" + bsnos + "')" , CookieConfig . GetCookie_UserId ( Request ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var path = Server . MapPath ( "../../EDIFiles/SeaeEdi" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
var result = new DBResult ( ) ;
if ( filetype = = "V" )
{
#region VGM
var error = MsOpSeaeEdiPortDAL . IsCreateVGM ( headList , "MAERSKVGM" , filetype , filerole , "" , "" , "" , "" , "" ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='MAERSKVGM' and CARRIERID='" + carrier + "'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ; // AND CARRIERID='" + carrier + "'
var filename = "" ;
filename = MsOpSeaeEdiPortDAL . CreateVGM ( headList , Convert . ToString ( Session [ "USERCODE" ] ) , path , mblno , filerole , ftpset , "MAERSKVGM" , isbill , 0 , carrier , "" , "" , filetype , "" , "" , "" , "" , "" ) ;
if ( ftpset . SERVERIP ! = "" & & ftpset . SERVERIP ! = null )
{
result = MsOpSeaeEdiPortDAL . FtpFile ( filename , ftpset ) ;
var afilename = Path . GetFileName ( filename ) ;
MsOpSeaeEdiPortDAL . InsertEdiLog ( bsnos , "MAERSKVGM" , filetype , carrier , ftpset . SERVERIP , afilename , "../../EDIFiles/SeaeEdi/" + afilename , Convert . ToString ( Session [ "SHOWNAME" ] ) ) ;
}
else
{
result . Success = false ;
result . Message = "FTP参数没有设置,请先设置FTP参数!" ;
}
}
else
{
result . Success = false ;
result . Message = error ;
}
# endregion
}
else
{
#region 订舱、确认
var error = MsOpSeaeEdiPortDAL . IsCreateMAERSK ( headList , filetype , filerole , isbill , carrier ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='MAERSK' and CARRIERID='" + carrier + "'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var filename = "" ;
if ( filetype = = "E" )
filename = MsOpSeaeEdiPortDAL . CreateEdiMAERSKSI ( headList , Convert . ToString ( Session [ "USERCODE" ] ) , path , mblno , filerole , ftpset , isbill , carrier , filetype ) ;
else
filename = MsOpSeaeEdiPortDAL . CreateEdiMAERSK ( headList , Convert . ToString ( Session [ "USERCODE" ] ) , path , mblno , filerole , ftpset , isbill , carrier , filetype ) ;
if ( ftpset . SERVERIP ! = "" & & ftpset . SERVERIP ! = null )
{
result = MsOpSeaeEdiPortDAL . FtpFile ( filename , ftpset ) ;
var afilename = Path . GetFileName ( filename ) ;
MsOpSeaeEdiPortDAL . InsertEdiLog ( bsnos , "MAERSK" , filetype , carrier , ftpset . SERVERIP , afilename , "../../EDIFiles/SeaeEdi/" + afilename , Convert . ToString ( Session [ "SHOWNAME" ] ) ) ;
T_ALL_DA T_ALL_DA = new EntityDA . T_ALL_DA ( ) ;
foreach ( var bill in headList )
{
if ( filetype = = "B" )
{
var blUpSQL = " if (select CID from Op_SeaCover where bsno='" + bill . BSNO + "' AND COVERTITLE='发送SO') is null insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + bill . BSNO + "','发送SO','','" + Session [ "SHOWNAME" ] + "','" + DateTime . Now . ToString ( "yyyy-MM-dd HH:mm:ss" ) + "','1')" ;
bool bl = T_ALL_DA . GetExecuteSqlCommand ( blUpSQL ) ;
}
else
{
var blUpSQL = " if (select CID from Op_SeaCover where bsno='" + bill . BSNO + "' AND COVERTITLE='发送SI') is null insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + bill . BSNO + "','发送SI','','" + 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
{
result . Success = false ;
result . Message = error ;
}
# endregion
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult SaveMAERSKList ( string bsnos , string mblno , string filetype , string filerole , int isbill , string carrier )
{
bsnos = bsnos . Replace ( "," , "','" ) ;
var headList = MsOpSeaeDAL . GetDataList ( "BSNO IN ('" + bsnos + "')" , CookieConfig . GetCookie_UserId ( Request ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var path = Server . MapPath ( "../../EDIFiles/SeaeEdi" ) ;
if ( ! Directory . Exists ( path ) )
{
Directory . CreateDirectory ( path ) ;
}
var result = new DBResult ( ) ;
if ( filetype = = "V" )
{
#region VGM
var error = MsOpSeaeEdiPortDAL . IsCreateVGM ( headList , "MAERSKVGM" , filetype , filerole , "" , "" , "" , "" , "" ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='MAERSKVGM' and CARRIERID='" + carrier + "'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ; // AND CARRIERID='" + carrier + "'
if ( ftpset . SENDCODE = = "" | | ftpset . RECEIVECODE = = "" )
{
result . Success = false ;
result . Message = "EDI参数没有设置,请先设置EDI参数!" ;
}
else
{
var filename = "" ;
filename = MsOpSeaeEdiPortDAL . CreateVGM ( headList , Convert . ToString ( Session [ "USERCODE" ] ) , path , mblno , filerole , ftpset , "MAERSKVGM" , isbill , 0 , carrier , "" , "" , filetype , "" , "" , "" , "" , "" ) ;
filename = Path . GetFileName ( filename ) ;
result . Data = "../../EDIFiles/SeaeEdi/" + filename ;
result . Success = true ;
result . Message = filename ;
}
}
else
{
result . Success = false ;
result . Message = error ;
}
# endregion
}
else
{
#region 订舱、确认
var error = MsOpSeaeEdiPortDAL . IsCreateMAERSK ( headList , filetype , filerole , isbill , carrier ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='MAERSK' and CARRIERID='" + carrier + "'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var filename = "" ;
if ( filetype = = "E" )
filename = MsOpSeaeEdiPortDAL . CreateEdiMAERSKSI ( headList , Convert . ToString ( Session [ "USERCODE" ] ) , path , mblno , filerole , ftpset , isbill , carrier , filetype ) ;
else
filename = MsOpSeaeEdiPortDAL . CreateEdiMAERSK ( headList , Convert . ToString ( Session [ "USERCODE" ] ) , path , mblno , filerole , ftpset , isbill , carrier , filetype ) ;
filename = Path . GetFileName ( filename ) ;
result . Data = "../../EDIFiles/SeaeEdi/" + filename ;
result . Success = true ;
result . Message = filename ;
}
else
{
result . Success = false ;
result . Message = error ;
}
# endregion
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message , Data = result . Data } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
# endregion