using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using QMAPP.DAL; using QMAPP.FJC.Entity.Common.Constants; using QMAPP.FJC.Entity.CompleteStatistics; using QMAPP.FJC.Entity.MesB9; using QMFrameWork.Data; namespace QMAPP.FJC.DAL.MesB9 { public class MesB4M110DAL : BaseDAL { public List GetList() { List parameters = new List(); string sql = "SELECT * FROM Mes_B4_M110 WHERE ReadFlag=0"; if (BaseSession != null) { return BaseSession.GetList(sql, parameters.ToArray()).ToList(); } using (IDataSession session = AppDataFactory.CreateSession("maindbSelect")) { return session.GetList(sql, parameters.ToArray()).ToList(); } } public int Update(MesB4M110Entity model) { if (BaseSession != null) { //同步插入本地数据库 List parameters = new List(); var sql = "insert into [ADIENT_QD_MES].[dbo].[Mes_B4_M110]([seq],[kin],[vin],[m110dtm],[ProdNo1],[ProdNo2],[ProdNo3],[ProdNo4],[assemblyline],[sysdtm],[ReadFlag]) values('" + model.seq + "','" + model.kin + "','" + model.vin + "','" + model.m110dtm + "','" + model.ProdNo1 + "','" + model.ProdNo2 + "','" + model.ProdNo3 + "','" + model.ProdNo4 + "','" + model.assemblyline + "','" + DateTime.Now + "'," + model.ReadFlag + ")"; BaseSession.ExecuteSql(sql, parameters.ToArray()); //插入基本信息 return BaseSession.Update(model); } else { using (IDataSession session = AppDataFactory.CreateSession("maindbSelect")) { return session.Update(model); } } } } }