//-------------------------------------------------------------------------------------------------//

        public bool GetCounts(int[] counts)
        {
            const string STRLOG_MethodName = "GetCounts";

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName);

            bool success = true;

            try
            {
                //
                // Write the command
                //
                byte[] readData = WriteReadData(new byte[] { CMD_ReadCounts }, 1, DATALEN_CMD_Read);
                if (readData == null || readData.Length != DATALEN_CMD_Read || readData[0] != CMD_ReadCounts)
                {
                    throw new Exception(STRERR_FailedToReadCounts);
                }

                //
                // Extract count value from byte array
                //
                for (int i = 1; i < DATALEN_CMD_Read; i++)
                {
                    counts[0] = counts[0] * 256 + (int)readData[i];
                }
            }
            catch (Exception ex)
            {
                success        = false;
                this.lastError = ex.Message;
            }

            string logMessage = counts.ToString();

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName, logMessage);

            return(success);
        }
Exemplo n.º 2
0
        public string GetLabInfo()
        {
            const string STRLOG_MethodName = "GetLabInfo";

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName);

            string labInfo = null;

            // Get the identity of the caller
            string sbName = GetCallerName(authHeader);

            // Check caller access is authorised
            if (sbName != null)
            {
                // Pass on to experiment manager
                labInfo = Global.experimentManager.GetLabInfo();
            }

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName);

            return(labInfo);
        }
        public List <EmployeeAttendance> GetEmployeeAttendances(DateTime date)
        {
            List <EmployeeAttendance> employeeAttendances = new List <EmployeeAttendance>();

            try
            {
                DataTable     dt            = new DataTable();
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append(@"
 select distinct  e.Code,e.Name, e.Dept, z.Name as DeptName, z.Manager from ZlEmployee e
 left join ZlDept z on e.Dept = z.Code
  left join Kq_Source s on e.ID = s.EmpID
 left join Kq_PaiBan p on e.ID = p.EmpID 
 where  (e.Dept not like '%999%' and e.Dept not like '%888%') and e.State = '0' and 
e.ID  in (select distinct EmpID from Kq_Source where 1=1 ");
                stringBuilder.Append(" and cast(FDateTime as date)  = cast( '" + date.ToString("yyyyMMdd") + "' as date ) ");
                stringBuilder.Append(" and convert(char(5), FDateTime, 108) >='00:00:01'  and convert(char(5), FDateTime, 108) < '23:59:59' and EmpID is not null ) ");
                // stringBuilder.Append("  and p.SessionID = (select max(SessionID) from Kq_PaiBan b right join ZlEmployee a on b.EmpID = a.ID) ");
                SqlHRFinger sqlHR = new SqlHRFinger();
                sqlHR.sqlDataAdapterFillDatatable(stringBuilder.ToString(), ref dt);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    employeeAttendances.Add(new EmployeeAttendance
                    {
                        Date     = date.ToString("dd.MM.yyyy"),
                        EmpCode  = dt.Rows[i]["Code"].ToString(),
                        EmpName  = dt.Rows[i]["Name"].ToString(),
                        DeptCode = dt.Rows[i]["Dept"].ToString(),
                        Dept     = dt.Rows[i]["DeptName"].ToString(),
                        Manager  = dt.Rows[i]["Manager"].ToString()
                    });
                }
            }
            catch (Exception ex)
            {
                Logfile.Output(StatusLog.Error, "GetEmployeeAttendances(DateTime date)", ex.Message);
            }
            return(employeeAttendances);
        }
Exemplo n.º 4
0
        public string GetLabConfiguration(string userGroup)
        {
            const string STRLOG_MethodName = "GetLabConfiguration";

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName);

            string xmlLabConfiguration = null;

            // Get the identity of the caller
            string sbName = GetCallerName(authHeader);

            // Check caller access is authorised
            if (sbName != null)
            {
                // Pass on to experiment manager
                xmlLabConfiguration = Global.experimentManager.GetLabConfiguration(userGroup);
            }

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName);

            return(xmlLabConfiguration);
        }
