Beispiel #1
0
       public List<DataTable> GetQueryResult(string Connection, string line)
       {
            string methodName = MethodBase.GetCurrentMethod().Name;
            
            BaseLog.LoggingBegin(logger, methodName);
            List<DataTable> dts = new List<DataTable>();
            try
            {
                using(UnitOfWork uow =new UnitOfWork())
               {
                string SQLText = @"select DurTime, Family, Output, StandardOutput, OutputRate, DefectQty, Rate, LocationTop3
                                    from SMT_Dashboard_Result where Line =@Line";
                

                DataTable dt1= SQLHelper.ExecuteDataFill(Connection,
                                                 System.Data.CommandType.Text,
                                                 SQLText,
                                                 SQLHelper.CreateSqlParameter("@Line", line));
                string defectCause = @"if (GETDATE()<=cast((CONVERT(char(10),GETDATE(),23)  +' 08:00')as datetime))
                                        begin 
	                                        select CONVERT(varchar(5), StartTime, 108)+'--'+CONVERT(varchar(5), EndTime, 108),Family,isnull(SrcLocation,'') as Location,ISNULL(Cause,'') as Cause,ISNULL(Remark,'') as Remark 
                                            from Alarm where Cdt between cast((CONVERT(char(10), DATEADD(D,-1,GETDATE()),23)  +' 08:00')as datetime)
	                                        and cast((CONVERT(char(10),GETDATE(),23)  +' 08:00')as datetime)
                                        end 
                                        else begin 
	                                        select CONVERT(varchar(5), StartTime, 108)+'--'+CONVERT(varchar(5), EndTime, 108),Family,isnull(SrcLocation,'') as Location,ISNULL(Cause,'') as Cause,ISNULL(Remark,'') as Remark 
                                            from Alarm where Cdt between cast((CONVERT(char(10),GETDATE(),23)  +' 08:00')as datetime)
	                                        and cast((CONVERT(char(10),dateadd(D,1,GETDATE()),23)  +' 00:00')as datetime)
                                        end ";
                DataTable dt2 = SQLHelper.ExecuteDataFill(Connection,
                                             System.Data.CommandType.Text,
                                             defectCause);

                string refreshTimeAndStation = @"select RefreshTime,Station from SMT_Dashboard_Line_RefreshTime_Station where Line=@line";


                DataTable dt3 = SQLHelper.ExecuteDataFill(Connection,
                                                 System.Data.CommandType.Text,
                                                 refreshTimeAndStation,
                                                 SQLHelper.CreateSqlParameter("@line", line));
                    dts.Add(dt1);
                    dts.Add(dt2);
                    dts.Add(dt3);
                    return dts;
                }
            }
            catch (Exception e)
            {

                BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
                throw;
            }
            finally
            {
                BaseLog.LoggingEnd(logger, methodName);
            }
        }
Beispiel #2
0
        public List<DataTable> GetQueryResult(string Connection)
        {
            string methodName = MethodBase.GetCurrentMethod().Name;

            BaseLog.LoggingBegin(logger, methodName);
            List<DataTable> dts = new List<DataTable>();
            try
            {
                using (UnitOfWork uow = new UnitOfWork())
                {
                    DataTable dt1 = SQLHelper.ExecuteDataFill(Connection, System.Data.CommandType.StoredProcedure,
                                                              "sp_Query_SARepairDashboard",
                                                              new SqlParameter("@type", "1"));

                    DataTable dt2 = SQLHelper.ExecuteDataFill(Connection, System.Data.CommandType.StoredProcedure,
                                                 "sp_Query_SARepairDashboard",
                                                 new SqlParameter("@type", "2"));
                    DataTable dt3 = SQLHelper.ExecuteDataFill(Connection, System.Data.CommandType.StoredProcedure,
                                          "sp_Query_SARepairDashboard",
                                          new SqlParameter("@type", "3"));
                    dts.Add(dt1);
                    dts.Add(dt2);
                    dts.Add(dt3);
                    return dts;
                }
            }
            catch (Exception e)
            {

                BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
                throw;
            }
            finally
            {
                BaseLog.LoggingEnd(logger, methodName);
            }
        }
