@ -123,30 +123,32 @@ namespace QMAPP.MD.DAL
try
try
{
{
if ( condition . BeginTime = = Convert . ToDateTime ( "0001/1/1 00:00:00" ) )
if ( condition . BeginTime = = Convert . ToDateTime ( "0001/1/1 00:00:00" ) )
condition . BeginTime = DateTime . Now . AddDays ( - 5 ) ;
condition . BeginTime = DateTime . Now . AddDays ( - 1 ) ;
if ( condition . EndTime = = Convert . ToDateTime ( "0001/1/1 00:00:00" ) )
if ( condition . EndTime = = Convert . ToDateTime ( "0001/1/1 00:00:00" ) )
condition . EndTime = DateTime . Now ;
condition . EndTime = DateTime . Now ;
//构成查询语句
//构成查询语句
sqlBuilder . Append ( "select PID,Type,ProductCode,CreateTime,CreateUser " ) ;
sqlBuilder . Append ( "select b. PID,b. Type,b. ProductCode,m.MAINCODE as 'BZDBarcode',m.MATERIAL_CODE as 'BZDMaterial_Code',t.MATERIAL_NAME as 'BZDMaterial_CodeName',b. CreateTime,b. CreateUser " ) ;
sqlBuilder . Append ( "FROM T_AW_BarCode_Replacement " ) ;
sqlBuilder . Append ( "from T_AW_BarCode_Replacement as b left join T_AW_MAIN as m on b.ProductCode = m.EPIDERMISCODE LEFT JOIN T_MD_MATERIAL as t on m.MATERIAL_CODE = t.MATERIAL_CODE " ) ;
//查询条件
//查询条件
//查询条件
//查询条件
if ( string . IsNullOrEmpty ( condition . ProductCode ) = = false )
if ( string . IsNullOrEmpty ( condition . ProductCode ) = = false )
{
{
whereBuilder . Append ( " AND ProductCode like @ProductCode " ) ;
whereBuilder . Append ( " AND b. ProductCode like @ProductCode " ) ;
parameters . Add ( new DataParameter { ParameterName = "ProductCode" , DataType = DbType . String , Value = "%" + condition . ProductCode + "%" } ) ;
parameters . Add ( new DataParameter { ParameterName = "ProductCode" , DataType = DbType . String , Value = "%" + condition . ProductCode + "%" } ) ;
}
}
//查询条件
//查询条件
if ( string . IsNullOrEmpty ( condition . Type ) = = false )
if ( string . IsNullOrEmpty ( condition . Type ) = = false )
{
{
whereBuilder . Append ( " AND Type like @Type " ) ;
whereBuilder . Append ( " AND b. Type like @Type " ) ;
parameters . Add ( new DataParameter { ParameterName = "Type" , DataType = DbType . String , Value = "%" + condition . Type + "%" } ) ;
parameters . Add ( new DataParameter { ParameterName = "Type" , DataType = DbType . String , Value = "%" + condition . Type + "%" } ) ;
}
}
whereBuilder . Append ( $" AND CreateTime >= '{condition.BeginTime}' and CreateTime <= '{condition.EndTime}' " ) ;
whereBuilder . Append ( $" AND b. CreateTime >= '{condition.BeginTime}' and b. CreateTime <= '{condition.EndTime}' " ) ;
if ( whereBuilder . Length > 0 )
if ( whereBuilder . Length > 0 )
{
{