天津投入产出系统后端
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.
 
 
 
 
 
 

111 lines
5.0 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using QMAPP.DAL;
using QMAPP.FJC.Entity.MesB9;
using QMAPP.FJC.Entity.QdFis;
using QMFrameWork.Data;
using System.Text;
namespace QMAPP.FJC.DAL.QdFis
{
public class mbM100DAL : BaseDAL
{
public List<mbM100> GetList100()
{
List<DataParameter> parameters = new List<DataParameter>();
string sql = "SELECT * FROM T_FISORDER_M100 WHERE ReadFlag=0";
if (BaseSession != null)
{
return BaseSession.GetList<mbM100>(sql, parameters.ToArray()).ToList();
}
using (IDataSession session = AppDataFactory.CreateMainSession())
{
return session.GetList<mbM100>(sql, parameters.ToArray()).ToList();
}
}
public List<mbM110> GetList110()
{
List<DataParameter> parameters = new List<DataParameter>();
string sql = "SELECT * FROM T_FISORDER_M110 WHERE ReadFlag=0";
if (BaseSession != null)
{
return BaseSession.GetList<mbM110>(sql, parameters.ToArray()).ToList();
}
using (IDataSession session = AppDataFactory.CreateMainSession())
{
return session.GetList<mbM110>(sql, parameters.ToArray()).ToList();
}
}
public int Update100(mbM100 model)
{
//同步插入本地数据库
List<DataParameter> parameters = new List<DataParameter>();
//var sql ="insert into T_FISORDER_M100 ([seq],[kin],[vin],[m100dtm],[ProdNo1],[ProdNo2],[ProdNo3],[ProdNo4],[assemblyline],[sysdtm],[ReadFlag]) values('" + model.seq + "','" + model.kin + "','" + model.vin + "','" + model.m100dtm + "','" + model.ProdNo1 + "','" + model.ProdNo2 + "','" + model.ProdNo3 + "','" + model.ProdNo4 + "','" + model.assemblyline + "','" + DateTime.Now + "'," + model.ReadFlag + ")";
string sql = "update T_FISORDER_M100 set ReadFlag=1 WHERE KIN='" + model.KIN + "'";
if (BaseSession != null)
{
return BaseSession.ExecuteSql(sql, parameters.ToArray());
}
using (IDataSession session = AppDataFactory.CreateMainSession())
{
return session.ExecuteSql(sql, parameters.ToArray());
}
}
public int Update110(mbM110 model)
{
//同步插入本地数据库
List<DataParameter> parameters = new List<DataParameter>();
//var sql ="insert into T_FISORDER_M100 ([seq],[kin],[vin],[m100dtm],[ProdNo1],[ProdNo2],[ProdNo3],[ProdNo4],[assemblyline],[sysdtm],[ReadFlag]) values('" + model.seq + "','" + model.kin + "','" + model.vin + "','" + model.m100dtm + "','" + model.ProdNo1 + "','" + model.ProdNo2 + "','" + model.ProdNo3 + "','" + model.ProdNo4 + "','" + model.assemblyline + "','" + DateTime.Now + "'," + model.ReadFlag + ")";
string sql = "update T_FISORDER_M110 set ReadFlag=1 WHERE KIN='" + model.KIN + "'";
if (BaseSession != null)
{
return BaseSession.ExecuteSql(sql, parameters.ToArray());
}
using (IDataSession session = AppDataFactory.CreateMainSession())
{
return session.ExecuteSql(sql, parameters.ToArray());
}
}
public Entity.QdFis.FISMap MapMES(string carmodel, string modulFL, string modulFR, string modulRL, string modulRR, string modules)
{
try
{
using (IDataSession session = AppDataFactory.CreateMainSession())
{
StringBuilder sql = new StringBuilder();
sql.AppendLine("SELECT * ");
sql.AppendLine(" FROM [T_MD_FISMAP] ");
sql.AppendLine(" WHERE [CarModel]=@carmodel ");
sql.AppendLine(" AND [ModulFL]=@modulFL ");
sql.AppendLine(" AND [ModulFR]=@modulFR ");
sql.AppendLine(" AND [ModulRL]=@modulRL ");
sql.AppendLine(" AND [ModulRR]=@modulRR ");
sql.AppendLine(" AND [Modules]=@modules ");
sql.AppendLine(" ORDER BY [CreateDate] ");
List<DataParameter> parameters = new List<DataParameter>();
parameters.Add(new DataParameter("carmodel", carmodel + ""));
parameters.Add(new DataParameter("modulFL", modulFL + ""));
parameters.Add(new DataParameter("modulFR", modulFR + ""));
parameters.Add(new DataParameter("modulRL", modulRL + ""));
parameters.Add(new DataParameter("modulRR", modulRR + ""));
parameters.Add(new DataParameter("modules", modules + ""));
//获取信息
return session.Get<Entity.QdFis.FISMap>(sql.ToString(), parameters.ToArray());
}
}
catch (Exception ex)
{
throw ex;
}
}
}
}