using iWareCommon.Utils;
using iWareLog.ORM;
using iWareLog.Report.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iWareLog.Report.Service
{
public class InOutService
{
private static object Lock = new object();
private static InOutService Instance = null;
///
/// 获取单例的方法
///
/// 单例实体
public static InOutService GetInstance()
{
if (Instance == null)
{
lock (Lock)
{
if (Instance == null)
{
Instance = new InOutService();
}
}
}
return Instance;
}
///
/// 根据出入库类型,物料类型查询
///
///
///
///
public List GetMaterial(DateTime start, DateTime end, int type)
{
using (DbModelLog context = new DbModelLog())
{
try
{
string sql = @"select count(B.typename)quantity,B.typename materialcode from InOutStorageDetail A left join WGQ_WB19011_CORE.[dbo].[BASEMaterialView] B on A.materialid=B.id
where A.type=@p0 and A.updatetime>=@p1 and A.updatetime<@p2 group by B.typename";
List data = context.Database.SqlQuery(sql,type, start, end).ToList();
return data;
}
catch (Exception ex)
{
LogTextHelper.WriteLine("InOutService", "GetInMaterial", ex.ToString());
return null;
}
}
}
}
}