Beispiel #3
0
 public IList<ECOModelInfo> GetECOModelList(string model, DateTime froms, DateTime to)
 {
     string methodName = MethodBase.GetCurrentMethod().Name;
     BaseLog.LoggingBegin(logger, methodName);
     IList<ECOModelInfo> ret = new List<ECOModelInfo>();
     try
     {
         using (UnitOfWork uow = new UnitOfWork())
         {
             IRepository<ECOModel> ecoModelRep = new Repository<ECOModel>("HPIMESDB");
             if (model != "" && froms != DateTime.MinValue && to != DateTime.MinValue)
             {
                 ret = (from q in ecoModelRep.Query()
                        where q.Cdt >= froms
                        && q.Cdt <= to
                        && q.Model == model
                        select new ECOModelInfo
                        {
                            ID = q.ID,
                            Cdt = q.Cdt,
                            ECRNo = q.ECRNo,
                            ECONo = q.ECONo,
                            Editor = q.Editor,
                            Model = q.Model,
                            Plant = q.Plant,
                            PreStatus = q.PreStatus,
                            Remark = q.Remark,
                            Status = q.Status,
                            Udt = q.Udt,
                            ValidateFromDate = q.ValidateFromDate
                        }).ToList();
             }
             else if (model != "" && froms == DateTime.MinValue)
             {
                 ret = (from q in ecoModelRep.Query()
                        where q.Model == model
                        select new ECOModelInfo
                        {
                            ID = q.ID,
                            Cdt = q.Cdt,
                            ECRNo = q.ECRNo,
                            ECONo = q.ECONo,
                            Editor = q.Editor,
                            Model = q.Model,
                            Plant = q.Plant,
                            PreStatus = q.PreStatus,
                            Remark = q.Remark,
                            Status = q.Status,
                            Udt = q.Udt,
                            ValidateFromDate = q.ValidateFromDate
                        }).ToList();
             }
             else if (model == "" && froms != DateTime.MinValue && to != DateTime.MinValue)
             {
                 ret = (from q in ecoModelRep.Query()
                        where q.Cdt >= froms
                        && q.Cdt <= to
                        select new ECOModelInfo
                        {
                            ID = q.ID,
                            Cdt = q.Cdt,
                            ECRNo = q.ECRNo,
                            ECONo = q.ECONo,
                            Editor = q.Editor,
                            Model = q.Model,
                            Plant = q.Plant,
                            PreStatus = q.PreStatus,
                            Remark = q.Remark,
                            Status = q.Status,
                            Udt = q.Udt,
                            ValidateFromDate = q.ValidateFromDate
                        }).ToList();
             }
             return ret;
         }
     }
     catch (Exception e)
     {
         BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
         throw;
     }
     finally
     {
         BaseLog.LoggingEnd(logger, methodName);
     }
 }
Beispiel #4
0
        public IList<ECOModelInfo> SaveECOModelChange(ECOModelInfo item)
		{
			string methodName = MethodBase.GetCurrentMethod().Name;
            BaseLog.LoggingBegin(logger, methodName);
            try
            {
                ECOModel items = new ECOModel();
                string preStatus = item.PreStatus;
                string model = item.Model;
                items.Udt = DateTime.Now;
                items.PreStatus = preStatus;
                items.Status = item.Status;
                items.Remark = item.Remark;
                items.Editor = item.Editor;
                items.Cdt = item.Cdt;
                items.Plant = item.Plant;
                items.ValidateFromDate = item.ValidateFromDate;
                items.ECONo = item.ECONo;
                items.ECRNo = item.ECRNo;
                items.Model = model;
                items.ID = item.ID;
                using (UnitOfWork uow = new UnitOfWork())
                {
                    IRepository<ECOModel> ecoModelRep = new Repository<ECOModel>("HPIMESDB");
                    IRepository<ConstValueType> constValueTypeRep = new Repository<ConstValueType>("HPIMESDB");
                    IList<ConstValueType> constvaluetemp = new List<ConstValueType>();
                    if (preStatus == "HoldTravelCard")
                    {
                        constvaluetemp = (from q in constValueTypeRep.Query()
                                          where q.Type == "HolTravelCardModel"
                                          && q.Value.Contains(model)
                                          select q).ToList();
                        if (constvaluetemp.Count != 0)
                        {
                            constValueTypeRep.Delete(constvaluetemp[0], false);
                        }
                    }
                    ecoModelRep.Update(items);
                    uow.Commit();
                }
                return GetECOModelList(item.ID);
            }
            catch (Exception e)
            {
                BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
                throw;
            }
            finally
            {
                BaseLog.LoggingEnd(logger, methodName);
            }
		}
