Exemplo n.º 1
0
        public bool SaveOutputInfo(EmsMachineOutputInfo oInfo)
        {
            bool ret = false;

            EmsMachineRow mcRow = GetMachine(oInfo.ProcessName, oInfo.MCNo);

            if (mcRow != null)
            {
                //กรณีหากถ้าเคยได้รับการ Register แล้วเก็บไว้ใน Memory แล้ว
                mcRow.CurrentLotNo       = oInfo.CurrentLotNo;
                mcRow.CurrentTotalGood   = oInfo.CurrentTotalGood;
                mcRow.CurrentTotalNG     = oInfo.CurrentTotalNG;
                mcRow.CurrentStandardRPM = oInfo.CurrentStandardRPM;
                mcRow.CutTotalGood       = oInfo.CutTotalGood;
                mcRow.CutTotalNG         = oInfo.CutTotalNG;

                //save to db
                try
                {
                    m_DB.SaveEmsMachineRow(mcRow);
                    ret = true;
                }
                catch (Exception ex)
                {
                    RaiseErrorCatchedEvent("SaveOutputInfo", ex, "SaveEmsMachineRow");
                }
            }



            return(ret);
        }
Exemplo n.º 2
0
        public void SetOutput(string processName, string mcNo, int totalGood, int totalNG)
        {
            EmsMachineOutputInfo oi = TryGetEmsMachine(processName, mcNo);

            if (oi != null)
            {
                oi.CurrentTotalGood = totalGood;
                oi.CurrentTotalNG   = totalNG;
            }
        }
Exemplo n.º 3
0
        public void Remove(string processName, string mcNo)
        {
            EmsMachineOutputInfo oi = GetEmsMachine(processName, mcNo);

            if (oi != null)
            {
                m_ReporterClient.SaveOutputInfo(oi);
                m_MachineDictionary.Remove(mcNo);
            }
        }
Exemplo n.º 4
0
        private EmsMachineOutputInfo GetEmsMachine(string processName, string mcNo)
        {
            EmsMachineOutputInfo oi = null;
            string key = GetMachineUniqueKey(processName, mcNo);

            if (m_MachineDictionary.ContainsKey(key))
            {
                oi = m_MachineDictionary[key];
            }
            return(oi);
        }
Exemplo n.º 5
0
        public void SetCurrentLot(string processName, string mcNo, string lotNo, double standardRpm)
        {
            EmsMachineOutputInfo oi = TryGetEmsMachine(processName, mcNo);

            if (oi != null)
            {
                oi.CurrentLotNo       = lotNo;
                oi.CurrentStandardRPM = standardRpm;
                oi.CurrentTotalGood   = 0;
                oi.CurrentTotalNG     = 0;
                oi.CutTotalGood       = 0;
                oi.CutTotalNG         = 0;

                m_ReporterClient.SaveOutputInfo(oi);
            }
        }
Exemplo n.º 6
0
 private void PrivateRegister(string key, EmsMachineRegisterInfo regInfo)
 {
     try
     {
         //2.) register
         EmsMachineOutputInfo registeredMC = m_ReporterClient.RegisterMachine(regInfo);
         //3.) check exists
         if (m_MachineDictionary.ContainsKey(key))
         {
             m_MachineDictionary.Remove(key);
         }
         m_MachineDictionary.Add(key, registeredMC);
     }
     catch (Exception ex)
     {
         m_Log.Log("PrivateRegister", "RegisterMachine", ex.Message, "");
     }
 }
Exemplo n.º 7
0
        private EmsOutputRecordBLL CaptureOutput(EmsMachineOutputInfo mc)
        {
            if (string.IsNullOrEmpty(mc.CurrentLotNo))
            {
                return(null);
            }

            EmsOutputRecordBLL ret = new EmsOutputRecordBLL();

            ret.LotNo       = mc.CurrentLotNo;
            ret.MCNo        = mc.MCNo;
            ret.ProcessName = mc.ProcessName;
            ret.RohmDate    = DateTime.Now.AddHours(-8).Date;
            ret.StandardRPM = mc.CurrentStandardRPM;
            ret.TotalGood   = mc.CurrentTotalGood - mc.CutTotalGood;
            ret.TotalNG     = mc.CurrentTotalNG - mc.CutTotalNG;

            return(ret);
        }
