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 GetList100() { List parameters = new List(); string sql = "SELECT * FROM T_FISORDER_M100 WHERE ReadFlag=0"; if (BaseSession != null) { return BaseSession.GetList(sql, parameters.ToArray()).ToList(); } using (IDataSession session = AppDataFactory.CreateMainSession()) { return session.GetList(sql, parameters.ToArray()).ToList(); } } public List GetList110() { List parameters = new List(); string sql = "SELECT * FROM T_FISORDER_M110 WHERE ReadFlag=0"; if (BaseSession != null) { return BaseSession.GetList(sql, parameters.ToArray()).ToList(); } using (IDataSession session = AppDataFactory.CreateMainSession()) { return session.GetList(sql, parameters.ToArray()).ToList(); } } public int Update100(mbM100 model) { //同步插入本地数据库 List parameters = new List(); //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 parameters = new List(); //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 parameters = new List(); 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(sql.ToString(), parameters.ToArray()); } } catch (Exception ex) { throw ex; } } } }