using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMFrameWork.Log;
using QMFrameWork.Data;
using QMAPP.FJC.Entity.Basic;
using QMAPP.DAL;
using QMAPP.FJC.Entity.ProduceManage;
using QMAPP.FJC.Entity.WIPManage;
namespace QMAPP.FJC.DAL.WipService
{
///
/// 模块编号:M19
/// 作 用:定时查询在制品库存
/// 作 者:王济
/// 编写日期:2015年07月13日
///
public class CheckWipDAL : BaseDAL
{
public List WipProecessCheck()
{
string sql = null;
try
{
sql = "SELECT M.MINVALUE,M.PRODUCEMINVALUE,M.PRODUCTTYPE,M.PROCESSTYPE,C.PRODUCESHIFTNAME,C.PRODUCESHIFTTCODE,SUM(C.CAPACITY - C.USINGCOUNT) AS TEMP FROM T_BD_PROCESSSET M LEFT JOIN T_AW_PRODUCT C ON C.PRODUCTTYPE=M.PRODUCTTYPE AND C.CURRENTPROCESS = M.PROCESSTYPE WHERE M.WIPSET='1' GROUP BY ALL M.MINVALUE,M.PRODUCEMINVALUE,M.PRODUCTTYPE,M.PROCESSTYPE,C.PRODUCESHIFTNAME,C.PRODUCESHIFTTCODE";
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;
}
}
#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 = "定时查询在制品库存数据层-插入信息"
});
throw;
}
}
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 = "定时查询在制品库存数据层-插入信息"
});
throw;
}
}
#endregion
#region 更新
///
/// 更新已生成过时记录
///
public int Update()
{
string sql = null;
try
{
sql = "UPDATE T_AW_PRODUCEPLAN SET PASTFLAG='1' WHERE PASTFLAG='0' AND CREATETYPE='0' AND PLANSTATUS='0'";
using (IDataSession session = AppDataFactory.CreateMainSession())
{
sql = this.ChangeSqlByDB(sql, session);
return session.ExecuteSql(sql);
}
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "定时查询在制品库存数据层-更新列表!"
});
throw ex;
}
}
#endregion
}
}