Exemplo n.º 5
0
        //-------------------------------------------------------------------------------------------------//

        public bool CloseConnection()
        {
            const string STRLOG_MethodName = "CloseConnection";

            Logfile.WriteCalled(this.logLevel, STRLOG_ClassName, STRLOG_MethodName);

            bool success = false;

            this.lastError = null;

            if (this.tcpClient != null)
            {
                try
                {
                    NetworkStream networkStream = this.tcpClient.GetStream();
                    if (networkStream != null)
                    {
                        networkStream.Close();
                    }
                    this.tcpClient.Close();
                    this.tcpClient = null;

                    success = true;
                }
                catch (Exception ex)
                {
                    this.lastError = ex.Message;
                    Logfile.WriteError(ex.Message);
                }
            }

            this.connectionOpen = false;

            string logMessage = STRLOG_Success + success.ToString();

            Logfile.WriteCompleted(this.logLevel, STRLOG_ClassName, STRLOG_MethodName, logMessage);

            return(success);
        }
Exemplo n.º 6
0
        //-------------------------------------------------------------------------------------------------//

        public void StopDrive()
        {
            const string STRLOG_MethodName = "StopDrive";

            Logfile.WriteCalled(this.logLevel, STRLOG_ClassName, STRLOG_MethodName);
            Trace.WriteLine(STRLOG_MethodName);

            string logMessage = string.Empty;

            try
            {
                ushort[] regs = new ushort[2] {
                    0x08a1, 0x1000
                };

                int value = (regs[1] << 16) | regs[0];
                logMessage += STRLOG_Register + REGADDR_RW_AC_ControlWord.ToString();
                logMessage += STRLOG_WritingHex + value.ToString("X8");

                // Write to register
                this.master.WriteMultipleRegisters(REGADDR_RW_AC_ControlWord, regs);

                // Read back register
                ushort[] inregs = this.master.ReadHoldingRegisters(REGADDR_RW_AC_ControlWord, (ushort)2);
                value       = (inregs[1] << 16) | inregs[0];
                logMessage += STRLOG_ReadingHex + value.ToString("X8");

                Logfile.Write(this.logLevel, logMessage);
                Trace.WriteLine(logMessage);

                WaitDelay(DELAY_StopDrive);
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.Message);
                throw (e);
            }
        }
        //---------------------------------------------------------------------------------------//

        protected void ReceiveData(byte[] data, int dataLength)
        {
            ReceiveDataInfo rdi = this.receiveDataInfo;

            try
            {
                //
                // Copy all of the data to the receive buffer
                //
                Array.Copy(data, 0, rdi.receiveBuffer, rdi.bufferIndex, dataLength);
                rdi.bytesRead   += dataLength;
                rdi.bufferIndex += dataLength;

                //
                // Check if all of the expected data has been read
                //
                if (rdi.bytesRead >= rdi.expectedPacketLength)
                {
                    //
                    // The buffer has at least as many bytes for this packet
                    //
                    this.responsePacket = new byte[rdi.expectedPacketLength];
                    Array.Copy(rdi.receiveBuffer, 0, this.responsePacket, 0, rdi.expectedPacketLength);

                    //
                    // Signal the waiting thread that the data has been received
                    //
                    lock (responseSignal)
                    {
                        Monitor.Pulse(responseSignal);
                    }
                }
            }
            catch (Exception ex)
            {
                Logfile.WriteError(ex.Message);
            }
        }
