using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.DAL;
using QMFrameWork.Data;
using QMAPP.FJC.Entity.FIS;
using QMFrameWork.Log;
namespace QMAPP.FJC.DAL.FIS
{
///
/// 模块编号:M20
/// 作 用:FISM100接口
/// 作 者:王济
/// 编写日期:2015年07月15日
///
public class FisDAL : BaseDAL
{
///
/// 获得info表中最大上限日期
///
///
public List GetFisMaxDate()
{
string sql = null;
try
{
sql = "SELECT MAX(CP5A) AS CP5A FROM T_AW_FISINFO";
List parameters = new List();
List resultList = null;
using (IDataSession session = AppDataFactory.CreateMainSession())
{
sql = this.ChangeSqlByDB(sql, session);
resultList = (List)session.GetList(sql, parameters.ToArray());
}
return resultList;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "定时查询在制品库存数据层-插入列表!"
});
throw ex;
}
}
///
/// 获得位置表所有信息
///
///
public List GetOtherItem()
{
string sql = null;
try
{
sql = "SELECT * FROM T_AW_FISINFOS";
List parameters = new List();
List resultList = null;
using (IDataSession session = AppDataFactory.CreateMainSession())
{
sql = this.ChangeSqlByDB(sql, session);
resultList = (List)session.GetList(sql, parameters.ToArray());
}
return resultList;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "FISM100接口数据层-插入列表!"
});
throw ex;
}
}
///
/// 获得大于上限时间的数据
///
/// 上限时间
///
public List GetOtherItem(DateTime date)
{
string sql = null;
try
{
sql = "SELECT * FROM T_AW_FISINFOS WHERE CP5A>'" + date + "'";
List parameters = new List();
List resultList = null;
using (IDataSession session = AppDataFactory.CreateMainSession())
{
sql = this.ChangeSqlByDB(sql, session);
resultList = (List)session.GetList(sql, parameters.ToArray());
}
return resultList;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "FISM100接口数据层-插入列表!"
});
throw ex;
}
}
#region 插入
///
/// 插入信息
///
/// 信息
/// 插入行数
public int Insert(List model)
{
int count = 0;
try
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
//插入基本信息
count = session.Insert(model);
}
return count;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "FISM100接口数据层-插入信息"
});
throw;
}
}
#endregion
}
}