|
@ -154,6 +154,33 @@ namespace QMAPP.FJC.DAL.Bucket |
|
|
whereBuilder.Append(" AND MATERIAL_CODE = @MATERIAL_CODE"); |
|
|
whereBuilder.Append(" AND MATERIAL_CODE = @MATERIAL_CODE"); |
|
|
parameters.Add(new DataParameter { ParameterName = "MATERIAL_CODE", DataType = DbType.String, Value = condition.MATERIAL_CODE }); |
|
|
parameters.Add(new DataParameter { ParameterName = "MATERIAL_CODE", DataType = DbType.String, Value = condition.MATERIAL_CODE }); |
|
|
} |
|
|
} |
|
|
|
|
|
if (string.IsNullOrEmpty(condition.PColour) == false) |
|
|
|
|
|
{ |
|
|
|
|
|
whereBuilder.Append(" AND PColour = @PColour"); |
|
|
|
|
|
parameters.Add(new DataParameter { ParameterName = "PColour", DataType = DbType.String, Value = condition.PColour }); |
|
|
|
|
|
} |
|
|
|
|
|
if (!string.IsNullOrEmpty(condition.BeginWeigh)) |
|
|
|
|
|
{ |
|
|
|
|
|
whereBuilder.Append(" AND Weigh >= @BeginWeigh"); |
|
|
|
|
|
parameters.Add(new DataParameter { ParameterName = "BeginWeigh", DataType = DbType.String, Value = condition.BeginWeigh }); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(condition.EndWeigh)) |
|
|
|
|
|
{ |
|
|
|
|
|
whereBuilder.Append(" AND Weigh <= @EndWeigh"); |
|
|
|
|
|
parameters.Add(new DataParameter { ParameterName = "EndWeigh", DataType = DbType.String, Value = condition.EndWeigh }); |
|
|
|
|
|
} |
|
|
|
|
|
var sss = DateTime.MinValue.ToString(); |
|
|
|
|
|
if (condition.BeginTime != DateTime.MinValue) |
|
|
|
|
|
{ |
|
|
|
|
|
whereBuilder.Append(" AND CREATEDATE >= @BeginTime"); |
|
|
|
|
|
parameters.Add(new DataParameter { ParameterName = "BeginTime", DataType = DbType.String, Value = condition.BeginTime }); |
|
|
|
|
|
} |
|
|
|
|
|
if (condition.EndTime != DateTime.MinValue) |
|
|
|
|
|
{ |
|
|
|
|
|
whereBuilder.Append(" AND CREATEDATE <= @EndTime"); |
|
|
|
|
|
parameters.Add(new DataParameter { ParameterName = "EndTime", DataType = DbType.String, Value = condition.EndTime }); |
|
|
|
|
|
} |
|
|
//查询条件
|
|
|
//查询条件
|
|
|
if (whereBuilder.Length > 0) |
|
|
if (whereBuilder.Length > 0) |
|
|
{ |
|
|
{ |
|
@ -259,8 +286,59 @@ namespace QMAPP.FJC.DAL.Bucket |
|
|
} |
|
|
} |
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 统计
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 统计
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name=""></param>
|
|
|
|
|
|
/// <returns>删除个数</returns>
|
|
|
|
|
|
public TSWeighRecore Statistics(TSWeighRecore Info) |
|
|
|
|
|
{ |
|
|
|
|
|
StringBuilder sqlBuilder = new StringBuilder(); |
|
|
|
|
|
List<DataParameter> parameters = new List<DataParameter>(); |
|
|
|
|
|
int count = 0; |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
using (IDataSession session = AppDataFactory.CreateMainSession()) |
|
|
|
|
|
{ |
|
|
|
|
|
//删除基本信息
|
|
|
|
|
|
sqlBuilder.Append("select sum([Weigh]) as 'SUM',count(*) as 'Weigh' from T_AW_TSWeighRecore "); |
|
|
|
|
|
sqlBuilder.Append("WHERE 1 = 1 "); |
|
|
|
|
|
if (Info.BeginTime != DateTime.MinValue) |
|
|
|
|
|
sqlBuilder.Append($" and CREATEDATE >= '{Info.BeginTime}' "); |
|
|
|
|
|
if (Info.EndTime != DateTime.MinValue) |
|
|
|
|
|
sqlBuilder.Append($" and CREATEDATE <= '{Info.EndTime}' "); |
|
|
|
|
|
if (string.IsNullOrEmpty(Info.ProductCode) == false) |
|
|
|
|
|
{ |
|
|
|
|
|
sqlBuilder.Append($" AND ProductCode = '{Info.ProductCode}'"); |
|
|
|
|
|
} |
|
|
|
|
|
if (string.IsNullOrEmpty(Info.MATERIAL_CODE) == false) |
|
|
|
|
|
{ |
|
|
|
|
|
sqlBuilder.Append($" AND MATERIAL_CODE = '{Info.MATERIAL_CODE}'"); |
|
|
|
|
|
} |
|
|
|
|
|
if (string.IsNullOrEmpty(Info.PColour) == false) |
|
|
|
|
|
{ |
|
|
|
|
|
sqlBuilder.Append($" AND PColour = '{Info.PColour}'"); |
|
|
|
|
|
} |
|
|
|
|
|
if (!string.IsNullOrEmpty(Info.BeginWeigh)) |
|
|
|
|
|
{ |
|
|
|
|
|
sqlBuilder.Append($" AND Weigh >= '{Info.BeginWeigh}'"); |
|
|
|
|
|
} |
|
|
|
|
|
if (!string.IsNullOrEmpty(Info.EndWeigh)) |
|
|
|
|
|
{ |
|
|
|
|
|
sqlBuilder.Append($" AND Weigh <= {Info.EndWeigh}"); |
|
|
|
|
|
} |
|
|
|
|
|
return session.Get<TSWeighRecore>(sqlBuilder.ToString(), parameters.ToArray()); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
{ |
|
|
|
|
|
throw ex; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|