Exemplo n.º 8
0
        private EmsMachineOutputInfo TryGetEmsMachine(string processName, string mcNo)
        {
            EmsMachineOutputInfo oi = null;
            string key = GetMachineUniqueKey(processName, mcNo);

            if (m_MachineDictionary.ContainsKey(key))
            {
                oi = m_MachineDictionary[key];
            }
            else
            {
                ReRegister(processName, mcNo);
                //check again after re-register
                if (m_MachineDictionary.ContainsKey(key))
                {
                    oi = m_MachineDictionary[key];
                }
            }
            return(oi);
        }
Exemplo n.º 9
0
        public void SetLotEnd(string processName, string mcNo)
        {
            EmsMachineOutputInfo mc = TryGetEmsMachine(processName, mcNo);

            if (mc == null)
            {
                return;
            }

            EmsOutputRecordBLL co = CaptureOutput(mc);

            mc.CurrentLotNo       = ""; //clear Lot
            mc.CurrentStandardRPM = 0;
            mc.CurrentTotalGood   = 0;
            mc.CurrentTotalNG     = 0;
            mc.CutTotalGood       = 0;
            mc.CutTotalNG         = 0;

            try
            {
                m_ReporterClient.ReportOutput(co);
            }
            catch (Exception ex)
            {
                m_Log.Log("SetLotEnd", "ReportOutput", ex.Message, "");
            }

            try
            {
                m_ReporterClient.SaveOutputInfo(mc);
            }
            catch (Exception ex)
            {
                m_Log.Log("SetLotEnd", "SaveOutputInfo", ex.Message, "");
            }
        }
Exemplo n.º 10
0
        //ใช้ในการสอบถามข้อมูล OutputInfo ล่าสุดที่ทำการบันทึกไว้ในฐานข้อมูล
        public EmsMachineOutputInfo RegisterMachine(EmsMachineRegisterInfo regInfo)
        {
            EmsMachineOutputInfo ret = null;
            EmsMachineRow        mc  = null;
            string key = GetMachineUniqueKey(regInfo.ProcessName, regInfo.MCNo);

            mc = GetMachine(regInfo.ProcessName, regInfo.MCNo);

            if (mc != null)
            {
                mc.AreaName = regInfo.AreaName;

                if (mc.CurrentLotNo != regInfo.CurrentLotNo)
                {
                    mc.CurrentLotNo       = regInfo.CurrentLotNo;
                    mc.CurrentStandardRPM = regInfo.CurrentStandardRPM;
                    mc.CutTotalGood       = regInfo.CutTotalGood; //always 0
                    mc.CutTotalNG         = regInfo.CutTotalNG;   //always 0
                }
                else
                {
                    mc.CurrentTotalGood = regInfo.CurrentTotalGood;
                    mc.CurrentTotalNG   = regInfo.CurrentTotalNG;
                }
            }
            else
            {
                try
                {
                    mc = new EmsMachineRow();
                    //add to data base
                    mc.ID                          = -1;
                    mc.MCNo                        = regInfo.MCNo;
                    mc.RegisteredDate              = DateTime.Now;
                    mc.CurrentActivityName         = "";
                    mc.CurrentActivityCategoryName = "";
                    mc.AreaName                    = regInfo.AreaName;
                    mc.ProcessName                 = regInfo.ProcessName;
                    mc.MachineTypeName             = regInfo.MachineTypeName;
                    mc.CurrentLotNo                = regInfo.CurrentLotNo;
                    mc.CurrentTotalGood            = regInfo.CurrentTotalGood;
                    mc.CurrentTotalNG              = regInfo.CurrentTotalNG;
                    mc.CurrentStandardRPM          = regInfo.CurrentStandardRPM;
                    mc.LastUpdateDate              = DateTime.Now;
                    mc.CutTotalGood                = regInfo.CutTotalGood;
                    mc.CutTotalNG                  = regInfo.CutTotalNG;
                    mc.ActivityChangeTime          = DateTime.Now;
                    mc.AlarmCount                  = 0;
                    mc.BMCount                     = 0;
                    m_MachineList.Add(key, mc);
                }
                catch (Exception ex)
                {
                    RaiseErrorCatchedEvent("RegisterMachine-001", ex, "");
                }
            }

            int aff = m_DB.SaveEmsMachineRow(mc);

            ret = new EmsMachineOutputInfo(mc);

            return(ret);
        }
Exemplo n.º 11
0
 public bool SaveOutputInfo(EmsMachineOutputInfo mc)
 {
     return(base.Channel.SaveOutputInfo(mc));
 }