Exemplo n.º 8
0
        //-------------------------------------------------------------------------------------------------//

        public bool ChangeSpeed(double speed, bool verify)
        {
            const string STRLOG_MethodName = "ChangeSpeed";

            string logMessage = STRLOG_Speed + speed.ToString();

            Logfile.WriteCalled(this.logLevel, STRLOG_ClassName, STRLOG_MethodName, logMessage);

            bool   success;
            double actualSpeed = 0;

            if ((success = this.SetEngValue(ModbusRegs_Holding_RW.DCControlSpeed, speed, DELAY_ChangeSpeed)) == true)
            {
                //
                // Update speed setpoint
                //
                this.speedSetpoint = speed;

                if (verify == true)
                {
                    //
                    // Check that the speed has changed to the desired value
                    //
                    string units = String.Empty;
                    if ((success = this.GetSpeed(ref actualSpeed, ref units)) == true)
                    {
                        success = (actualSpeed > speed - 5 && actualSpeed < speed + 5);
                    }
                }
            }

            logMessage = STRLOG_Success + success.ToString() +
                         Logfile.STRLOG_Spacer + STRLOG_Speed + ((int)actualSpeed).ToString();

            Logfile.WriteCompleted(this.logLevel, STRLOG_ClassName, STRLOG_MethodName, logMessage);

            return(success);
        }
        //
        // YOUR CODE HERE
        //

        #endregion

        //-------------------------------------------------------------------------------------------------//

        public Specification(Configuration configuration, EquipmentService equipmentServiceProxy)
            : base(configuration, equipmentServiceProxy)
        {
            const string STRLOG_MethodName = "Specification";

            Logfile.WriteCalled(null, STRLOG_MethodName);

            //
            // Save these for use by the Parse() method
            //
            this.configuration = configuration;

            //
            // Check that the specification template is valid. This is used by the LabClient to submit
            // the experiment specification to the LabServer for execution.
            //
            try
            {
                //
                // Check that all required XML nodes exist
                //
                //
                // YOUR CODE HERE
                //

                //
                // Create an instance fo the Validation class
                //
                this.validation = new Validation(configuration);
            }
            catch (Exception ex)
            {
                Logfile.WriteError(ex.Message);
                throw;
            }

            Logfile.WriteCompleted(null, STRLOG_MethodName);
        }
        //-------------------------------------------------------------------------------------------------//

        public bool Cancel(int experimentId, string sbName)
        {
            const string STRLOG_MethodName = "Cancel";

            string logMessage = STRLOG_experimentId + experimentId.ToString() +
                                Logfile.STRLOG_Spacer + STRLOG_sbName + Logfile.STRLOG_Quote + sbName + Logfile.STRLOG_Quote +
                                Logfile.STRLOG_Spacer + STRLOG_unitId + unitId.ToString();

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName, logMessage);

            bool success = false;

            //
            // Check if an experiment is currently running
            //
            lock (this.statusLock)
            {
                if (this.labExperimentInfo != null)
                {
                    //
                    // An experiment is currently running, check if it is this one
                    //
                    if (this.labExperimentInfo.experimentInfo.experimentId == experimentId &&
                        sbName != null && sbName.Equals(this.labExperimentInfo.experimentInfo.sbName, StringComparison.OrdinalIgnoreCase))
                    {
                        // Cancel the experiment
                        this.labExperimentInfo.cancelExperiment.Cancel();
                        success = true;
                    }
                }
            }

            logMessage = STRLOG_success + success.ToString();

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName, logMessage);

            return(success);
        }
Exemplo n.º 11
0
        //-------------------------------------------------------------------------------------------------//

        /// <summary>
        /// Dispose(bool disposing) executes in two distinct scenarios:
        /// 1. If disposing equals true, the method has been called directly or indirectly by a user's code.
        ///    Managed and unmanaged resources can be disposed.
        /// 2. If disposing equals false, the method has been called by the runtime from inside the finalizer
        ///    and you should not reference other objects. Only unmanaged resources can be disposed.
        /// </summary>
        /// <param name="disposing"></param>
        protected virtual void Dispose(bool disposing)
        {
            const string STRLOG_MethodName = "Dispose";

            string logMessage = STRLOG_disposing + disposing.ToString() +
                                Logfile.STRLOG_Spacer + STRLOG_disposed + this.disposed.ToString();

            Logfile.WriteCalled(this.logLevel, STRLOG_ClassName, STRLOG_MethodName, logMessage);

            //
            // Check to see if Dispose has already been called
            //
            if (this.disposed == false)
            {
                //
                // If disposing equals true, dispose all managed and unmanaged resources.
                //
                if (disposing == true)
                {
                    // Dispose managed resources here. Anything that has a Dispose() method.
                }

                //
                // Release unmanaged resources here. If disposing is false, only the following
                // code is executed.
                //

                if (this.reportRunning == true)
                {
                    this.reportRunning = false;
                    this.reportThread.Join();
                }

                this.disposed = true;
            }

            Logfile.WriteCompleted(this.logLevel, STRLOG_ClassName, STRLOG_MethodName);
        }
