Example #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            Session session = CurrentSession;
            var CurrentMB = (MB)session.GetValue(Session.SessionKeys.MB);
            string moNo = CurrentMB.SMTMO;
            string model = CurrentMB.Model;
            string custSn = string.Empty;
            string custVer = string.Empty;
            string cvsn = string.Empty;
            string uuid = string.Empty;

            bool IsRCTO = false;
            if (session.GetValue(Session.SessionKeys.IsRCTO) != null)
            {
                IsRCTO = (bool)session.GetValue(Session.SessionKeys.IsRCTO);
            }
            string CheckCode = session.GetValue(Session.SessionKeys.CheckCode) as string;

            string dateCode = session.GetValue(Session.SessionKeys.DCode) as string;
            string ecr = session.GetValue(Session.SessionKeys.ECR) as string;
            string iecVer = session.GetValue(Session.SessionKeys.IECVersion) as string;

            var MACList = (IList<string>)session.GetValue(Session.SessionKeys.MACList);
            var MBCTList = (IList<string>)session.GetValue(Session.SessionKeys.MBCTList);
            var EEPList = (IList<string>)session.GetValue(Session.SessionKeys.EEPList);

            var NewMBSnList = session.GetValue(Session.SessionKeys.MBNOList) as List<string>;

            var MBNOList = session.GetValue(Session.SessionKeys.MBNOList) as List<string>;
            if (IsRCTO && CheckCode !="R") {
                MBNOList = session.GetValue(Session.SessionKeys.RCTOChildMBSnList) as List<string>;
            }
            var MBObjectList = new List<IMB>();
            session.AddValue(Session.SessionKeys.MBList, MBObjectList);

            IMBRepository mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();

            IPrintLogRepository LogRepository = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>();
            bool hasPCBVer = false;
            if (session.GetValue(ExtendSession.SessionKeys.HasPCBVer) != null)
            {
                hasPCBVer = (bool)session.GetValue(ExtendSession.SessionKeys.HasPCBVer);
                if (hasPCBVer)
                {
                    custVer = (string)session.GetValue(ExtendSession.SessionKeys.PCBVer);
                }
            }
            for (int i = 0; i < MBNOList.Count; i++)
            {

                string mac = string.Empty;
                if (MACList != null)
                {
                    mac = MACList[i];
                }
                MB mb = new MB(MBNOList[i], moNo, custSn, model, dateCode, mac, uuid, ecr, iecVer, custVer, cvsn, DateTime.Now, DateTime.Now);
                MBStatus mbStatus = new MBStatus(MBNOList[i], this.Station, MBStatusEnum.Pass, this.Editor, this.Line, DateTime.Now, DateTime.Now);
                mb.MBStatus = mbStatus;

                if (IsRCTO && CheckCode != "R")
                {
                    IMES.FisObject.PCA.MB.MBInfo RCTOChangeInfo = new IMES.FisObject.PCA.MB.MBInfo(0, mb.Sn, "RCTOChange", NewMBSnList[i], Editor, DateTime.Now, DateTime.Now);
                    mb.AddMBInfo(RCTOChangeInfo);
                }

                if (EEPList != null)
                {
                    IMES.FisObject.PCA.MB.MBInfo eepInfo = new IMES.FisObject.PCA.MB.MBInfo(0, mb.Sn, "EEPROM", EEPList[i], Editor, DateTime.Now, DateTime.Now);
                    mb.AddMBInfo(eepInfo);
                }

                if (MBCTList != null)
                {
                    IMES.FisObject.PCA.MB.MBInfo mbctInfo = new IMES.FisObject.PCA.MB.MBInfo(0, mb.Sn, "MBCT", MBCTList[i], Editor, DateTime.Now, DateTime.Now);
                    mb.AddMBInfo(mbctInfo);
                    FruDetInfo newFruDet = new FruDetInfo();
                    newFruDet.sno = MBCTList[i];
                    newFruDet.snoId = mb.Sn;
                    newFruDet.tp = "VC";
                    newFruDet.editor = Editor;
                    newFruDet.cdt = DateTime.Now;
                    newFruDet.udt = newFruDet.cdt;
                    mbRepository.InsertFruDetInfoDefered(session.UnitOfWork, newFruDet);

                    MBLog newCTLog = new MBLog(0, mb.Sn, mb.Model, "SH", 1, "SA SHIPPING LABEL", Editor, DateTime.Now);
                    mb.AddLog(newCTLog);
                }

                if (session.GetValue("IsPilotMOCheck") != null && (bool)session.GetValue("IsPilotMOCheck"))
                {
                    string pilotmo = (string)session.GetValue(Session.SessionKeys.PilotMoNo);
                    mb.SetExtendedProperty(ConstName.PCBInfo.PilotMo, pilotmo, this.Editor);                    
                }
                mb.SetExtendedProperty(ConstName.PCBInfo.ParentMBSN, mb.Sn, this.Editor);
               

                MBLog newLog = new MBLog(0, mb.Sn, mb.Model, Station, 1, Line, Editor, DateTime.Now);
                mb.AddLog(newLog);
                mbRepository.Add(mb, session.UnitOfWork);
                MBObjectList.Add(mb);

                var item = new PrintLog
                {
                    Name = session.GetValue(Session.SessionKeys.PrintLogName).ToString(),
                    BeginNo = MBNOList[i],
                    EndNo = MBNOList[i],
                    Descr = session.GetValue(Session.SessionKeys.PrintLogDescr).ToString(),
                    Editor = this.Editor
                };
                LogRepository.Add(item, session.UnitOfWork);
                
                IMES.FisObject.PCA.MB.MBInfo items = new IMES.FisObject.PCA.MB.MBInfo();
                items.InfoType = ConstName.PCBInfo.ChildMBSN;
                items.InfoValue = mb.Sn;
                items.Editor = this.Editor;
                CurrentMB.AddMBInfo(items);
            }

            return base.DoExecute(executionContext);
        }
