天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
4.6 KiB

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