Exemplo n.º 12
0
        //-------------------------------------------------------------------------------------------------//

        public DriverMachine(XmlNode xmlNodeEquipmentConfig, Specification specification)
            : base(xmlNodeEquipmentConfig, specification)
        {
            const string STRLOG_MethodName = "DriverMachine";

            Logfile.WriteCalled(null, STRLOG_MethodName);

            try
            {
                //
                // Initialise static variables
                //
                if (DriverMachine.firstInstance == true)
                {
                    DriverMachine.dcDriveInstance = new DCDrive(xmlNodeEquipmentConfig, KeepAlive);
                    DriverMachine.plcInstance     = new PLC(xmlNodeEquipmentConfig, KeepAlive);
                    DriverMachine.initialiseDelay = DriverMachine.dcDriveInstance.InitialiseDelay + DriverMachine.plcInstance.InitialiseDelay;
                    DriverMachine.statusMessage   = STRLOG_PLC + STRLOG_NotInitialised + STRLOG_DCDrive + STRLOG_NotInitialised;
                    DriverMachine.firstInstance   = false;
                }

                //
                // Provide access to the instances
                //
                this.dcDrive = dcDriveInstance;
                this.plc     = plcInstance;
            }
            catch (Exception ex)
            {
                //
                // Log the message and throw the exception back to the caller
                //
                Logfile.WriteError(ex.Message);
                throw;
            }

            Logfile.WriteCompleted(null, STRLOG_MethodName);
        }
Exemplo n.º 13
0
        //-------------------------------------------------------------------------------------------------//

        public void SetMainContactorOn()
        {
            const string STRLOG_MethodName = "SetMainContactorOn";

            Logfile.WriteCalled(this.logLevel, STRLOG_ClassName, STRLOG_MethodName);
            Trace.WriteLine(STRLOG_MethodName);

            string logMessage = string.Empty;

            try
            {
                ushort[] regs = new ushort[1] {
                    0x0477
                };

                int value = regs[0];
                logMessage += STRLOG_Register + REGADDR_RW_DC_ControlWord.ToString();
                logMessage += STRLOG_WritingHex + value.ToString("X4");

                // Write to register
                this.master.WriteMultipleRegisters(REGADDR_RW_DC_ControlWord, regs);

                // Read back register
                ushort[] inregs = this.master.ReadHoldingRegisters(REGADDR_RW_DC_ControlWord, (ushort)1);
                value       = inregs[0];
                logMessage += STRLOG_ReadingHex + value.ToString("X4");

                Logfile.Write(this.logLevel, logMessage);
                Trace.WriteLine(logMessage);

                WaitDelay(DELAY_SetMainContactorOn);
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.Message);
                throw (e);
            }
        }
Exemplo n.º 14
0
        //-------------------------------------------------------------------------------------------------//

        public bool OpenConnection()
        {
            const string STRLOG_MethodName = "OpenConnection";

            Logfile.WriteCalled(this.logLevel, STRLOG_ClassName, STRLOG_MethodName);

            bool success = false;

            this.lastError = null;

            try
            {
                //
                // Open a connection to the specified IP address and port number
                //
                this.tcpClient = new TcpClient(this.ipaddr, this.ipport);
                success        = true;
            }
            catch (Exception ex)
            {
                Logfile.WriteError(ex.Message);
                this.lastError = STRERR_UnableToOpenNetworkConnection + this.ipaddr + ":" + this.ipport.ToString();
            }

            if (success == true)
            {
                this.tcpClient.ReceiveTimeout = this.receiveTimeout;
                this.modbusIpMaster           = ModbusIpMaster.CreateTcp(tcpClient);
            }

            this.connectionOpen = success;

            string logMessage = STRLOG_Success + success.ToString();

            Logfile.WriteCompleted(this.logLevel, STRLOG_ClassName, STRLOG_MethodName, logMessage);

            return(success);
        }
        //---------------------------------------------------------------------------------------//

        private bool Authorised(AuthHeader authHeader)
        {
            bool ok = true;

            if (Global.allowedCallers.IsAuthenticating == true)
            {
                //
                // Check if caller is specified
                //
                if (authHeader == null || authHeader.identifier == null || authHeader.passKey == null)
                {
                    // Caller is not specified
                    ok = false;
                    Logfile.Write(STRLOG_AccessDenied);
                }

                //
                // Check if access is authorised for this caller
                //
                else
                {
                    // Get the caller's name
                    string lsName = Global.allowedCallers.Authentication(authHeader.identifier, authHeader.passKey);

                    //
                    // Check if caller is allowed access to this web service
                    //
                    if (lsName == null)
                    {
                        // Caller is not allowed access to this Web Method
                        ok = false;
                        Logfile.Write(STRLOG_UnauthorisedAccess);
                    }
                }
            }

            return(ok);
        }