Beispiel #5
0
 public IList<ECOModelInfo> GetECOModelList(long id)
 {
     string methodName = MethodBase.GetCurrentMethod().Name;
     BaseLog.LoggingBegin(logger, methodName);
     IList<ECOModelInfo> ret = new List<ECOModelInfo>();
     try
     {
         using (UnitOfWork uow = new UnitOfWork())
         {
             IRepository<ECOModel> ecoModelRep = new Repository<ECOModel>("HPIMESDB");
             ret = (from q in ecoModelRep.Query()
                    where q.ID == id
                    select new ECOModelInfo
                    {
                        ID = q.ID,
                        Cdt = q.Cdt,
                        ECRNo = q.ECRNo,
                        ECONo = q.ECONo,
                        Editor = q.Editor,
                        Model = q.Model,
                        Plant = q.Plant,
                        PreStatus = q.PreStatus,
                        Remark = q.Remark,
                        Status = q.Status,
                        Udt = q.Udt,
                        ValidateFromDate = q.ValidateFromDate
                    }).ToList();
             return ret;
         }
     }
     catch (Exception e)
     {
         BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
         throw;
     }
     finally
     {
         BaseLog.LoggingEnd(logger, methodName);
     }
 }
Beispiel #6
0
 public List<SMT_DashBoard_Line> GetQueryLine()
 {
     string methodName = MethodBase.GetCurrentMethod().Name;
     logger.DebugFormat("BEGIN: {0}()", methodName);
     List<SMT_DashBoard_Line> lines = new List<SMT_DashBoard_Line>();
     try
     {
         using (UnitOfWork uow = new UnitOfWork())
         {
             lines = (from SMTDashboard in SMTLineRefreshTimeStationtRep.Query()
                      select new SMT_DashBoard_Line { line = SMTDashboard.Line }).Distinct().ToList();
             return lines;
         }
     }
     catch (Exception e)
     {
         BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
         throw;
     }
     finally
     {
         BaseLog.LoggingEnd(logger, methodName);
     }
 
 }
Beispiel #7
0
       public IList<SMT_DashBoard_MantainInfo> GetSMTDashBoardRefreshTimeAndStationByLine(SMT_DashBoard_MantainInfo condition)
       {
           string methodName = MethodBase.GetCurrentMethod().Name;

           BaseLog.LoggingBegin(logger, methodName);

           IList<SMT_DashBoard_MantainInfo> ret = new List<SMT_DashBoard_MantainInfo>();
           try
           {

               using (UnitOfWork uow = new UnitOfWork())
               {
                   ret = (from SMTRefreshTimeStation in SMTLineRefreshTimeStationtRep.Query()
                          where SMTRefreshTimeStation.Line ==condition.line
                          select new SMT_DashBoard_MantainInfo { line = SMTRefreshTimeStation.Line, refreshTime = SMTRefreshTimeStation.RefreshTime, station = SMTRefreshTimeStation.Station }).Distinct().ToList();

               }

               return ret;
           }
           catch (Exception)
           {
               throw;
           }
           finally
           {
               BaseLog.LoggingEnd(logger, methodName);
           }
       }