Example #2
0
        /// <summary>
        /// a.  生成 MBSno,  b.	Insert [PCB], c.	Insert [PCBStatus] d.	Insert [PCBLog] ,e.	Update [PCBStatus] ,f.	Insert [PCBLog] ,g.	Insert [PCBLog] 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            FisException ex;
            List<string> erpara = new List<string>();

            string mbsno = (string)CurrentSession.GetValue(Session.SessionKeys.MBSN).ToString();
            IMBRepository imbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();

            if ((bool)CurrentSession.GetValue(Session.SessionKeys.IsCheckPass))
            {
                //MBCodeDef mbcode = imbRepository.GetMBCode(mbsno.Substring(0, 2));
                MBCodeDef mbcode = new MBCodeDef();
                if (mbsno.Substring(5, 1) == "M")
                    mbcode = imbRepository.GetMBCode(mbsno.Substring(0, 3));
                else
                    mbcode = imbRepository.GetMBCode(mbsno.Substring(0, 2));

                if (mbcode == null)
                {
                    erpara.Add(mbsno);
                    ex = new FisException("PAK080", erpara);     //没有找到MBSno %1 对应的PCB!
                    throw ex;
                }
                int unitQty = mbcode.Qty;
                if (unitQty<=0)
                {
                    erpara.Add(mbsno);
                    ex = new FisException("PAK081", erpara);    // MBCode数据维护不全!
                    throw ex;
                }
              

                // a.  生成 MBSno:a.	生成@unitqty[@i=1..@unitqty]个MBSno, @NewMBSno = left([刷入的MBSno],5) + @i + right([刷入的MBSno],4)

                string PCBModelID=(string)CurrentSession.GetValue(Session.SessionKeys.PCBModelID);
                string newMBSno = string.Empty;
                var MBObjectList = new List<IMB>();
                CurrentSession.AddValue(Session.SessionKeys.MBList, MBObjectList);
                var CurrentMB = (MB)CurrentSession.GetValue(Session.SessionKeys.MB);
                IList<string> newMBSnoList = new List<string>();
                for (int i = 1; i <= unitQty; i++)
                {
                    newMBSno = mbsno.Substring(0, 5) + i.ToString() + mbsno.Substring(mbsno.Length - 4, 4);

                    //b.	Insert [PCB], PCBModelID = [Model]:
                    //c.	Insert [PCBStatus] For Every New MB, Status=’1’ Station=’09’:
                    

                    string moNo = CurrentMB.SMTMO;
                    string custSn = "";
                    string model = CurrentMB.Model;
                    string dateCode = CurrentMB.DateCode;
                    string mac = "";
                    string uuid = "";
                    string ecr = "";
                    string iecVer = "";
                    string custVer = "";
                    string cvsn = "";

                    MB mb = new MB(newMBSno, moNo, custSn, model, dateCode, mac, uuid, ecr, iecVer, custVer, cvsn, DateTime.Now, DateTime.Now);
                    MBStatus mbStatus = new MBStatus(newMBSno, this.Station, MBStatusEnum.Pass, this.Editor, this.Line, DateTime.Now, DateTime.Now);

                    mb.MBStatus = mbStatus;
                    
                    imbRepository.Add(mb, CurrentSession.UnitOfWork);
                    MBObjectList.Add(mb);

                    newMBSnoList.Add(newMBSno);                 
                }
                            
               //d.	Insert [PCBLog] For Every New MB, Status=’1’,Station=’09’: 调 WriteMBLog, 成批加入

               CurrentSession.AddValue(Session.SessionKeys.MBList, MBObjectList);

               //e.	Update [PCBStatus] For Old MB, Status =2,Station = ‘CL’ --Close : 调 UpdateMBStatus

               //f.	Insert [PCBLog] For Old MB, Status =2,Station = ‘CL’ –Close : 调 WriteMBLog, 单条加入

               // g.	Insert [IMES_GetData..PrintLog]: 


               CurrentSession.AddValue(Session.SessionKeys.PrintLogName, "MB");
               CurrentSession.AddValue(Session.SessionKeys.PrintLogBegNo, MBObjectList[0].Sn);
               CurrentSession.AddValue(Session.SessionKeys.PrintLogEndNo, MBObjectList[MBObjectList.Count-1].Sn);
               CurrentSession.AddValue(Session.SessionKeys.PrintLogDescr, this.Line +" "+ PCBModelID);

               CurrentSession.AddValue(Session.SessionKeys.MBSNOList, newMBSnoList);
            }
            else
            {
                erpara.Add(mbsno);
                ex = new FisException("CHK161", erpara);     //MB号:%1错误!
                throw ex;
            }
          //  CurrentSession.AddValue(Session.SessionKeys.
                   
           

            return base.DoExecute(executionContext);
        }