Exemplo n.º 16
0
        //-------------------------------------------------------------------------------------------------//

        public ExperimentResult(Configuration configuration)
            : base(configuration)
        {
            try
            {
                //
                // Check that all required XML nodes exist
                //
                XmlUtilities.GetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_sourceName, true);
                XmlUtilities.GetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_absorberName, true);
                XmlUtilities.GetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_distance, true);
                XmlUtilities.GetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_duration, true);
                XmlUtilities.GetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_repeat, true);
                XmlUtilities.GetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_dataType, true);
                XmlUtilities.GetXmlValue(this.xmlNodeExperimentResult, Consts.STRXML_dataVector, true);
            }
            catch (Exception ex)
            {
                // Log the message and throw the exception back to the caller
                Logfile.WriteError(ex.Message);
                throw;
            }
        }
Exemplo n.º 17
0
        //-------------------------------------------------------------------------------------------------//

        public Hardware()
        {
            const string STRLOG_MethodName = "Hardware";

            Logfile.WriteCalled(null, STRLOG_MethodName);

            //
            // Initialise local variables
            //
            this.disposed    = false;
            this.initialised = false;
            this.lastError   = null;

            //
            // Initialise properties
            //
            this.online        = false;
            this.statusMessage = STRLOG_NotInitialised;

            //
            // YOUR CODE HERE
            //
        }
Exemplo n.º 18
0
        public bool ExportReportProductionDaiLy(PeriodProduction period)
        {
            try
            {
                DefectRateReport defectRateReport = new DefectRateReport();

                List <DefectRateData> defectRateDatas = new List <DefectRateData>();
                defectRateDatas = defectRateReport.GetListDefectRateReportAmountOfTimeDaily("B01", "0010", period);

                if (defectRateDatas.Count == 0)
                {
                    return(false);
                }
                Log.ExportExcelTool exportExcel = new Log.ExportExcelTool();
                exportExcel.ExportToTemplateMQCDefectDaily(pathDaily, @"C:\ERP_Temp\MQC_Daily_Report" + "-" + DateTime.Now.ToString("yyyyMMdd hhmmss") + ".xlsx", defectRateDatas);
                return(true);
            }
            catch (Exception ex)
            {
                Logfile.Output(StatusLog.Error, "ExportReportProductionDaiLy()", ex.Message);
                return(false);
            }
        }
Exemplo n.º 19
0
        //-------------------------------------------------------------------------------------------------//

        /// <summary>
        /// Signal the waiting thread that experiment has been submitted and is ready for execution.
        /// </summary>
        public bool SignalSubmitted()
        {
            const string STRLOG_MethodName = "SignalSubmitted";

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName);

            bool success = false;

            if (this.disposed == false)
            {
                // Signal waiting thread
                lock (this.signalSubmitted)
                {
                    Monitor.Pulse(this.signalSubmitted);
                }

                success = true;
            }

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName);

            return(success);
        }
        public int GetTimeUntilReady()
        {
            const string STRLOG_MethodName = "GetTimeUntilReady";

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName);

            int timeUntilReady = -1;

            //
            // Check caller access is authorised
            //
            if (Authorised(authHeader) == true)
            {
                // Pass on to the equipment engine
                timeUntilReady = Global.equipmentManager.GetTimeUntilReady();
            }

            string logMessage = timeUntilReady.ToString();

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName, logMessage);

            return(timeUntilReady);
        }
