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.
134 lines
4.4 KiB
134 lines
4.4 KiB
4 years ago
|
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
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 模块编号:M19
|
||
|
/// 作 用:定时查询在制品库存
|
||
|
/// 作 者:王济
|
||
|
/// 编写日期:2015年07月13日
|
||
|
///</summary>
|
||
|
public class CheckWipDAL : BaseDAL
|
||
|
{
|
||
|
public List<ProcessSet> 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<DataParameter> parameters = new List<DataParameter>();
|
||
|
List<ProcessSet> resultList = null;
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
sql = this.ChangeSqlByDB(sql, session);
|
||
|
resultList = (List<ProcessSet>)session.GetList<ProcessSet>(sql, parameters.ToArray());
|
||
|
}
|
||
|
return resultList;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogManager.LogHelper.Error(new LogInfo()
|
||
|
{
|
||
|
ErrorInfo = ex,
|
||
|
Tag = ex.StackTrace,
|
||
|
Info = "定时查询在制品库存数据层-插入列表!"
|
||
|
});
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#region 插入
|
||
|
/// <summary>
|
||
|
/// 插入信息
|
||
|
/// </summary>
|
||
|
/// <param name="">信息</param>
|
||
|
/// <returns>插入行数</returns>
|
||
|
public int Insert(List<ProducePlan> model)
|
||
|
{
|
||
|
int count = 0;
|
||
|
try
|
||
|
{
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
//插入基本信息
|
||
|
count = session.Insert<ProducePlan>(model);
|
||
|
}
|
||
|
return count;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogManager.LogHelper.Error(new LogInfo()
|
||
|
{
|
||
|
ErrorInfo = ex,
|
||
|
Tag = ex.StackTrace,
|
||
|
Info = "定时查询在制品库存数据层-插入信息"
|
||
|
});
|
||
|
throw;
|
||
|
}
|
||
|
}
|
||
|
public int Insert(List<StorageAlarm> model)
|
||
|
{
|
||
|
int count = 0;
|
||
|
try
|
||
|
{
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
//插入基本信息
|
||
|
count = session.Insert<StorageAlarm>(model);
|
||
|
}
|
||
|
return count;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogManager.LogHelper.Error(new LogInfo()
|
||
|
{
|
||
|
ErrorInfo = ex,
|
||
|
Tag = ex.StackTrace,
|
||
|
Info = "定时查询在制品库存数据层-插入信息"
|
||
|
});
|
||
|
throw;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region 更新
|
||
|
/// <summary>
|
||
|
/// 更新已生成过时记录
|
||
|
/// </summary>
|
||
|
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
|
||
|
}
|
||
|
}
|