@ -122,7 +122,26 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaePreDAL
}
}
return new MsOpSeaePre ( ) ;
return new MsOpSeaePre ( ) ;
}
}
static public MsOpSeaePre GetData ( string condition , Database db , DbTransaction tran )
{
String strSql = "SELECT [BSNO],[MASTERNO],[CUSTOMERNAME],[MBLNO],[CONTRACTNO],[VESSEL],[VOYNO],[ETD],[CLOSINGDATE],[CLOSEDOCDATE],[ETA]"
+ ",CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR"
+ ",(select top 1 showname from [user] where GID=op_seae_pre.CREATEUSER) as CREATEUSER,(select top 1 showname from [user] where GID=op_seae_pre.MODIFIEDUSER) as MODIFIEDUSER"
+ ",[PORTLOADID],[PORTLOAD],[PORTDISCHARGEID],[PORTDISCHARGE],[LANE],[CARRIER],[FORWARDER],[BSSTATUS],[CNTRTOTAL],[OP],[REMARK],[CREATEUSER],[CREATETIME],[MODIFIEDUSER],[MODIFIEDTIME] "
+ ",CASE WHEN len(PORTDISCHARGEID)<>5 THEN '' ELSE (select top 1 c_country_name from t_sys_country_code where c_country_code=LEFT(PORTDISCHARGEID,2)) END as COUNTRY "
+ ",ORDERNO,CUSTSERVICE,HSCODE,GOODSNAME,SALEDEPT,ISUP,ISORDER,ORDNO,TEU,KGS,COST,SELL FROM op_seae_pre" ;
if ( ! string . IsNullOrEmpty ( condition ) )
{
strSql + = " where " + condition ;
}
var list = SetData ( strSql , db , tran ) ;
if ( list . Count > 0 )
{
return list [ 0 ] ;
}
return new MsOpSeaePre ( ) ;
}
static public List < MsOpSeaePre > GetHisDataList ( string strCondition , string userid , string usercode , string companyid , string sort = null )
static public List < MsOpSeaePre > GetHisDataList ( string strCondition , string userid , string usercode , string companyid , string sort = null )
{
{
@ -314,7 +333,104 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaePreDAL
return headList ;
return headList ;
}
}
private static List < MsOpSeaePre > SetData ( String strSql , Database db , DbTransaction tran )
{
var headList = new List < MsOpSeaePre > ( ) ;
using ( IDataReader reader = db . ExecuteReader ( tran , CommandType . Text , strSql . ToString ( ) ) )
{
while ( reader . Read ( ) )
{
MsOpSeaePre data = new MsOpSeaePre ( ) ;
#region Set DB data to Object
data . BSNO = Convert . ToString ( reader [ "BSNO" ] ) ;
data . MASTERNO = Convert . ToString ( reader [ "MASTERNO" ] ) ;
data . CUSTOMERNAME = Convert . ToString ( reader [ "CUSTOMERNAME" ] ) ;
data . MBLNO = Convert . ToString ( reader [ "MBLNO" ] ) ;
data . CONTRACTNO = Convert . ToString ( reader [ "CONTRACTNO" ] ) ;
data . CUSTOMERNAME = Convert . ToString ( reader [ "CUSTOMERNAME" ] ) ;
data . VESSEL = Convert . ToString ( reader [ "VESSEL" ] ) ;
data . VOYNO = Convert . ToString ( reader [ "VOYNO" ] ) ;
if ( reader [ "ETD" ] ! = DBNull . Value )
data . ETD = Convert . ToDateTime ( reader [ "ETD" ] ) . ToString ( "yyyy-MM-dd" ) ;
data . PORTLOAD = Convert . ToString ( reader [ "PORTLOAD" ] ) ;
data . PORTDISCHARGE = Convert . ToString ( reader [ "PORTDISCHARGE" ] ) ;
data . PORTLOADID = Convert . ToString ( reader [ "PORTLOADID" ] ) ;
data . PORTDISCHARGEID = Convert . ToString ( reader [ "PORTDISCHARGEID" ] ) ;
data . LANE = Convert . ToString ( reader [ "LANE" ] ) ;
data . CARRIER = Convert . ToString ( reader [ "CARRIER" ] ) ;
data . FORWARDER = Convert . ToString ( reader [ "FORWARDER" ] ) ;
data . BSSTATUS = Convert . ToString ( reader [ "BSSTATUS" ] ) ;
data . CNTRTOTAL = Convert . ToString ( reader [ "CNTRTOTAL" ] ) ;
data . COUNTRY = Convert . ToString ( reader [ "COUNTRY" ] ) ;
data . OP = Convert . ToString ( reader [ "OP" ] ) ;
data . REMARK = Convert . ToString ( reader [ "REMARK" ] ) ;
data . CREATEUSER = Convert . ToString ( reader [ "CREATEUSER" ] ) ;
if ( reader [ "CREATETIME" ] ! = DBNull . Value )
data . CREATETIME = Convert . ToDateTime ( reader [ "CREATETIME" ] ) ;
data . MODIFIEDUSER = Convert . ToString ( reader [ "MODIFIEDUSER" ] ) ;
if ( reader [ "MODIFIEDTIME" ] ! = DBNull . Value )
data . MODIFIEDTIME = Convert . ToDateTime ( reader [ "MODIFIEDTIME" ] ) ;
if ( reader [ "CLOSINGDATE" ] ! = DBNull . Value )
data . CLOSINGDATE = Convert . ToDateTime ( reader [ "CLOSINGDATE" ] ) . ToString ( "yyyy-MM-dd HH:mm:ss" ) ; //截港日期
if ( reader [ "CLOSEDOCDATE" ] ! = DBNull . Value )
data . CLOSEDOCDATE = Convert . ToDateTime ( reader [ "CLOSEDOCDATE" ] ) . ToString ( "yyyy-MM-dd HH:mm:ss" ) ; //截港日期
if ( reader [ "CNTR1" ] ! = DBNull . Value )
data . CNTR1 = Convert . ToInt32 ( reader [ "CNTR1" ] ) ; //箱型1
if ( reader [ "CNTR2" ] ! = DBNull . Value )
data . CNTR2 = Convert . ToInt32 ( reader [ "CNTR2" ] ) ; //箱型2
if ( reader [ "CNTR3" ] ! = DBNull . Value )
data . CNTR3 = Convert . ToInt32 ( reader [ "CNTR3" ] ) ; //箱型3
if ( reader [ "CNTR4" ] ! = DBNull . Value )
data . CNTR4 = Convert . ToInt32 ( reader [ "CNTR4" ] ) ; //箱型4
if ( reader [ "CNTR5" ] ! = DBNull . Value )
data . CNTR5 = Convert . ToInt32 ( reader [ "CNTR5" ] ) ; //箱型5
if ( reader [ "CNTR6" ] ! = DBNull . Value )
data . CNTR6 = Convert . ToInt32 ( reader [ "CNTR6" ] ) ; //箱型6
if ( reader [ "CNTR7" ] ! = DBNull . Value )
data . CNTR7 = Convert . ToInt32 ( reader [ "CNTR7" ] ) ; //箱型7
if ( reader [ "CNTR8" ] ! = DBNull . Value )
data . CNTR8 = Convert . ToInt32 ( reader [ "CNTR8" ] ) ; //箱型8
if ( reader [ "CNTR9" ] ! = DBNull . Value )
data . CNTR9 = Convert . ToInt32 ( reader [ "CNTR9" ] ) ; //箱型9
if ( reader [ "CNTR10" ] ! = DBNull . Value )
data . CNTR10 = Convert . ToInt32 ( reader [ "CNTR10" ] ) ; //箱型10
if ( reader [ "OTCNTR" ] ! = DBNull . Value )
data . OTCNTR = Convert . ToInt32 ( reader [ "OTCNTR" ] ) ; //其他箱型
if ( ! string . IsNullOrEmpty ( data . ETD ) & & ( data . BSSTATUS = = "船公司已放舱未使用" ) )
{
if ( ( Convert . ToDateTime ( DateTime . Now . ToString ( "yyyy-MM-dd" ) ) . AddDays ( 2 ) ) > = ( Convert . ToDateTime ( data . ETD ) ) )
{
data . LISTSTATUS = "1" ;
}
}
else data . LISTSTATUS = "0" ;
//if (reader["BSLOCK"] != DBNull.Value)
// data.BSLOCK = Convert.ToBoolean(reader["BSLOCK"]);
if ( reader [ "ISUP" ] ! = DBNull . Value )
data . ISUP = Convert . ToBoolean ( reader [ "ISUP" ] ) ;
if ( reader [ "ISORDER" ] ! = DBNull . Value )
data . ISORDER = Convert . ToBoolean ( reader [ "ISORDER" ] ) ;
data . ORDERNO = Convert . ToString ( reader [ "ORDERNO" ] ) ;
data . CUSTSERVICE = Convert . ToString ( reader [ "CUSTSERVICE" ] ) ;
data . HSCODE = Convert . ToString ( reader [ "HSCODE" ] ) ;
data . GOODSNAME = Convert . ToString ( reader [ "GOODSNAME" ] ) ;
data . SALEDEPT = Convert . ToString ( reader [ "SALEDEPT" ] ) ;
data . ORDNO = Convert . ToString ( reader [ "ORDNO" ] ) ;
if ( reader [ "TEU" ] ! = DBNull . Value )
data . TEU = Convert . ToInt32 ( reader [ "TEU" ] ) ; //其他箱型
if ( reader [ "KGS" ] ! = DBNull . Value )
data . KGS = Convert . ToDecimal ( reader [ "KGS" ] ) ; //其他箱型
data . COST = Convert . ToString ( reader [ "COST" ] ) ;
data . SELL = Convert . ToString ( reader [ "SELL" ] ) ;
# endregion
headList . Add ( data ) ;
}
reader . Close ( ) ;
}
return headList ;
}
# endregion
# endregion
#region 批量修改
#region 批量修改