@ -1,5 +1,13 @@
using djy.IService.Afr ;
using Common.DJYModel ;
using Common.Extensions ;
using Common.Utilities ;
using djy.IService.Afr ;
using djy.Model.Afr ;
using djy.Model.AFRDto ;
using djy.Model.Ams ;
using djy.Model.AmsDto ;
using djy.Service.DjyService ;
using FreeSql.Internal.Model ;
using System ;
using System.Collections.Generic ;
using System.Linq ;
@ -10,6 +18,225 @@ namespace djy.Service.AFR
{
public class AfrService : DbContext , IAfrService
{
#region 下拉接口
public List < CommonCNEN > GetCountry ( string strlink , int page , int limit )
{
try
{
if ( page = = 0 & & limit = = 0 )
{
var List = DbBus . Get ( DbList . Common ) . Select < CodeCountry > ( ) . ToList ( ) . Select ( x = > new CommonCNEN
{
Code = x . Code ,
ENName = x . EnName ,
CNName = x . CnName ,
} ) . Distinct ( ) . ToList ( ) ;
return List ;
}
else
{
var List = DbBus . Get ( DbList . Common ) . Select < CodeCountry > ( ) . WhereIf ( strlink ! = "" , x = > x . Code . Contains ( strlink . Trim ( ) ) | | x . EnName . Contains ( strlink . Trim ( ) ) | | x . CnName . Contains ( strlink . Trim ( ) ) ) . Page ( page , limit ) . ToList ( ) . Select ( x = > new CommonCNEN
{
Code = x . Code ,
ENName = x . EnName ,
CNName = x . CnName ,
} ) . Distinct ( ) . ToList ( ) ;
return List ;
}
}
catch ( Exception e )
{
throw ;
}
}
public List < CommonMappiCode > GetCARRIER ( )
{
try
{
var List = DbBus . Get ( DbList . Common ) . Select < CodeCarrier , MappingCarrier > ( ) . InnerJoin ( ( cc , map ) = > cc . Code = = map . Code & & map . Module = = "Afr" ) . ToList ( ( cc , map ) = > new CommonMappiCode
{
Code = cc . Code ,
Value = cc . EnName ,
MapCode = map . MapCode
} ) . Distinct ( ) . ToList ( ) ;
return List ;
}
catch ( Exception e )
{
throw ;
}
}
public List < CommonCodeValue > GetCTNALL ( )
{
try
{
var List = DbBus . Get ( DbList . Common ) . Select < CodeCtn , MappingCtn > ( ) . InnerJoin ( ( cc , map ) = > cc . Code = = map . Code & & map . Module = = "Afr" ) . ToList ( ( cc , map ) = > new CommonCodeValue
{
Code = cc . Code ,
Value = cc . Name ,
} ) . Distinct ( ) . ToList ( ) ;
return List ;
}
catch ( Exception e )
{
throw ;
}
}
public List < CommonCodeValue > GetPackage ( )
{
try
{
var List = DbBus . Get ( DbList . Common ) . Select < CodePackage , MappingPackage > ( ) . InnerJoin ( ( cc , map ) = > cc . Code = = map . Code & & map . Module = = "Afr" ) . ToList ( ( cc , map ) = > new CommonCodeValue
{
Code = cc . Code ,
Value = cc . Name ,
} ) . Distinct ( ) . ToList ( ) ;
return List ;
}
catch ( Exception e )
{
throw ;
}
}
public List < CodeDangerGradeDto > GetDangerousGoods ( string strlink )
{
try
{
var List = DbBus . Get ( DbList . Common ) . Select < CodeDangerGrade > ( ) . WhereIf ( strlink ! = "" , x = > x . Code . Contains ( strlink . Trim ( ) ) | | x . Grade . Contains ( strlink . Trim ( ) ) ) . ToList ( ) . Select ( x = > new CodeDangerGradeDto
{
Code = x . Code ,
Grade = x . Grade ,
} ) . Distinct ( ) . ToList ( ) ;
return List ;
}
catch ( Exception e )
{
throw ;
}
}
public List < CommonCodeValue > GetPort ( string strlink , int page , int limit )
{
try
{
if ( page = = 0 & & limit = = 0 )
{
var List = DbBus . Get ( DbList . Common ) . Select < CodePort > ( ) . WhereIf ( strlink ! = "" , x = > x . Code . Contains ( strlink . Trim ( ) ) | | x . EnName . Contains ( strlink . Trim ( ) ) ) . ToList ( ) . Select ( x = > new CommonCodeValue
{
Code = x . Code ,
Value = x . EnName ,
} ) . Distinct ( ) . ToList ( ) ;
return List ;
}
else
{
var List = DbBus . Get ( DbList . Common ) . Select < CodePort > ( ) . WhereIf ( strlink ! = "" , x = > x . Code . Contains ( strlink . Trim ( ) ) | | x . EnName . Contains ( strlink . Trim ( ) ) ) . Page ( page , limit ) . ToList ( ) . Select ( x = > new CommonCodeValue
{
Code = x . Code ,
Value = x . EnName ,
} ) . Distinct ( ) . ToList ( ) ;
return List ;
}
}
catch ( Exception e )
{
throw ;
}
}
public List < CommonCodeValue > GetVessel ( string strlink , int page , int limit )
{
try
{
if ( page = = 0 & & limit = = 0 )
{
var List = DbBus . Get ( DbList . Common ) . Select < CodeVessel > ( ) . WhereIf ( strlink ! = "" , x = > x . Name . Contains ( strlink . Trim ( ) ) ) . ToList ( ) . Select ( x = > new CommonCodeValue
{
Code = x . Name ,
Value = x . Name ,
} ) . Distinct ( ) . ToList ( ) ;
return List ;
}
else
{
var List = DbBus . Get ( DbList . Common ) . Select < CodeVessel > ( ) . WhereIf ( strlink ! = "" , x = > x . Name . Contains ( strlink . Trim ( ) ) ) . Page ( page , limit ) . ToList ( ) . Select ( x = > new CommonCodeValue
{
Code = x . Name ,
Value = x . Name ,
} ) . Distinct ( ) . ToList ( ) ;
return List ;
}
}
catch ( Exception e )
{
throw ;
}
}
# endregion
public async Task < PageModel < AFRMaster > > Load ( AFRMasterInputDto input )
{
// 查询草稿箱列表
if ( input . Type = = 1 )
{
var select = DbBus . Get ( DbList . AMSCenter )
. Select < AFRMaster > ( )
. LeftJoin < AFRHouse > ( ( m , h ) = > m . GID = = h . PID )
. Where ( ( m ) = > m . IsDel = = false )
. WhereIf ( ! string . IsNullOrEmpty ( input . CompanyId ) , m = > m . CompID = = input . CompanyId )
. WhereIf ( ! string . IsNullOrEmpty ( input . UserId ) , m = > m . UserID = = input . UserId )
. WhereIf ( ! string . IsNullOrEmpty ( input . MBLNO ) , m = > m . MBLNO . Contains ( input . MBLNO ) )
. WhereIf ( ! string . IsNullOrEmpty ( input . UserName ) , m = > m . UserName . Contains ( input . UserName ) )
. WhereIf ( ! string . IsNullOrEmpty ( input . DischargeHarbour ) , m = > m . DischargeHarbour . Contains ( input . DischargeHarbour ) )
. WhereIf ( input . CreateTimeStart ! = null , m = > m . CreateTime > = input . CreateTimeStart )
. WhereIf ( input . CreateTimeEnd ! = null , m = > m . CreateTime < = input . CreateTimeEnd ) ;
if ( ! string . IsNullOrEmpty ( input . HouseBillNo ) )
{
select . Where < AFRHouse > ( ( m , h ) = > h . HouseBillNo = = input . HouseBillNo ) ;
}
List < AFRMaster > result = await select . Page ( input )
. IncludeMany ( m = > m . Houses )
. OrderByDescending ( m = > m . CreateTime )
. ToListAsync ( ) ;
return new PageModel < AFRMaster > ( input . PageNumber ,
input . Count ,
input . PageSize ,
result ) ;
}
// 查询已发送列表
else
{
return default ;
}
//HouseBillNo
}
public Task SaveInfo ( AFRMasterDto input )
{
throw new NotImplementedException ( ) ;
}
public Task Delete ( string ids )
{
throw new NotImplementedException ( ) ;
}
public Task Send ( string ids , string msgType )
{
throw new NotImplementedException ( ) ;
}
public Task SaveReceipt ( AFRReceiptDto input )
{
throw new NotImplementedException ( ) ;
}
}
}