Example #3
0
        /// <summary>
        /// GenerateMBSn
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            string moNo;
            string model;
            string dateCode;
            string custSn;
            var mbmo = (IMBMO)CurrentSession.GetValue(Session.SessionKeys.MBMO);
            if (mbmo == null)
            {
                var CurrentMB = (MB)CurrentSession.GetValue(Session.SessionKeys.MB);
                moNo = CurrentMB.SMTMO;
                model = CurrentMB.Model;
                dateCode = CurrentMB.DateCode;
                custSn = ""; //CurrentMB.CustSn; //由于改过Kenel后报错,jiali Add

            }
            else
            {
                moNo = mbmo.MONo;
                model = mbmo.Model;
                dateCode = CurrentSession.GetValue(Session.SessionKeys.DateCode).ToString();
                //由于改过Kenel后报错,jiali Add
                custSn = "";// CurrentSession.Customer;
            }

            IList MBNOList = new ArrayList();
            MBNOList = (IList)CurrentSession.GetValue(Session.SessionKeys.MBNOList);

            var MBObjectList = new List<IMB>();

            IMBRepository mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();
           
            // add check replaceMB case
            bool isReplaceMB=false;
            if (CurrentSession.GetValue(ExtendSession.SessionKeys.IsReplaceMB)!=null)
            {
                isReplaceMB = (bool)CurrentSession.GetValue(ExtendSession.SessionKeys.IsReplaceMB);
            }
            if (!isReplaceMB)
            {
                foreach (string item in MBNOList)
                {
                    string mac = "";
                    string uuid = "";
                    string ecr = "";
                    string iecVer = "";
                    string custVer = "";
                    string cvsn = "";
                    if (this.Station == "VG")
                    {
                        ecr = "00000";
                    }
                    //由于改过Kenel后报错,jiali Add custSn
                    MB mb = new MB(item, moNo, custSn, model, dateCode, mac, uuid, ecr, iecVer, custVer, cvsn, DateTime.Now, DateTime.Now);
                    MBStatus mbStatus = new MBStatus(item, this.Station, MBStatusEnum.Pass, this.Editor, this.Line, DateTime.Now, DateTime.Now);
                    mb.MBStatus = mbStatus;

                    mbRepository.Add(mb, CurrentSession.UnitOfWork);
                    MBObjectList.Add(mb);
                }
            }
            else
            {

                
                string oldMBSN = (string)CurrentSession.GetValue(Session.SessionKeys.OldMB);
                string newMBSN = MBNOList[0].ToString();
                string reason = (string)CurrentSession.GetValue(ExtendSession.SessionKeys.ChangMBReason);
                // Change to one Child MB SN for only one
                //newMBSN = newMBSN.Substring(0, 5) + oldMBSN.Substring(5, 1) + newMBSN.Substring(6, 4);
                if (newMBSN.Substring(5, 1) == "M" || newMBSN.Substring(5, 1) == "B")
                {
                    if (oldMBSN.Substring(5, 1) == "M" || oldMBSN.Substring(5, 1) == "B")
                        newMBSN = newMBSN.Substring(0, 6) + oldMBSN.Substring(6, 1) + newMBSN.Substring(7, 4);
                    else
                        newMBSN = newMBSN.Substring(0, 6) + oldMBSN.Substring(5, 1) + newMBSN.Substring(7, 4);
                }
                else
                {
                    if (oldMBSN.Substring(5, 1) == "M" || oldMBSN.Substring(5, 1) == "B")
                       newMBSN = newMBSN.Substring(0, 5) + oldMBSN.Substring(6, 1) + newMBSN.Substring(6, 4);
                    else
                       newMBSN = newMBSN.Substring(0, 5) + oldMBSN.Substring(5, 1) + newMBSN.Substring(6, 4);
                }
                MBNOList[0] = newMBSN;
               
                //Jiali Add
                MBChangeLogRepository mbchange = new MBChangeLogRepository();
                MBChangeLog mbchangelog = new MBChangeLog(oldMBSN, newMBSN, reason, Editor, DateTime.Now);
                mbchange.Add(mbchangelog, CurrentSession.UnitOfWork);

                mbRepository.ReplaceMBSn(oldMBSN, newMBSN);
                MBObjectList.Add(mbRepository.Find(newMBSN));
                              
            }
            CurrentSession.AddValue(Session.SessionKeys.MBList, MBObjectList);

           return base.DoExecute(executionContext);
        }
