@ -304,7 +304,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL
return cnt ;
}
static public List < MsOpSeae > GetSaleDataList ( string strCondition , string username , string sort = null , string load = null , string userid = "" , string companyid = "" )
static public List < MsOpSeae > GetSaleDataList ( int start , int limit , string strCondition , string username , string sort = null , string load = null , string userid = "" , string companyid = "" )
{
var rangstr = GetSaleRangDAStr ( "index" , userid , username , companyid ) ;
if ( ! string . IsNullOrEmpty ( rangstr ) )
@ -321,7 +321,46 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL
var strSql = new StringBuilder ( ) ;
strSql . Append ( "SELECT B.BSNO,MASTERNO,ORDERTYPE,ORDTYPE,ORDERNO,BSSTATUS,FEESTATUS,BSDATE,ACCDATE,MBLNO,HBLNO,CUSTNO,APPLYNO,TRANSNO,CUSTOMERNAME,BLTYPE,SHIPPERID," ) ;
strSql . Append ( @"SELECT * from (SELECT row_number() over (" ) ;
var sortstring = DatasetSort . Getsortstring ( sort ) ;
if ( ! string . IsNullOrEmpty ( sortstring ) )
{
if ( sortstring . ToUpper ( ) . IndexOf ( "OPSTATUS" ) > = 0 )
strSql . Append ( " order by " + sortstring . Replace ( "OPSTATUS" , "(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=B.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC)" ) ) ;
else if ( sortstring . ToUpper ( ) . IndexOf ( "DRFEESTATUS" ) > = 0 )
strSql . Append ( " order by " + sortstring . Replace ( "DRFEESTATUS" , " dbo.F_GetBillDrFeeStatus(B.BSNO) " ) ) ;
else if ( sortstring . ToUpper ( ) . IndexOf ( "CRFEESTATUS" ) > = 0 )
strSql . Append ( " order by " + sortstring . Replace ( "CRFEESTATUS" , " dbo.F_GetBillCrFeeStatus(B.BSNO) " ) ) ;
else if ( sortstring . ToUpper ( ) . IndexOf ( "BSSTATUSREF" ) > = 0 )
strSql . Append ( " order by " + sortstring . Replace ( "BSSTATUSREF" , " BSSTATUS " ) ) ;
else if ( sortstring . ToUpper ( ) . IndexOf ( "FEESTATUSREF" ) > = 0 )
strSql . Append ( " order by " + sortstring . Replace ( "FEESTATUSREF" , " FEESTATUS " ) ) ;
else if ( sortstring . ToUpper ( ) . IndexOf ( "AMEND" ) > = 0 )
strSql . Append ( " order by " + sortstring . Replace ( "AMEND" , " CASE WHEN (SELECT COUNT(*) FROM OP_AMEND WHERE PARENTID=B.BSNO)>0 THEN 1 ELSE 0 END " ) ) ;
else if ( sortstring . ToUpper ( ) . IndexOf ( "DRINVSTATUS" ) > = 0 )
strSql . Append ( " order by " + sortstring . Replace ( "DRINVSTATUS" , " CASE WHEN ISNULL(I.TTLINVDR,0)=0 THEN '未开票' ELSE CASE WHEN ISNULL(I.TTLINVDR,0)=ISNULL(I.TTLDR,0) THEN '已开票' ELSE '部分开票' END END " ) ) ;
else if ( sortstring . ToUpper ( ) . IndexOf ( "DRDUISTATUS" ) > = 0 )
strSql . Append ( " order by " + sortstring . Replace ( "DRDUISTATUS" , " CASE WHEN ISNULL(I.TTLDUIDR,0)=0 THEN '未对账' ELSE CASE WHEN ISNULL(I.TTLDUIDR,0)=ISNULL(I.TTLDR,0) THEN '已对账' ELSE '部分对账' END END " ) ) ;
else
{
sortstring = sortstring . Replace ( "SALECORP" , "B.SALECORPID" ) ;
strSql . Append ( " order by " + sortstring ) ;
}
}
else
{
var SeaeDefaultSort = MsSysParamSetDAL . GetData ( "PARAMNAME='SeaeDefaultSort'" ) ;
if ( SeaeDefaultSort . PARAMVALUE ! = "" )
strSql . Append ( " order by " + SeaeDefaultSort . PARAMVALUE ) ;
else
strSql . Append ( " order by BSDATE desc" ) ;
}
strSql . Append ( @") as num , " ) ;
strSql . Append ( " B.BSNO,MASTERNO,ORDERTYPE,ORDTYPE,ORDERNO,BSSTATUS,FEESTATUS,BSDATE,ACCDATE,MBLNO,HBLNO,CUSTNO,APPLYNO,TRANSNO,CUSTOMERNAME,BLTYPE,SHIPPERID," ) ;
strSql . Append ( "CONSIGNEEID,NOTIFYPARTYID,SHIPPER,CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,VESSEL,VOYNO,ETD,CLOSINGDATE,ETA,VESSEL2N,VOYNO2N,VESSELID2N," ) ;
strSql . Append ( "PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,COPYNOBILL," ) ;
@ -341,7 +380,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL
strSql . Append ( ",dbo.F_GetBillCrFeeStatus(B.BSNO) CRFEESTATUS,ISPRINTPR,MAILPROJECT,0 AMENDCOUNT,0 as APPLYCOUNT,ISCANCEL,ISTUI,TRANSREMARK,PRERECORD " ) ;
strSql . Append ( ",SHIPAGENCY" ) ;
strSql . Append ( ",I.TTLDR,I.TTLINVDR,I.TTLDUIDR,I.TTLCR,I.TTLINVCR,I.TTLDUICR,0 YJCR,0 HYFDR,0 HYFCR,0 BGFDR,0 NODAY" ) ;
strSql . Append ( ",'' MSHIPPERID,'' MCONSIGNEEID,'' MNOTIFYPARTYID,'' MSHIPPER,'' MCONSIGNEE,'' MNOTIFYPARTY,null ATD,DELIVERYDATE,YARDATTN,YARDTEL ,'' COUNTRY ") ;
strSql . Append ( ",'' MSHIPPERID,'' MCONSIGNEEID,'' MNOTIFYPARTYID,'' MSHIPPER,'' MCONSIGNEE,'' MNOTIFYPARTY,null ATD,DELIVERYDATE,YARDATTN,YARDTEL ") ; // ,'' COUNTRY
//20161117 邓羽 增加对提单签发状态的查询
strSql . Append ( ",(SELECT TOP 1 BLSTATUS FROM op_blissue WHERE BSNO=B.BSNO) BLISSUESTATUS,B.BillFeeStatus,SALECORPID,'' MDESCRIPTION " ) ;
@ -362,42 +401,10 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL
{
strSql . Append ( " where " + strCondition ) ;
}
strSql . Append ( @")as t " ) ;
strSql . Append ( string . Format ( "where t.num>{0} and t.num<={1} order by t.num " , start , start + limit ) ) ;
/ /
var sortstring = DatasetSort . Getsortstring ( sort ) ;
if ( ! string . IsNullOrEmpty ( sortstring ) )
{
if ( sortstring . ToUpper ( ) . IndexOf ( "OPSTATUS" ) > = 0 )
strSql . Append ( " order by " + sortstring . Replace ( "OPSTATUS" , "(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=B.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC)" ) ) ;
else if ( sortstring . ToUpper ( ) . IndexOf ( "DRFEESTATUS" ) > = 0 )
strSql . Append ( " order by " + sortstring . Replace ( "DRFEESTATUS" , " dbo.F_GetBillDrFeeStatus(B.BSNO) " ) ) ;
else if ( sortstring . ToUpper ( ) . IndexOf ( "CRFEESTATUS" ) > = 0 )
strSql . Append ( " order by " + sortstring . Replace ( "CRFEESTATUS" , " dbo.F_GetBillCrFeeStatus(B.BSNO) " ) ) ;
else if ( sortstring . ToUpper ( ) . IndexOf ( "BSSTATUSREF" ) > = 0 )
strSql . Append ( " order by " + sortstring . Replace ( "BSSTATUSREF" , " BSSTATUS " ) ) ;
else if ( sortstring . ToUpper ( ) . IndexOf ( "FEESTATUSREF" ) > = 0 )
strSql . Append ( " order by " + sortstring . Replace ( "FEESTATUSREF" , " FEESTATUS " ) ) ;
else if ( sortstring . ToUpper ( ) . IndexOf ( "AMEND" ) > = 0 )
strSql . Append ( " order by " + sortstring . Replace ( "AMEND" , " CASE WHEN (SELECT COUNT(*) FROM OP_AMEND WHERE PARENTID=B.BSNO)>0 THEN 1 ELSE 0 END " ) ) ;
else if ( sortstring . ToUpper ( ) . IndexOf ( "DRINVSTATUS" ) > = 0 )
strSql . Append ( " order by " + sortstring . Replace ( "DRINVSTATUS" , " CASE WHEN ISNULL(I.TTLINVDR,0)=0 THEN '未开票' ELSE CASE WHEN ISNULL(I.TTLINVDR,0)=ISNULL(I.TTLDR,0) THEN '已开票' ELSE '部分开票' END END " ) ) ;
else if ( sortstring . ToUpper ( ) . IndexOf ( "DRDUISTATUS" ) > = 0 )
strSql . Append ( " order by " + sortstring . Replace ( "DRDUISTATUS" , " CASE WHEN ISNULL(I.TTLDUIDR,0)=0 THEN '未对账' ELSE CASE WHEN ISNULL(I.TTLDUIDR,0)=ISNULL(I.TTLDR,0) THEN '已对账' ELSE '部分对账' END END " ) ) ;
else
{
sortstring = sortstring . Replace ( "SALECORP" , "B.SALECORPID" ) ;
strSql . Append ( " order by " + sortstring ) ;
}
}
else
{
var SeaeDefaultSort = MsSysParamSetDAL . GetData ( "PARAMNAME='SeaeDefaultSort'" ) ;
if ( SeaeDefaultSort . PARAMVALUE ! = "" )
strSql . Append ( " order by " + SeaeDefaultSort . PARAMVALUE ) ;
else
strSql . Append ( " order by BSDATE desc" ) ;
}
return SetData ( strSql ) ;
}
@ -509,9 +516,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL
}
#region 更改单
static public List < MsOpSeae > GetAmendDataList ( int start , int limit , string strCondition , string userid , string usercode , string companyid , string sort = null , string load = null )
public static int getSaleDataCount ( string strCondition , string userid , string usercode , string companyid )
{
var rangstr = GetRangDAStr ( "index" , userid , usercode , companyid ) ;
if ( ! string . IsNullOrEmpty ( rangstr ) )
@ -525,79 +530,123 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL
strCondition = rangstr ;
}
}
StringBuilder strSql = new StringBuilder ( ) ;
strSql . Append ( "select count(*) " ) ;
strSql . Append ( " from OP_SEAE B" ) ;
strSql . Append ( " LEFT JOIN v_op_gain_dr_INV I ON (I.BSNO=B.BSNO) " ) ;
strSql . Append ( " left join (select bsno, sum(case when[status] = '海关放行' then 1 else 0 end) CUSTOMSSTATUS, sum(case when [status] = '运抵报告' then 1 else 0 end) HGYDSTATUS , sum(case when[status] = '码头放行' then 1 else 0 end) PORTSTATUS" ) ;
strSql . Append ( ", sum(case when[status] = '装船出运' then 1 else 0 end) EXPSTATUS, sum(case when [status] = '空箱出场' then 1 else case when [status] = '部分空出' then 2 else 0 end end) TRUCKCTNSTATUS" ) ;
strSql . Append ( ", sum(case when[status] = '到港' then 1 else 0 end) ATASTATUS, sum(case when [status] = '目的港提箱' then 1 else case when [status] = '部分目的港提箱' then 2 else 0 end end) STCSSTATUS " ) ;
strSql . Append ( ", sum(case when [status] = '目的港返空' then 1 else case when [status] = '部分目的港返空' then 2 else 0 end end) RCVESTATUS " ) ;
strSql . Append ( ", sum(case when[status] = '重箱返场' then 1 else case when [status] = '部分重返' then 2 else 0 end end) CTNRETURNSTATUS from op_status WITH (NOLOCK) GROUP BY BSNO) as v on(v.bsno = B.BSNO) " ) ;
var strSql = new StringBuilder ( ) ;
if ( ! string . IsNullOrEmpty ( strCondition ) )
{
strSql . Append ( " where " + strCondition ) ;
}
int cnt = 0 ;
Database db = DatabaseFactory . CreateDatabase ( ) ;
using ( IDataReader reader = db . ExecuteReader ( CommandType . Text , strSql . ToString ( ) ) )
{
while ( reader . Read ( ) )
{
cnt = Convert . ToInt32 ( reader [ 0 ] ) ;
}
}
return cnt ;
}
strSql . Append ( @"SELECT * from (SELECT row_number() over (" ) ;
var sortstring = DatasetSort . Getsortstring ( sort ) ;
if ( ! string . IsNullOrEmpty ( sortstring ) )
{
sortstring = sortstring . Replace ( "FEESTATUS" , "A.FEESTATUS" ) . Replace ( "TRANSNO" , "A.AMENDNO" ) . Replace ( "EDIREMARK" , "A.REASON" ) . Replace ( "ACCDATE" , "A.ACCDATE" )
. Replace ( "CREATETIME" , "A.CREATETIME" ) . Replace ( "REMARK" , "A.REMARK" ) . Replace ( "MSHIPPERID" , "(select showname from [user] where gid=f.Auditoperator) " ) . Replace ( "MCONSIGNEEID" , "f.AUDITDATE " ) ;
#region 更改单
strSql . Append ( " order by " + sortstring ) ;
}
else
static public List < MsOpSeae > GetAmendDataList ( int start , int limit , string strCondition , string userid , string usercode , string companyid , string sort = null , string load = null )
{
var SeaeDefaultSort = MsSysParamSetDAL . GetData ( "PARAMNAME='SeaeDefaultSort'" ) ;
if ( SeaeDefaultSort . PARAMVALUE ! = "" )
strSql . Append ( " order by " + SeaeDefaultSort . PARAMVALUE ) ;
var rangstr = GetRangDAStr ( "index" , userid , usercode , companyid ) ;
if ( ! string . IsNullOrEmpty ( rangstr ) )
{
if ( ! string . IsNullOrEmpty ( strCondition ) )
{
strCondition = strCondition + " and " + rangstr ;
}
else
{
strCondition = rangstr ;
}
}
var strSql = new StringBuilder ( ) ;
strSql . Append ( @"SELECT * from (SELECT row_number() over (" ) ;
var sortstring = DatasetSort . Getsortstring ( sort ) ;
if ( ! string . IsNullOrEmpty ( sortstring ) )
{
sortstring = sortstring . Replace ( "FEESTATUS" , "A.FEESTATUS" ) . Replace ( "TRANSNO" , "A.AMENDNO" ) . Replace ( "EDIREMARK" , "A.REASON" ) . Replace ( "ACCDATE" , "A.ACCDATE" )
. Replace ( "CREATETIME" , "A.CREATETIME" ) . Replace ( "REMARK" , "A.REMARK" ) . Replace ( "MSHIPPERID" , "(select showname from [user] where gid=f.Auditoperator) " ) . Replace ( "MCONSIGNEEID" , "f.AUDITDATE " ) ;
strSql . Append ( " order by " + sortstring ) ;
}
else
strSql . Append ( " order by BSDATE desc" ) ;
}
strSql . Append ( @") as num , " ) ;
{
var SeaeDefaultSort = MsSysParamSetDAL . GetData ( "PARAMNAME='SeaeDefaultSort'" ) ;
if ( SeaeDefaultSort . PARAMVALUE ! = "" )
strSql . Append ( " order by " + SeaeDefaultSort . PARAMVALUE ) ;
else
strSql . Append ( " order by BSDATE desc" ) ;
}
strSql . Append ( @") as num , " ) ;
strSql . Append ( "A.BSNO,A.PARENTID MASTERNO,B.ORDERTYPE,B.ORDTYPE,B.ORDERNO,BSSTATUS,A.FEESTATUS,BSDATE,A.ACCDATE,MBLNO,HBLNO,APPLYNO,CUSTNO,A.AMENDNO TRANSNO,CUSTOMERNAME,BLTYPE,SHIPPERID," ) ;
strSql . Append ( "CONSIGNEEID,NOTIFYPARTYID,SHIPPER,CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,VESSEL,VOYNO,ETD,CLOSINGDATE,ETA,VESSEL2N,VOYNO2N,VESSELID2N," ) ;
strSql . Append ( "A.BSNO,A.PARENTID MASTERNO,B.ORDERTYPE,B.ORDTYPE,B.ORDERNO,BSSTATUS,A.FEESTATUS,BSDATE,A.ACCDATE,MBLNO,HBLNO,APPLYNO,CUSTNO,A.AMENDNO TRANSNO,CUSTOMERNAME,BLTYPE,SHIPPERID," ) ;
strSql . Append ( "CONSIGNEEID,NOTIFYPARTYID,SHIPPER,CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,VESSEL,VOYNO,ETD,CLOSINGDATE,ETA,VESSEL2N,VOYNO2N,VESSELID2N," ) ;
strSql . Append ( "PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,COPYNOBILL," ) ;
strSql . Append ( "NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,BLFRT,PREPARDAT,PREPARDATID,PAYABLEAT,[SERVICE],MARKS,CNTRSEALNO,NOPKGS,[DESCRIPTION],GOODSNAME," ) ;
strSql . Append ( "GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,KGS,CBM,TOTALNO,CNTRNO,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR," ) ;
strSql . Append ( "TEU,CNTRTOTAL,INPUTBY,OP,CUSTSERVICE,FRCUSTSERVICE,LANE,A.SALE,CARRIER,FORWARDER,CUSTOMSER,TRUCKER,INVNO,CARGOID,DCLASS,DUNNO,DPAGE,DLABEL,LINKMAN," ) ;
strSql . Append ( "REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN,HUMIDITY,BSSOURCE,BSSOURCEDETAIL,CUSTOMSNUM,CONTRACTNO,INSURANCEER,INSURANCENO,INAMOUT,A.ISVOU,A.VOUNO,A.REMARKS REMARK,STATUS1," ) ;
strSql . Append ( "STATUS2,STATUS3,STATUS4,STATUS5,ISFUMIGATION,ISSTORAGE,ISLAND,ISCUSTOMS,ISINSPECTION,ISBOOKING,ISAGENT,ISHBLNO,SERVICE9,SERVICE10,DOC,PACKINGTYPE," ) ;
strSql . Append ( "WAREHOUSE,CLOSEDOCDATE,INTOPORTDATE,CORPID,SALEDEPT,MBLFRT,A.CREATETIME,STLNAME,dbo.trimdate(STLDATE) STLDATE,OPERATORCODE,OPERATOR,OPERATOREMAIL,OPERATORTEL,OPERATORFAX," ) ;
strSql . Append ( "FINANCIALSTAFFCODE,FINANCIALSTAFF,FINANCIALSTAFFEMAIL,FINANCIALSTAFFTEL,FINANCIALSTAFFFAX,PLACERECEIPTID,SOURCECODE,ISCONTAINERSOC,VESSELID,ISSUEPLACEID,HSCODE" ) ;
strSql . Append ( ",TRANSTATUS,A.REASON EDIREMARK,SERVICECONTRACTNO,(CASE BSSTATUS WHEN 1 THEN '锁定' else '未锁定' end) as BSSTATUSREF " ) ;
strSql . Append ( ",(CASE A.FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,TRANSPORT " ) ;
strSql . Append ( ",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=B.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS" ) ;
strSql . Append ( ",'' as MANIFESTSTATUSREF" ) ;
strSql . Append ( ",CUSTOMNO,ENTERPID,ENTERP,INSPECTIONNO,INSPECTIONDATE,CUSTOMDATE,CLEARCUSTOMDATE,ISMOREGOOD,TERMSDELIVERY,INSPECTSERVICE,TRADETERM,0 FENPIAO,B.ISGAIQIAN,B.WARNCOUNT" ) ;
strSql . Append ( "PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,COPYNOBILL," ) ;
strSql . Append ( "NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,BLFRT,PREPARDAT,PREPARDATID,PAYABLEAT,[SERVICE],MARKS,CNTRSEALNO,NOPKGS,[DESCRIPTION],GOODSNAME," ) ;
strSql . Append ( "GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,KGS,CBM,TOTALNO,CNTRNO,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR," ) ;
strSql . Append ( "TEU,CNTRTOTAL,INPUTBY,OP,CUSTSERVICE,FRCUSTSERVICE,LANE,A.SALE,CARRIER,FORWARDER,CUSTOMSER,TRUCKER,INVNO,CARGOID,DCLASS,DUNNO,DPAGE,DLABEL,LINKMAN," ) ;
strSql . Append ( "REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN,HUMIDITY,BSSOURCE,BSSOURCEDETAIL,CUSTOMSNUM,CONTRACTNO,INSURANCEER,INSURANCENO,INAMOUT,A.ISVOU,A.VOUNO,A.REMARKS REMARK,STATUS1," ) ;
strSql . Append ( "STATUS2,STATUS3,STATUS4,STATUS5,ISFUMIGATION,ISSTORAGE,ISLAND,ISCUSTOMS,ISINSPECTION,ISBOOKING,ISAGENT,ISHBLNO,SERVICE9,SERVICE10,DOC,PACKINGTYPE," ) ;
strSql . Append ( "WAREHOUSE,CLOSEDOCDATE,INTOPORTDATE,CORPID,SALEDEPT,MBLFRT,A.CREATETIME,STLNAME,dbo.trimdate(STLDATE) STLDATE,OPERATORCODE,OPERATOR,OPERATOREMAIL,OPERATORTEL,OPERATORFAX," ) ;
strSql . Append ( "FINANCIALSTAFFCODE,FINANCIALSTAFF,FINANCIALSTAFFEMAIL,FINANCIALSTAFFTEL,FINANCIALSTAFFFAX,PLACERECEIPTID,SOURCECODE,ISCONTAINERSOC,VESSELID,ISSUEPLACEID,HSCODE" ) ;
strSql . Append ( ",TRANSTATUS,A.REASON EDIREMARK,SERVICECONTRACTNO,(CASE BSSTATUS WHEN 1 THEN '锁定' else '未锁定' end) as BSSTATUSREF " ) ;
strSql . Append ( ",(CASE A.FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,TRANSPORT " ) ;
strSql . Append ( ",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=B.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS" ) ;
strSql . Append ( ",'' as MANIFESTSTATUSREF" ) ;
strSql . Append ( ",CUSTOMNO,ENTERPID,ENTERP,INSPECTIONNO,INSPECTIONDATE,CUSTOMDATE,CLEARCUSTOMDATE,ISMOREGOOD,TERMSDELIVERY,INSPECTSERVICE,TRADETERM,0 FENPIAO,B.ISGAIQIAN,B.WARNCOUNT" ) ;
strSql . Append ( ",dbo.F_GetBillDrFeeStatus(A.BSNO) DRFEESTATUS" ) ;
strSql . Append ( ",dbo.F_GetBillCrFeeStatus(A.BSNO) CRFEESTATUS,ISPRINTPR,B.MAILPROJECT" ) ;
strSql . Append ( ",dbo.F_GetBillDrFeeStatus(A.BSNO) DRFEESTATUS" ) ;
strSql . Append ( ",dbo.F_GetBillCrFeeStatus(A.BSNO) CRFEESTATUS,ISPRINTPR,B.MAILPROJECT" ) ;
strSql . Append ( ",(SELECT COUNT(*) FROM OP_AMEND WHERE PARENTID=A.PARENTID) as AMENDCOUNT,SHIPAGENCY " ) ;
strSql . Append ( ",I.TTLDR,I.TTLINVDR,I.TTLDUIDR,I.TTLCR,I.TTLINVCR,I.TTLDUICR,0 YJCR,0 HYFDR,0 HYFCR,0 BGFDR,0 NODAY" ) ;
strSql . Append ( ",0 as APPLYCOUNT " ) ;
strSql . Append ( ",(SELECT COUNT(*) FROM OP_AMEND WHERE PARENTID=A.PARENTID) as AMENDCOUNT,SHIPAGENCY " ) ;
strSql . Append ( ",I.TTLDR,I.TTLINVDR,I.TTLDUIDR,I.TTLCR,I.TTLINVCR,I.TTLDUICR,0 YJCR,0 HYFDR,0 HYFCR,0 BGFDR,0 NODAY" ) ;
strSql . Append ( ",0 as APPLYCOUNT " ) ;
strSql . Append ( ",(SELECT TOP 1 BLSTATUS FROM op_blissue WHERE BSNO=B.BSNO) BLISSUESTATUS,ISCANCEL,ISTUI,TRANSREMARK,PRERECORD " ) ;
strSql . Append ( ",(SELECT TOP 1 BLSTATUS FROM op_blissue WHERE BSNO=B.BSNO) BLISSUESTATUS,ISCANCEL,ISTUI,TRANSREMARK,PRERECORD " ) ;
strSql . Append ( ",(select showname from [user] where gid=f.Auditoperator) MSHIPPERID,dbo.trimdate(f.AUDITDATE) MCONSIGNEEID,MNOTIFYPARTYID,MSHIPPER,MCONSIGNEE,MNOTIFYPARTY,ATD,DELIVERYDATE,YARDATTN,YARDTEL,A.BillFeeStatus,B.SALECORPID,'' MDESCRIPTION " ) ;
strSql . Append ( ",(select [NAME] from [company] where GID=B.SALECORPID) as SALECORP" ) ;
strSql . Append ( ",0 CUSTOMSSTATUS,0 PORTSTATUS,0 EXPSTATUS,0 TRUCKCTNSTATUS,0 CTNRETURNSTATUS,0 HGYDSTATUS ,B.TRUCKSTATUS,0 ATASTATUS,0 STCSSTATUS,0 RCVESTATUS,'' COUNTRY,b.ORDEROP" ) ;
strSql . Append ( ",(select showname from [user] where gid=f.Auditoperator) MSHIPPERID,dbo.trimdate(f.AUDITDATE) MCONSIGNEEID,MNOTIFYPARTYID,MSHIPPER,MCONSIGNEE,MNOTIFYPARTY,ATD,DELIVERYDATE,YARDATTN,YARDTEL,A.BillFeeStatus,B.SALECORPID,'' MDESCRIPTION " ) ;
strSql . Append ( ",(select [NAME] from [company] where GID=B.SALECORPID) as SALECORP" ) ;
strSql . Append ( ",0 CUSTOMSSTATUS,0 PORTSTATUS,0 EXPSTATUS,0 TRUCKCTNSTATUS,0 CTNRETURNSTATUS,0 HGYDSTATUS ,B.TRUCKSTATUS,0 ATASTATUS,0 STCSSTATUS,0 RCVESTATUS,'' COUNTRY,b.ORDEROP" ) ;
strSql . Append ( " from OP_AMEND A " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE B ON (B.BSNO=A.PARENTID)" ) ;
strSql . Append ( " LEFT JOIN v_op_gain_dr_INV I ON (I.BSNO=A.BSNO) " ) ;
strSql . Append ( " LEFT JOIN V_FEE_LASTAUDIT f ON (f.BSNO=A.BSNO AND f.NUM=1) " ) ;
strSql . Append ( " from OP_AMEND A " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE B ON (B.BSNO=A.PARENTID)" ) ;
strSql . Append ( " LEFT JOIN v_op_gain_dr_INV I ON (I.BSNO=A.BSNO) " ) ;
strSql . Append ( " LEFT JOIN V_FEE_LASTAUDIT f ON (f.BSNO=A.BSNO AND f.NUM=1) " ) ;
strSql . Append ( " WHERE B.BSNO IS NOT NULL " ) ;
strSql . Append ( " WHERE B.BSNO IS NOT NULL " ) ;
if ( ! string . IsNullOrEmpty ( strCondition ) )
{
strSql . Append ( " AND " + strCondition ) ;
}
if ( ! string . IsNullOrEmpty ( strCondition ) )
{
strSql . Append ( " AND " + strCondition ) ;
}
strSql . Append ( @")as t " ) ;
strSql . Append ( string . Format ( "where t.num>={0} and t.num<={1} order by t.num" , start , start + limit ) ) ; / /
strSql . Append ( @")as t " ) ;
strSql . Append ( string . Format ( "where t.num>={0} and t.num<={1} order by t.num" , start , start + limit ) ) ; / /
return SetData ( strSql ) ;
}
return SetData ( strSql ) ;
}
public static int getAmendTotalCount ( string strCondition , string userid , string usercode , string companyid )
{