Exemplo n.º 21
0
        //-------------------------------------------------------------------------------------------------//

        public int GetExecutionTime(string xmlSpecification)
        {
            int executionTime = -1;

            try
            {
                //
                // Parse the XML specification string
                //
                Specification    specification    = new Specification(this.xmlNodeEquipmentConfig);
                ValidationReport validationReport = specification.Parse(xmlSpecification);
                if (validationReport.accepted == true)
                {
                    executionTime = (int)validationReport.estRuntime;
                }
            }
            catch (Exception ex)
            {
                Logfile.WriteError(ex.Message);
            }

            return(executionTime);
        }
Exemplo n.º 22
0
        //---------------------------------------------------------------------------------------//

        /// <summary>
        /// Initialise the equipment after it has been powered up.
        /// </summary>
        /// <returns>True if successful.</returns>
        public override bool InitialiseEquipment()
        {
            const string STRLOG_MethodName = "InitialiseEquipment";

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName);

            bool success = false;

            try
            {
                success = this.driverMachine.Initialise();
            }
            catch (Exception ex)
            {
                Logfile.WriteError(ex.Message);
            }

            string logMessage = STRLOG_Success + success.ToString();

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName, logMessage);

            return(success);
        }
Exemplo n.º 23
0
        //-------------------------------------------------------------------------------------------------//

        private string BuildAppletParams(ResultInfo resultInfo)
        {
            string strAppletParams = string.Empty;

            try
            {
                StringWriter sw = new StringWriter();

                // Experiment specification
                sw.Write(labResults.CreateSpecificationString(resultInfo, STR_SwAppletArgument));

                // Experiment results
                sw.Write(labResults.CreateResultsString(resultInfo, STR_SwAppletArgument));

                strAppletParams = sw.ToString();
            }
            catch (Exception ex)
            {
                Logfile.WriteError(ex.Message);
            }

            return(strAppletParams);
        }
Exemplo n.º 24
0
        //-------------------------------------------------------------------------------------------------//

        public FlexMotionNone(XmlNode xmlNodeEquipmentConfig)
            : base(xmlNodeEquipmentConfig)
        {
            const string STRLOG_MethodName = "FlexMotionNone";

            Logfile.WriteCalled(null, STRLOG_MethodName);

            //
            // Initialise properties
            //
            //this.powerupDelay = 0;
            this.initialiseDelay = 0;

            //
            // Initialise the flexmotion controller
            //
            if (this.Initialise() == false)
            {
                throw new Exception(STRERR_FailedToInitialise);
            }

            Logfile.WriteCompleted(null, STRLOG_MethodName);
        }
Exemplo n.º 25
0
 public bool ExportReportProductionWeekly()
 {
     try
     {
         DefectRateReport defectRateReport = new DefectRateReport();
         DateTime         date_from        = Class.DateTimeControl.StartOfWeek(DayOfWeek.Monday);
         DateTime         date_to          = DateTime.Today.AddDays(-(int)DateTime.Today.DayOfWeek + 7);
         DefectRateData   defectRateData   = new DefectRateData();
         defectRateData = defectRateReport.GetDefectRateReportAmountOfTime(date_from, date_to, "B01", "0010");
         if (defectRateData.TotalQuantity == 0)
         {
             return(false);
         }
         Log.ExportExcelTool exportExcel = new Log.ExportExcelTool();
         exportExcel.ExportToTemplateMQCDefectAmountOfTime(date_from, date_to, pathMonth, @"C:\ERP_Temp\MQC_Weekly_Report" + "-" + DateTime.Now.ToString("yyyyMMdd hhmmss") + ".xlsx", defectRateData);
         return(true);
     }
     catch (Exception ex)
     {
         Logfile.Output(StatusLog.Error, "ExportReportProductionDaiLy()", ex.Message);
         return(false);
     }
 }
