@ -4063,6 +4063,247 @@ namespace DSWeb.MvcShipping.Controllers
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
# endregion
#region 乐域导出, 类似于INTTR导出
public ContentResult CreateLeYuList ( string bsnos , string mblno , string filetype , string filerole , int isbill , string carrier , int IsNADFW , string tbNADFWID , string tbNADFW )
{
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 , "INTTRAVGM" , filetype , filerole , "" , "" , "" , "" , "" ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='INTTRAVGM'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ; // AND CARRIERID='" + carrier + "'
var filename = "" ;
filename = MsOpSeaeEdiPortDAL . CreateVGM ( headList , CookieConfig . GetCookie_UserId ( Request ) , path , mblno , filerole , ftpset , "INTTRAVGM" , isbill , 0 , carrier , "" , "" , filetype , "" , "" , "" , "" , "" ) ;
if ( ftpset . SERVERIP ! = "" & & ftpset . SERVERIP ! = null )
{
result = MsOpSeaeEdiPortDAL . FtpFile ( filename , ftpset ) ;
var afilename = Path . GetFileName ( filename ) ;
MsOpSeaeEdiPortDAL . InsertEdiLog ( bsnos , "INTTRAVGM" , 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 . IsCreateLeYu ( headList , filetype , filerole , isbill , carrier , IsNADFW , tbNADFWID , tbNADFW ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='INTTR' AND CARRIERID='" + carrier + "'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( ftpset . SENDCODE = = "" ) ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='INTTR'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var filename = "" ;
foreach ( var headdata in headList )
{
var ediheadlist = new List < MsOpSeae > ( ) ;
ediheadlist . Add ( headdata ) ;
if ( filetype = = "E" )
filename = MsOpSeaeEdiPortDAL . CreateEdiLeYuSI ( ediheadlist , CookieConfig . GetCookie_UserId ( Request ) , path , mblno , filerole , ftpset , isbill , carrier , filetype ) ;
else
filename = MsOpSeaeEdiPortDAL . CreateEdiLeYu ( ediheadlist , CookieConfig . GetCookie_UserId ( Request ) , path , mblno , filerole , ftpset , isbill , carrier , filetype , IsNADFW , tbNADFWID , tbNADFW ) ;
if ( filetype = = "E" & & ( ftpset . SERVERIP2 ! = "" & & ftpset . FOLDERNAME2 ! = "" ) )
{
result = MsOpSeaeEdiPortDAL . FtpFile2 ( filename , ftpset ) ;
var afilename = Path . GetFileName ( filename ) ;
MsOpSeaeEdiPortDAL . InsertEdiLog ( bsnos , "INTTR" , 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 ediheadlist )
{
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 if ( ftpset . SERVERIP ! = "" & & ftpset . SERVERIP ! = null )
{
result = MsOpSeaeEdiPortDAL . FtpFile ( filename , ftpset ) ;
var afilename = Path . GetFileName ( filename ) ;
MsOpSeaeEdiPortDAL . InsertEdiLog ( bsnos , "INTTR" , 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 ediheadlist )
{
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
}
if ( result . Success )
{
string uname = CookieConfig . GetCookie_UserName ( Request ) ;
if ( filetype = = "B" )
{
MsOpStatusNewDAL dal = new MsOpStatusNewDAL ( ) ;
dal . UpdateMainStatus ( bsnos , 2 , uname ) ;
}
else if ( filetype = = "E" )
{
MsOpStatusNewDAL dal = new MsOpStatusNewDAL ( ) ;
dal . UpdateMainStatus ( bsnos , 4 , uname ) ;
}
MsOpSeaeEdiPortDAL . SendToDJY ( headList , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult SaveLeYuList ( string bsnos , string mblno , string filetype , string filerole , int isbill , string carrier , int IsNADFW , string tbNADFWID , string tbNADFW )
{
bsnos = bsnos . Replace ( "," , "','" ) ;
#region 点击保存EDI保存状态
string uname = CookieConfig . GetCookie_UserName ( Request ) ;
if ( filetype = = "B" )
{
MsOpStatusNewDAL dal = new MsOpStatusNewDAL ( ) ;
dal . UpdateMainStatus ( bsnos , 2 , uname ) ;
}
else if ( filetype = = "E" )
{
MsOpStatusNewDAL dal = new MsOpStatusNewDAL ( ) ;
dal . UpdateMainStatus ( bsnos , 4 , uname ) ;
}
# endregion
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 , "INTTRAVGM" , filetype , filerole , "" , "" , "" , "" , "" ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='INTTRAVGM'" , 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 , CookieConfig . GetCookie_UserId ( Request ) , path , mblno , filerole , ftpset , "INTTRAVGM" , 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 . IsCreateINTTR ( headList , filetype , filerole , isbill , carrier , IsNADFW , tbNADFWID , tbNADFW ) ;
if ( error = = "" )
{
var ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='INTTR' AND CARRIERID='" + carrier + "'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( ftpset . SENDCODE = = "" ) ftpset = MsCodeFtpSetDAL . GetData ( "EDINAME='INTTR'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var filename = "" ;
if ( filetype = = "E" )
filename = MsOpSeaeEdiPortDAL . CreateEdiINTTRSI ( headList , CookieConfig . GetCookie_UserId ( Request ) , path , mblno , filerole , ftpset , isbill , carrier , filetype ) ;
else
filename = MsOpSeaeEdiPortDAL . CreateEdiINTTR ( headList , CookieConfig . GetCookie_UserId ( Request ) , path , mblno , filerole , ftpset , isbill , carrier , filetype , IsNADFW , tbNADFWID , tbNADFW ) ;
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