#if !defined(AFX_SEMIE10RS_H__35A17312_1359_4C7F_814C_8E775AD670BF__INCLUDED_)
#define AFX_SEMIE10RS_H__35A17312_1359_4C7F_814C_8E775AD670BF__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// SemiE10RS.h : header file
//

#include "SemiE10.h"
#include "CombineLot.h"
#include "MyStringArray.h"
#include "afxdao.h"

#ifdef  BUILD_MCCTRDLL
#define     MCCTRDLLCLASS   __declspec(dllexport)
#else
#define     MCCTRDLLCLASS   __declspec(dllimport)
#endif

/////////////////////////////////////////////////////////////////////////////
// CSemiE10RS DAO recordset

class MCCTRDLLCLASS CSemiE10RS : public CDaoRecordset, public CSemiE10
{
public:
//  default constructor
    explicit CSemiE10RS(CDaoDatabase* pDatabase = NULL);
    DECLARE_DYNAMIC(CSemiE10RS)

//  default destructor
//  ~CSemiE10RS();

// Field/Param Data
// {{AFX_FIELD(CSemiE10RS, CDaoRecordset)
    double m_Assist_Time;
    double       m_Engineering_Runs;
    double       m_Equipment_Experiments;
    double       m_Failure_Time;
    double       m_Installation_Modification_Rebuild_Upgrade;
    double       m_Jam;
    CString      m_Lot_Number;
    double       m_No_Material;
    double       m_No_Operator;
    double       m_No_Support_Tool;
    double       m_OffLine_Training;
    double       m_Out_Of_Spec_Input;
    double       m_Preventive_Maintenance;
    double       m_Process_Experiments;
    double       m_Production_Test;
    double       m_Regular_Production;
    double       m_Rework;
    double       m_Scheduled_Change_Of_Consumables_Chemicals;
    double       m_Scheduled_Facilities_Related;
    double       m_Scheduled_Maintenance_Delay;
    double       m_Setup;
    double       m_Shutdown_Startup;
    double       m_Software_Qualification;
    COleDateTime m_Start_Lot_Time;
    double       m_Stop_Machine;
    long         m_Unit_Count;
    double       m_UnScheduled_Change_Of_Consumables_Chemicals;
    double       m_UnScheduled_Facilities_Related;
    double       m_UnScheduled_Maintenance_Delay;
    double       m_Unworked_Shifts_Days;
    double       m_Work_For_3rd_Party;
    long         m_Assist_Count;
    long         m_Failure_Count;
// }}AFX_FIELD

// Overrides
// ClassWizard generated virtual function overrides
// {{AFX_VIRTUAL(CSemiE10RS)
public:
    virtual CString GetDefaultDBName();                      // Default database name
    virtual CString GetDefaultSQL();                         // Default SQL for Recordset
    virtual void    DoFieldExchange(CDaoFieldExchange* pFX); // RFX support
// }}AFX_VIRTUAL

//  Close Recordset and close database
    virtual void Close();

//  set the database record number according to the lot number and lot start time
    StSemiE10 GetLotRecord(CString lpLotNo, CString csLotStartTime);

//  Get combine lot record
    StSemiE10 GetCombineLotRecord(CString lpLotNo);

//  save lot time to database
    void SaveLotInfo(LPCTSTR lpLotNo, LPCTSTR lpLotStartTime);

//  Delete lot record
    void DeleteLotRecord(CString csLotNumber, double dStartDateTime);

//  get all equipment substate field name
    CMyStringArray GetAllFieldName();

//  Get Table Name
    CString GetTableName();

//  record lot no to Lot time info
//  void RecordLotNo(LPCTSTR lpLotNo, LPCTSTR lpCurTime);

private:
//  set ini file key name
    void SetIniKeyName();

//  convert time to 1 decimal places
    void ConvertTo1DecimalPlaces(double &dTime);

    enum
    {
        EQUIP_SUBSTATE_INDEX = 2,
    };

    CCombineLot m_combineLot;

// Implementation
#ifdef _DEBUG
    virtual void AssertValid() const;
    virtual void Dump(CDumpContext& dc) const;
#endif
};

// {{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SEMIE10RS_H__35A17312_1359_4C7F_814C_8E775AD670BF__INCLUDED_)