Exemplo n.º 26
0
 public bool ExportReportProductionMonthly()
 {
     try
     {
         DefectRateReport defectRateReport = new DefectRateReport();
         DateTime         date_from        = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
         DateTime         date_to          = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month));
         DefectRateData   defectRateData   = new DefectRateData();
         defectRateData = defectRateReport.GetDefectRateReportAmountOfTime(date_from, date_to, "B01", "0010");
         if (defectRateData.TotalQuantity == 0)
         {
             return(false);
         }
         Log.ExportExcelTool exportExcel = new Log.ExportExcelTool();
         exportExcel.ExportToTemplateMQCDefectAmountOfTime(date_from, date_to, pathMonth, @"C:\ERP_Temp\MQC_Monthly_Report" + "-" + DateTime.Now.ToString("yyyyMMdd hhmmss") + ".xlsx", defectRateData);
         return(true);
     }
     catch (Exception ex)
     {
         Logfile.Output(StatusLog.Error, "ExportReportProductionDaiLy()", ex.Message);
         return(false);
     }
 }
        public bool ResumePowerdown()
        {
            const string STRLOG_MethodName = "ResumePowerdown";

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName);

            bool success = false;

            //
            // Check caller access is authorised
            //
            if (Authorised(authHeader) == true)
            {
                // Pass on to the equipment engine
                success = Global.equipmentManager.ResumePowerdown();
            }

            string logMessage = success.ToString();

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName, logMessage);

            return(success);
        }
Exemplo n.º 28
0
        //-------------------------------------------------------------------------------------------------//

        public Result(string xmlExperimentResult)
            : base(xmlExperimentResult, new ResultInfo())
        {
            ResultInfo resultInfo = (ResultInfo)this.experimentResultInfo;

            //
            // Parse the experiment result
            //
            try
            {
                //
                // Extract result values from the XML experiment result string and place into ResultInfo
                //
                resultInfo.voltage     = (float)XmlUtilities.GetRealValue(this.xmlNodeExperimentResult, LabConsts.STRXML_voltage, 0);
                resultInfo.current     = (float)XmlUtilities.GetRealValue(this.xmlNodeExperimentResult, LabConsts.STRXML_current, 0);
                resultInfo.powerFactor = (float)XmlUtilities.GetRealValue(this.xmlNodeExperimentResult, LabConsts.STRXML_powerFactor, 0);
                resultInfo.speed       = XmlUtilities.GetIntValue(this.xmlNodeExperimentResult, LabConsts.STRXML_speed, 0);
            }
            catch (Exception ex)
            {
                Logfile.WriteError(ex.Message);
            }
        }
Exemplo n.º 29
0
        //-------------------------------------------------------------------------------------------------//

        public PowerMeter(ModbusIpMaster master)
        {
            const string STRLOG_MethodName = "PowerMeter";

            Logfile.WriteCalled(null, STRLOG_MethodName);

            this.master = master;

            //
            // Determine the logging level for this class
            //
            try
            {
                this.logLevel = (Logfile.LoggingLevels)Utilities.GetIntAppSetting(STRLOG_ClassName);
            }
            catch
            {
                this.logLevel = Logfile.LoggingLevels.Minimum;
            }
            Logfile.Write(Logfile.STRLOG_LogLevel + this.logLevel.ToString());

            Logfile.WriteCompleted(null, STRLOG_MethodName);
        }
Exemplo n.º 30
0
        //-------------------------------------------------------------------------------------------------//

        public virtual void Create()
        {
            const string STRLOG_MethodName = "Create";

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName);

            //
            // Create local class instances just to check that all is in order
            //
            ExperimentSpecification experimentSpecification = new ExperimentSpecification(this.appData.labConfiguration, null);
            LabExperimentResult     labExperimentResult     = new LabExperimentResult(this.appData.labConfiguration);

            //
            // Create instances of lab experiment engines
            //
            this.appData.labExperimentEngines = new LabExperimentEngine[this.appData.farmSize];
            for (int i = 0; i < this.appData.farmSize; i++)
            {
                this.appData.labExperimentEngines[i] = new LabExperimentEngine(i, this.appData);
            }

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName);
        }