Beispiel #8
0
       public void UpdateSMTDashBoardInfo(SMT_DashBoard_MantainInfo conditicon)
       {
           string methodName = MethodBase.GetCurrentMethod().Name;
           logger.DebugFormat("BEGIN: {0}()", methodName);
           SMT_Dashboard_Line_Time_Qty smtDashBoardMaintain = new SMT_Dashboard_Line_Time_Qty();
           try
           {
               using (UnitOfWork uow = new UnitOfWork())
               {

                   smtDashBoardMaintain.ID = conditicon.id;
                   smtDashBoardMaintain.Line = conditicon.line;
                   smtDashBoardMaintain.Qty = conditicon.standardOutput;
                   smtDashBoardMaintain.DurTime = conditicon.durTime;
                   smtDashBoardMaintain.Editor = conditicon.editor;
                   smtDashBoardMaintain.Cdt = conditicon.StandardOutputCdt;
                   smtDashBoardMaintain.Udt = DateTime.Now;
                   SMTDashBoardRep.Update(smtDashBoardMaintain);
                   uow.Commit();
               }
              
           }
           catch (Exception e)
           {
               BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
               throw;
           }
           finally
           {
               BaseLog.LoggingEnd(logger, methodName);
           }
       
       }
Beispiel #9
0
 public void AddSMTDashboardInfo(SMT_DashBoard_MantainInfo conditicon)
 {
     string methodName = MethodBase.GetCurrentMethod().Name;
     logger.DebugFormat("BEGIN: {0}()", methodName);
     try
     {
         using (UnitOfWork uow = new UnitOfWork())
         {
             SMT_Dashboard_Line_Time_Qty smtDashBoardMaintain = new SMT_Dashboard_Line_Time_Qty();
             SMT_Dashboard_Result smtDashboardResult = new SMT_Dashboard_Result();
             smtDashBoardMaintain.Line = conditicon.line;
             smtDashBoardMaintain.Qty = conditicon.standardOutput;
             smtDashBoardMaintain.DurTime = "08:00--10:00";
             smtDashBoardMaintain.Editor = conditicon.editor;
             smtDashBoardMaintain.Cdt = DateTime.Now;
             smtDashBoardMaintain.Udt = DateTime.Now;
             smtDashboardResult.Line = conditicon.line;
             smtDashboardResult.DurTime = "08:00--10:00";
             SMTDashBoardRep.Insert(smtDashBoardMaintain); // 将数据塞入Maintain 表中
             SMTDashBoardResultRep.Insert(smtDashboardResult);//将Line和时间段塞入 结果表中
             uow.Commit();
             smtDashBoardMaintain.DurTime = "10:00--12:00";
             smtDashboardResult.DurTime = "10:00--12:00";
             SMTDashBoardRep.Insert(smtDashBoardMaintain);
             SMTDashBoardResultRep.Insert(smtDashboardResult);
             uow.Commit();
             smtDashBoardMaintain.DurTime = "12:00--14:00";
             smtDashboardResult.DurTime = "12:00--14:00";
             SMTDashBoardRep.Insert(smtDashBoardMaintain);
             SMTDashBoardResultRep.Insert(smtDashboardResult);
             uow.Commit();
             smtDashBoardMaintain.DurTime = "14:00--16:00";
             smtDashboardResult.DurTime = "14:00--16:00";
             SMTDashBoardRep.Insert(smtDashBoardMaintain);
             SMTDashBoardResultRep.Insert(smtDashboardResult);
             uow.Commit();
             smtDashBoardMaintain.DurTime = "16:00--18:00";
             smtDashboardResult.DurTime = "16:00--18:00";
             SMTDashBoardRep.Insert(smtDashBoardMaintain);
             SMTDashBoardResultRep.Insert(smtDashboardResult);
             uow.Commit();
             smtDashBoardMaintain.DurTime = "18:00--20:30";
             smtDashboardResult.DurTime = "18:00--20:30";
             SMTDashBoardRep.Insert(smtDashBoardMaintain);
             SMTDashBoardResultRep.Insert(smtDashboardResult);
             uow.Commit();
             smtDashBoardMaintain.DurTime = "20:30--22:00";
             smtDashboardResult.DurTime = "20:30--22:00";
             SMTDashBoardRep.Insert(smtDashBoardMaintain);
             SMTDashBoardResultRep.Insert(smtDashboardResult);
             uow.Commit();
             smtDashBoardMaintain.DurTime = "22:00--00:00";
             smtDashboardResult.DurTime = "22:00--00:00";
             SMTDashBoardRep.Insert(smtDashBoardMaintain);
             SMTDashBoardResultRep.Insert(smtDashboardResult);
             uow.Commit();
             smtDashBoardMaintain.DurTime = "00:00--02:00";
             smtDashboardResult.DurTime = "00:00--02:00";
             SMTDashBoardRep.Insert(smtDashBoardMaintain);
             SMTDashBoardResultRep.Insert(smtDashboardResult);
             uow.Commit();
             smtDashBoardMaintain.DurTime = "02:00--04:00";
             smtDashboardResult.DurTime = "02:00--04:00";
             SMTDashBoardRep.Insert(smtDashBoardMaintain);
             SMTDashBoardResultRep.Insert(smtDashboardResult);
             uow.Commit();
             smtDashBoardMaintain.DurTime = "04:00--06:00";
             smtDashboardResult.DurTime = "04:00--06:00";
             SMTDashBoardRep.Insert(smtDashBoardMaintain);
             SMTDashBoardResultRep.Insert(smtDashboardResult);
             uow.Commit();
             smtDashBoardMaintain.DurTime = "06:00--08:00";
             smtDashboardResult.DurTime = "06:00--08:00";
             SMTDashBoardRep.Insert(smtDashBoardMaintain);
             SMTDashBoardResultRep.Insert(smtDashboardResult);
             uow.Commit();
         }
         
     }
     catch (Exception e)
     {
         BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
         throw;
     }
     finally
     {
         BaseLog.LoggingEnd(logger, methodName);
     }
 
 }