Example #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            Session session = CurrentSession;
            ActivityCommonImpl utl = ActivityCommonImpl.Instance;
            IMB parentMB = utl.IsNull<IMB>(session, Session.SessionKeys.MB);
          
            IList<String> sbSNList = session.GetValue(ExtendSession.SessionKeys.SmallBoardSNList) as IList<string>;

            if (sbSNList == null || sbSNList.Count == 0)
            {
                return base.DoExecute(executionContext);
            }


            IList<String> smallBoardPartNoList = utl.IsNull <IList<String>>(session, ExtendSession.SessionKeys.SmallBoardPartNoList) as IList<string>;
            IList<String> smallBoardECRList = utl.IsNull <IList<String>>(session, ExtendSession.SessionKeys.SmallBoardECRList) as IList<string>;

            string moNo = parentMB.SMTMO;            
            string custSn = string.Empty;
            string custVer = string.Empty;
            string cvsn = parentMB.Sn;
            string uuid = string.Empty;
             string mac = string.Empty;
            string dateCode = session.GetValue(Session.SessionKeys.DCode) as string;
            //string ecr = session.GetValue(Session.SessionKeys.ECR) as string;
            //string iecVer = session.GetValue(Session.SessionKeys.IECVersion) as string;

            var sbMBList = new List<IMB>();
            session.AddValue(ExtendSession.SessionKeys.SmallBoardMBList, sbMBList);

            IMBRepository mbRep = utl.mbRep;

            IPrintLogRepository LogRep = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>();
            int index=0;    
            foreach (string sn in sbSNList)
            {
                string model = smallBoardPartNoList[index];
                string[] ecrList = smallBoardECRList[index].Split(GlobalConstName.SlashChar);
                string ecr = ecrList[0];
                string iecVer = ecrList[1];
                string[] sbSN = sn.Split(GlobalConstName.SlashChar);
                MB mb = new MB(sbSN[0], moNo, custSn, model, dateCode, mac, uuid, ecr, iecVer, custVer, cvsn, DateTime.Now, DateTime.Now);
                MBStatus mbStatus = new MBStatus(sbSN[0], this.Station, MBStatusEnum.Pass, this.Editor, this.Line, DateTime.Now, DateTime.Now);
                mb.MBStatus = mbStatus;   

                MBLog newLog = new MBLog(0, mb.Sn, mb.Model, Station, 1, Line, Editor, DateTime.Now);
                mb.AddLog(newLog);
                if (this.IsSplitMB)
                {
                    mb.SetExtendedProperty(ConstName.PCBInfo.ChildMBSN, sbSN[1], this.Editor);
                }
                else
                {
                    mb.SetExtendedProperty(ConstName.PCBInfo.ChildMBSN, parentMB.Sn, this.Editor);
                }
                mb.SetExtendedProperty(ConstName.PCBInfo.ParentMBSN, parentMB.Sn, this.Editor);
                mb.SetExtendedProperty(ConstName.PCBInfo.IsSmallBoard, ConstName.Letter.Y, this.Editor);
                mbRep.Add(mb, session.UnitOfWork);
                sbMBList.Add(mb);

                var item = new PrintLog
                {
                    Name = PrintLogName,
                    BeginNo = sn,
                    EndNo = sn,
                    Station = this.Station,
                    Cdt = DateTime.Now,
                    LabelTemplate = string.Empty,
                    Descr =string.Format(PrintLogDescr,mb.Sn, sbSN[1], sbSN[0])  ,
                    Editor = this.Editor
                };

                LogRep.Add(item, session.UnitOfWork);
                
                IMES.FisObject.PCA.MB.MBInfo items = new IMES.FisObject.PCA.MB.MBInfo();
                items.InfoType = ConstName.PCBInfo.ChildMBSN;
                items.InfoValue = mb.Sn;
                items.Editor = this.Editor;
                parentMB.AddMBInfo(items);
                index++;
            }

            return base.DoExecute(executionContext);
        }
Example #5
0
        /// <summary>
        /// 檢查 BlockStation
        /// 參數: 
        /// </summary>
        public void CheckProductBlockStation(MB mb, string pdLine, string editor, string Station, string Customer)
        {
            IProcessRepository CurrentProcessRepository = RepositoryFactory.GetInstance().GetRepository<IProcessRepository, Process>();
            string notEmpytLine = pdLine;

            if (mb == null || mb.MBStatus == null)
            {
                throw new FisException("SFC001", new string[] { "" });
            }
            string keyOfSFC = mb.Sn;

            if (string.IsNullOrEmpty(notEmpytLine))
            {
                notEmpytLine = mb.MBStatus.Line;
            }

            CurrentProcessRepository.SFC(notEmpytLine, Customer, Station, keyOfSFC, "MB");
        }