Beispiel #10
0
       public IList<SMT_DashBoard_MantainInfo> GetSMTDashBoardLineListById(SMT_DashBoard_MantainInfo condition)
       {
           string methodName = MethodBase.GetCurrentMethod().Name;

           BaseLog.LoggingBegin(logger, methodName);

           IList<SMT_DashBoard_MantainInfo> ret = new List<SMT_DashBoard_MantainInfo>();
           try
           {

               using (UnitOfWork uow = new UnitOfWork())
               {
                       ret = (from SMTDashboard in SMTDashBoardRep.Query()
                              where SMTDashboard.ID ==Convert.ToInt32(condition.id)
                              select new SMT_DashBoard_MantainInfo { id = SMTDashboard.ID, line = SMTDashboard.Line, durTime = SMTDashboard.DurTime, standardOutput = SMTDashboard.Qty }).Distinct().ToList();
                   
               }

               return ret;
           }
           catch (Exception)
           {
               throw;
           }
           finally
           {
               BaseLog.LoggingEnd(logger, methodName);
           }
       }
Beispiel #11
0
       public IList<SMT_DashBoard_MantainInfo> GetSMTDashBoardLineListByCondition(SMT_DashBoard_MantainInfo condition)
       {
           string methodName = MethodBase.GetCurrentMethod().Name;

           BaseLog.LoggingBegin(logger, methodName);

           IList<SMT_DashBoard_MantainInfo> ret = new List<SMT_DashBoard_MantainInfo>();
           try
           {

               using (UnitOfWork uow = new UnitOfWork())
               {
                       ret = (from SMTDashboard in SMTDashBoardRep.Query()
                              where SMTDashboard.Line==condition.line
                              select new SMT_DashBoard_MantainInfo { id = SMTDashboard.ID, line = SMTDashboard.Line, durTime = SMTDashboard.DurTime, standardOutput = SMTDashboard.Qty,editor=SMTDashboard.Editor,StandardOutputCdt=SMTDashboard.Cdt,StandardOutputUdt=SMTDashboard.Udt}).OrderBy(x=>x.line).Distinct().ToList();
               }

               return ret;
           }
           catch (Exception)
           {
               throw;
           }
           finally
           {
               BaseLog.LoggingEnd(logger, methodName);
           }
       }