/// <summary>
        /// Get Product Object and Put it into Session.SessionKeys.Product
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            IMBRepository mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();

            string fruNo = (string)CurrentSession.GetValue(Session.SessionKeys.FRUNO) ?? "";

            IList<string> mbSNList = null;
            mbSNList = CurrentSession.GetValue(Session.SessionKeys.MBSNOList) as IList<string>;
            if (mbSNList != null && mbSNList.Count > 0)
            {
                if (!string.IsNullOrEmpty(fruNo))
                {
                    IList<IMES.FisObject.PCA.MB.MBInfo> lstMI = new List<IMES.FisObject.PCA.MB.MBInfo>();

                    foreach (string mbsn in mbSNList)
                    {
                        IMES.FisObject.PCA.MB.MBInfo mi = new IMES.FisObject.PCA.MB.MBInfo(0, mbsn, "FRUNO", fruNo, this.Editor, DateTime.Now, DateTime.Now);
                        lstMI.Add(mi);
                    }

                    mbRepository.AddMBInfoesDefered(CurrentSession.UnitOfWork, lstMI);
                }
            }

            return base.DoExecute(executionContext);
        }        
示例#2
0
文件: MB.cs 项目: wra222/testgit
        /// <summary>
        /// 设置检查目标对象的扩展属性
        /// </summary>
        /// <param name="name">属性名</param>
        /// <param name="value">属性值</param>
        /// <param name="editor"></param>
        public void SetExtendedProperty(string name, object value, string editor)
        {
            //(from p in this.MBInfos
            // where p.InfoType == name
            // select p).ToArray()[0].InfoValue = (string)value;

            if (string.IsNullOrEmpty(name))
                return;

            lock (_syncObj_info)
            {                
                MBInfo mbInfo =null;
                if (this.MBInfos != null && _info.Count > 0)
                {
                    mbInfo = (from p in _info where p.InfoType == name select p).FirstOrDefault();
                }

                if (mbInfo != null)
                {
                    mbInfo.Editor = editor;
                    mbInfo.InfoValue = value.ToString();
                }
                else
                {
                    MBInfo mbi = new MBInfo();
                    mbi.Editor = editor;
                    mbi.InfoType = name;
                    mbi.InfoValue = value.ToString();
                    mbi.PCBID = this._sn;

                    mbi.Tracker = this._tracker.Merge(mbi.Tracker);
                    this._info.Add(mbi);
                }
                this._tracker.MarkAsModified(this);
            }
        }
示例#3
0
文件: MB.cs 项目: wra222/testgit
        /// <summary>
        /// 增加主板属性
        /// </summary>
        /// <param name="info">主板属性</param>
        public void AddMBInfo(MBInfo info)
        {
            if (info == null)
                return;

            lock (_syncObj_info)
            {
                object naught = this.MBInfos;
                if (this._info.Contains(info))
                    return;

                info.Tracker = this._tracker.Merge(info.Tracker);
                this._info.Add(info);
                this._tracker.MarkAsAdded(info);
                this._tracker.MarkAsModified(this);
            }
        }
示例#4
0
        /// <summary>
        /// Save MB for RCTO MB Change
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            MB currentMB = CurrentSession.GetValue(Session.SessionKeys.MB) as MB;
            string currentNewMBSno = CurrentSession.GetValue(Session.SessionKeys.MBSN) as string;
            
            //2012-9-7, Jessica Liu
            string oldMBSno = currentMB.Sn;

            if (currentMB == null)
            {
                throw new NullReferenceException("MB in session is null");
            }

            bool isMatch = false;
            PCBStatusInfo tempPCBStatusInfo = new PCBStatusInfo();
            PCBStatusInfo tempCond = new PCBStatusInfo();
            IMBRepository CurrentRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();
            IList<MBLog> MBLogList = CurrentRepository.GetMBLog(currentMB.Sn, "1A", 1);
            if (MBLogList != null && MBLogList.Count > 0)
            {
                IList<Repair> tempRepairLst = CurrentRepository.GetPcbRepairList(currentMB.Sn, "15");
                if (tempRepairLst != null && tempRepairLst.Count > 0)
                {
                    isMatch = false;
                }
                else
                {
                    isMatch = true;

                    /* 2012-9-7, Jessica Liu, UC变更:Save时,满足条件I不再进行Station=10的设置
                    //update PCBStatus(PCBNo=@NewMBSN, Station=10, Editor, Udt; Condition: PCBNo=@MBSN)                   
                    tempPCBStatusInfo.station = "10";
                    */
                }

                IList<TestLog> lstalltestlog = CurrentRepository.GetPCBTestLogListFromPCBTestLogByType(currentMB.Sn, 1, "M/B");
                if (lstalltestlog != null && lstalltestlog.Count > 0)
                {
                    isMatch = true;
                }
                else
                {
                    isMatch = true;

                    //update PCBStatus(PCBNo=@NewMBSN, Station=10, Editor, Udt; Condition: PCBNo=@MBSN)                   
                    tempPCBStatusInfo.station = "10";
                }

            }
            else
            {
                if (currentMB.MBStatus.Station == "10" || currentMB.MBStatus.Station == "15" || currentMB.MBStatus.Station == "31")
                {
                    isMatch = true;

                    //update PCBStatus(PCBNo=@NewMBSN, Station=10, Editor, Udt; Condition: PCBNo=@MBSN)                   
                    tempPCBStatusInfo.station = "10";
                }
            }

            if (isMatch)
            {
                //update PCB(PCBNo=@NewMBSN, Udt; Codition: PCBNo=@MBSN)           
                PcbEntityInfo tempPcbInfo = new PcbEntityInfo();
                tempPcbInfo.pcbno = currentNewMBSno;
                PcbEntityInfo cond = new PcbEntityInfo();
                cond.pcbno = currentMB.Sn;
                CurrentRepository.UpdatePcb(tempPcbInfo, cond);
                
                //update PCBInfo(PCBNo=@NewMBSN, Editor, Udt; Condition: PCBNo=@MBSN)
                IMES.FisObject.PCA.MB.MBInfo tempMBInfo = new IMES.FisObject.PCA.MB.MBInfo();
                tempMBInfo.PCBID = currentNewMBSno;
                tempMBInfo.Editor = this.Editor;
                tempMBInfo.Udt = DateTime.Now;
                IMES.FisObject.PCA.MB.MBInfo MBCond = new IMES.FisObject.PCA.MB.MBInfo();
                MBCond.PCBID = currentMB.Sn;
                CurrentRepository.UpdatePcbInfo(tempMBInfo, MBCond);

                //update PCBStatus(PCBNo=@NewMBSN, Station=10, Editor, Udt; Condition: PCBNo=@MBSN)
                //或update PCBStatus(PCBNo=@NewMBSN, Editor, Udt; Condition: PCBNo=@MBSN)
                tempPCBStatusInfo.pcbno = currentNewMBSno;
                tempPCBStatusInfo.editor = this.Editor;
                tempPCBStatusInfo.udt = DateTime.Now;
                tempCond.pcbno = currentMB.Sn;
                CurrentRepository.UpdatePCBStatus(tempPCBStatusInfo, tempCond);    


                //Insert PCBInfo (PCBNo=@NewMBSN;InfoType=’RCTOChange’;InfoValue=@MBSN)
                IMES.FisObject.PCA.MB.MBInfo mbctInfo = new IMES.FisObject.PCA.MB.MBInfo(
                            0, 
                            currentNewMBSno, 
                            "RCTOChange", 
                            currentMB.Sn, 
                            this.Editor, 
                            DateTime.Now, 
                            DateTime.Now);
                //2012-9-7, Jessica Liu
                //currentMB.AddMBInfo(mbctInfo);
                CurrentRepository.AddMBInfoesDefered(CurrentSession.UnitOfWork, new IMES.FisObject.PCA.MB.MBInfo[] { mbctInfo });

                //Insert PCBLog(PCBNo=@NewMBSN; Station=PCBStatus.Station; Line=[Select Line]; Status=1)
                //line = string.IsNullOrEmpty(this.Line) ? currentMB.MBStatus.Line : this.Line;
                
                //ITC-1428-0027, Jessica Liu, 2012-9-12
                string currentStation = "";
                if (string.IsNullOrEmpty(tempPCBStatusInfo.station))
                {
                    currentStation = currentMB.MBStatus.Station;
                }
                else
                {
                    currentStation = tempPCBStatusInfo.station;
                }

                var mbLog = new MBLog(
                    0,
                    currentNewMBSno,
                    currentMB.Model,
                    //ITC-1428-0027, Jessica Liu, 2012-9-12
                    //currentMB.MBStatus.Station,
                    currentStation,
                    1,
                    this.Line,  //line,
                    this.Editor,
                    DateTime.Now);
                //2012-9-7, Jessica Liu
                //currentMB.AddLog(mbLog);
                CurrentRepository.AddMBLogsDefered(CurrentSession.UnitOfWork, new MBLog[] { mbLog });

                CurrentRepository.Update(currentMB, CurrentSession.UnitOfWork);
            }
            else
            {
                throw new FisException("CHK944", new string[] { }); //流程错误,请确定MB的状态!
            }

            //2012-9-7, Jessica Liu
            CurrentSession.AddValue(Session.SessionKeys.PrintLogName, "RCTO MB Label");
            CurrentSession.AddValue(Session.SessionKeys.PrintLogBegNo, currentNewMBSno);
            CurrentSession.AddValue(Session.SessionKeys.PrintLogEndNo, currentNewMBSno);
            CurrentSession.AddValue(Session.SessionKeys.PrintLogDescr, oldMBSno);

            return base.DoExecute(executionContext);
        }
示例#5
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);
        }
示例#6
0
        /// <summary>
        /// UpdateMBForShipping
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {

            var CurrentMB = (MB)CurrentSession.GetValue(Session.SessionKeys.MB);
            IMBRepository mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();
            //保存DCode
            string dCode = CurrentSession.GetValue(Session.SessionKeys.DCode) as string;
            CurrentMB.DateCode = dCode;
            
            string mbct = CurrentSession.GetValue(Session.SessionKeys.MBCT) as string;
            if (!string.IsNullOrEmpty(mbct))
            {
                IMES.FisObject.PCA.MB.MBInfo mbctInfo = new IMES.FisObject.PCA.MB.MBInfo(0, CurrentMB.Sn, "MBCT", mbct, Editor, DateTime.Now, DateTime.Now);
                CurrentMB.AddMBInfo(mbctInfo);
            }

            mbRepository.Update(CurrentMB, CurrentSession.UnitOfWork);

            return base.DoExecute(executionContext);
        }
示例#7
0
        /// <summary>
        /// 產生SVB Sno號相关逻辑
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            IMB vga = (IMB)CurrentSession.GetValue(Session.SessionKeys.VGA);
            IList<string> svbSnoList = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.SVBSnList);
            MBInfo info = null;
            IMBRepository imr = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();

            if (svbSnoList != null)
            {
                foreach (string item in svbSnoList) 
                {
                    info = new MBInfo(0, vga.Sn, "SVB", item, Editor, DateTime.Now, DateTime.Now);
                    vga.AddMBInfo(info);
                }

                imr.Update(vga, CurrentSession.UnitOfWork);
            }

            return base.DoExecute(executionContext);
        }
示例#8
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);
        }
示例#9
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {

            var CurrentMB = (MB)CurrentSession.GetValue(Session.SessionKeys.MB);

            string ecr = CurrentSession.GetValue(Session.SessionKeys.ECR) as string;
            string iecVer = CurrentSession.GetValue(Session.SessionKeys.IECVersion) as string;
            CurrentMB.ECR = ecr;
            CurrentMB.IECVER = iecVer;

            string mac = CurrentSession.GetValue(Session.SessionKeys.MAC) as string;
            if (!string.IsNullOrEmpty(mac))
            {
                CurrentMB.MAC = mac;
            }
            string dateCode = CurrentSession.GetValue(Session.SessionKeys.DCode) as string;
            if (!string.IsNullOrEmpty(dateCode))
            {
                CurrentMB.DateCode = dateCode;
            }

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

            string eep = CurrentSession.GetValue(Session.SessionKeys.EEP) as string;
            if (!string.IsNullOrEmpty(eep))
            {
                IMES.FisObject.PCA.MB.MBInfo eepInfo = new IMES.FisObject.PCA.MB.MBInfo(0, CurrentMB.Sn, "EEPROM", eep, Editor, DateTime.Now, DateTime.Now);
                CurrentMB.AddMBInfo(eepInfo);
            }

            string mbct = CurrentSession.GetValue(Session.SessionKeys.MBCT) as string;
            if (!string.IsNullOrEmpty(mbct))
            {
                IMES.FisObject.PCA.MB.MBInfo mbctInfo = new IMES.FisObject.PCA.MB.MBInfo(0, CurrentMB.Sn, "MBCT", mbct, Editor, DateTime.Now, DateTime.Now);
                CurrentMB.AddMBInfo(mbctInfo);

                FruDetInfo newFruDet = new FruDetInfo();
                newFruDet.sno = mbct;
                newFruDet.snoId = CurrentMB.Sn;
                newFruDet.tp = "VC";
                newFruDet.editor = Editor;
                newFruDet.cdt = DateTime.Now;
                newFruDet.udt = newFruDet.cdt;
                mbRepository.InsertFruDetInfoDefered(CurrentSession.UnitOfWork, newFruDet);

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

            mbRepository.Update(CurrentMB, CurrentSession.UnitOfWork);

            return base.DoExecute(executionContext);
        }
示例#10
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="inputSN"></param>
        /// <param name="model"></param>
        /// <param name="firstProID"></param>
        /// <param name="line"></param>
        /// <param name="editor"></param>
        /// <param name="station"></param>
        /// <param name="customer"></param>
        /// <returns></returns>
        public ArrayList InputSN(string inputSN, string model, string firstProID, string line, string editor, string station, string customer)
        {
            logger.Debug("(CombinePoInCarton)InputSN start, inputSN:" + inputSN);

            try
            {
                bool newflag = false;
                if (firstProID == "")
                {
                    newflag = true;
                }

                var productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IMES.FisObject.FA.Product.IProduct>();
                IDeliveryRepository deliveryRep = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
                IMBRepository mbRep = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();


                //[Product Id] – 如果用户录入的数据长度为9,且以字母’C’开头,则可以认定用户录入的数据是[Product Id]
                //[Vendor CT] – 如果用户录入的数据长度为14,则可以认定用户录入的数据是[Vendor CT]
                //SELECT ProductID FROM Product_Part NOLOCK WHERE PartSN = @VendorCT

                IProduct curProduct = null;
                string vendorCT = "";
                if (inputSN.Length == 9 || inputSN.Length == 10)
                {
                    //curProduct = productRep.Find(inputSN);
                    curProduct = productRep.GetProductByIdOrSn(inputSN);

                }
                if (curProduct==null)
                {
                    vendorCT = inputSN;
                    ProductPart conf = new ProductPart();
                    conf.PartSn = inputSN;

                    IList<ProductPart> productList = productRep.GetProductPartList(conf);
                    if (productList.Count > 0)
                    {
                        curProduct = productRep.Find(productList[0].ProductID);
                    }
                    else
                    {
                        //b.InfoType = 'MBCT2' AND b.InfoValue = @VendorCT	
                        var mcond = new IMES.FisObject.PCA.MB.MBInfo();
                        mcond.InfoType = "MBCT2";
                        mcond.InfoValue = vendorCT;
                        IList<IMES.FisObject.PCA.MB.MBInfo> mbList = mbRep.GetPcbInfoByCondition(mcond);
                        if (mbList.Count > 0)
                        {
                            IList<IProduct> pList = productRep.GetProductListByPCBID(mbList[0].PCBID);
                            if (pList.Count > 0)
                            {
                                curProduct = pList[0];
                            }
                        }
                        else
                        {
                            IList<IMES.FisObject.FA.Product.ProductInfo> productinfolist = productRep.GetProductInfoListByKeyAndValue("ModelCT", vendorCT);
                            {
                                if (productinfolist.Count > 0)
                                {

                                    curProduct = productRep.Find(productinfolist[0].ProductID);

                                }
                                else
                                {
                                    productinfolist = productRep.GetProductInfoListByKeyAndValue("SleeveCT", vendorCT);
                                    if (productinfolist.Count > 0)
                                    {

                                        curProduct = productRep.Find(productinfolist[0].ProductID);

                                    }

                                
                                }
                            }
                        }
                    }
                }

                if (null == curProduct)
                {
                    List<string> errpara = new List<string>();
                    errpara.Add(inputSN);
                    throw new FisException("SFC002", errpara);

                }

                if (model == "")
                {
                    model = curProduct.Model;
                }

                if (firstProID == "")
                {
                    firstProID = curProduct.ProId;
                }

                //检查Product Model (Product.Model) 是否与页面上的[Model] 相同,如果不同,则报告错误:“Model is not match!”
                if (curProduct.Model != model)
                {
                    FisException ex;
                    List<string> erpara = new List<string>();
                    erpara.Add(curProduct.Model);
                    ex = new FisException("PAK131", erpara);//Model is not match!
                    throw ex;
                }

                //h.	如果用户刷入的Product Id (可能是直接刷入的,也可能是基于Customer S/N查询到的)已经刷过,则报告错误:“Duplicate data!”
                if (!string.IsNullOrEmpty(curProduct.CartonSN))
                {
                    FisException ex;
                    List<string> erpara = new List<string>();
                    erpara.Add(curProduct.Model);
                    ex = new FisException("PAK134", erpara);//Duplicate data!
                    throw ex;
                }
                CheckPAQC(curProduct);//检查QC抽中未刷出
                CheckFRUMBOA3(curProduct.PCBID, curProduct.Model);
                ArrayList retList = new ArrayList();
                string sessionKey = firstProID;
                Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, SessionType);

                if (currentSession == null)
                {
                    if (!newflag)
                    {
                        FisException ex;
                        List<string> erpara = new List<string>();
                        ex = new FisException("PAK157", erpara);
                        retList.Add("Error");
                        retList.Add(ex);
                        return retList;
                    }
                    
                    currentSession = new Session(sessionKey, SessionType, editor, station, line, customer);

                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                    wfArguments.Add("Key", sessionKey);
                    wfArguments.Add("Station", station);
                    wfArguments.Add("CurrentFlowSession", currentSession);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", line);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", SessionType);

                    string wfName, rlName;

                    RouteManagementUtils.GetWorkflow(station, "CombinePoInCartonForRCTO.xoml", "CombinePoInCartonForRCTO.rules", out wfName, out rlName);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments);

                    currentSession.AddValue(Session.SessionKeys.IsComplete, false);
                    currentSession.AddValue(Session.SessionKeys.Product, curProduct);
                    IList<IProduct> productList = new List<IProduct>();
                    currentSession.AddValue(Session.SessionKeys.ProdList, productList);
                    IList<string> productIDList = new List<string>();
                    currentSession.AddValue(Session.SessionKeys.NewScanedProductIDList, productIDList);

                    currentSession.SetInstance(instance);

                    if (!SessionManager.GetInstance.AddSession(currentSession))
                    {
                        currentSession.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists.");
                        FisException ex;
                        List<string> erpara = new List<string>();
                        erpara.Add(sessionKey);
                        ex = new FisException("CHK020", erpara);
                        throw ex;
                    }

                    currentSession.WorkflowInstance.Start();
                    currentSession.SetHostWaitOne();
                }
                else
                {
                    if (newflag)
                    {
                        FisException ex;
                        List<string> erpara = new List<string>();
                        erpara.Add(sessionKey);
                        ex = new FisException("CHK020", erpara);
                        throw ex;
                    }
                    currentSession.AddValue(Session.SessionKeys.Product, curProduct);

                    currentSession.Exception = null;
                    currentSession.SwitchToWorkFlow();
                    /*FisException ex;
                    List<string> erpara = new List<string>();
                    erpara.Add(sessionKey);
                    ex = new FisException("CHK020", erpara);
                    throw ex;*/
                }
                if (currentSession.Exception != null)
                {
                    if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null)
                    {
                        currentSession.ResumeWorkFlow();
                    }
                    throw currentSession.Exception;
                }
                //========================================================

                ProductInfoMaintain prodInfo = new ProductInfoMaintain();
                if (string.IsNullOrEmpty(curProduct.CUSTSN))
                {
                    curProduct.CUSTSN = "";
                }
                prodInfo.ProductID = curProduct.ProId;
                prodInfo.Sn = curProduct.CUSTSN;
                prodInfo.Model = curProduct.Model;
                prodInfo.Station = vendorCT;

                IModelRepository modelRep = RepositoryFactory.GetInstance().GetRepository<IModelRepository, Model>();
                Model curModel = modelRep.Find(curProduct.Model);
                string zmode = "";
                zmode = curModel.GetAttribute("ZMODE");

                IList<IProduct> proList = (List<IProduct>)currentSession.GetValue(Session.SessionKeys.ProdList);
                IList<string> idList = (List<string>)currentSession.GetValue(Session.SessionKeys.NewScanedProductIDList);
                proList.Add(curProduct);
                idList.Add(curProduct.ProId);

                currentSession.AddValue(Session.SessionKeys.ProdList, proList);
                currentSession.AddValue(Session.SessionKeys.NewScanedProductIDList, idList);

                retList.Add("Success");
                retList.Add(prodInfo);
                retList.Add(zmode);
                //========================================================
                return retList;

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw new Exception(e.mErrmsg);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(CombinePoInCarton)InputSN end, uutSn:" + inputSN);
            }
        }
示例#11
0
        public ArrayList ReprintCartonLabel(string inputSN, string reason, string line, string editor,
                                    string station, string customer, IList<PrintItem> printItems)
        {
            logger.Debug("(CombinPoInCarton)ReprintLabel Start,"
                            + " [custSN]:" + inputSN
                            + " [line]:" + line
                            + " [editor]:" + editor
                            + " [station]:" + station
                            + " [customer]:" + customer);

            ArrayList retList = new ArrayList();
            try
            {
                var productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IMES.FisObject.FA.Product.IProduct>();
                IDeliveryRepository deliveryRep = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
                IMBRepository mbRep = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();

                IProduct curProduct;

                curProduct = productRep.FindOneProductWithProductIDOrCustSNOrCarton(inputSN);
                if (curProduct == null)
                {
                    string vendorCT = inputSN;
                    ProductPart conf = new ProductPart();
                    conf.PartSn = inputSN;
                    IList<ProductPart> productList = productRep.GetProductPartList(conf);
                    if (productList.Count > 0)
                    {
                        curProduct = productRep.Find(productList[0].ProductID);
                    }
                    else
                    {
                        //b.InfoType = 'MBCT2' AND b.InfoValue = @VendorCT	
                        var mcond = new IMES.FisObject.PCA.MB.MBInfo();
                        mcond.InfoType = "MBCT2";
                        mcond.InfoValue = vendorCT;
                        IList<IMES.FisObject.PCA.MB.MBInfo> mbList = mbRep.GetPcbInfoByCondition(mcond);
                        if (mbList.Count > 0)
                        {
                            IList<IProduct> pList = productRep.GetProductListByPCBID(mbList[0].PCBID);
                            if (pList.Count > 0)
                            {
                                curProduct = pList[0];
                            }
                        }
                    }
                    if (curProduct == null)
                    {
                        if (inputSN.Length == 9)
                        {
                            List<string> errpara = new List<string>();
                            errpara.Add(inputSN);
                            throw new FisException("CHK801", errpara);
                        }
                        else
                        {
                            List<string> errpara = new List<string>();
                            errpara.Add(inputSN);
                            throw new FisException("SFC002", errpara);
                        }
                    }
                }

                //d.	如果Product 尚未结合的Carton,则报告错误:“该Product 尚未Combine Carton,不能Reprint Carton Label!”
                if (string.IsNullOrEmpty(curProduct.CartonSN))
                {
                    List<string> errpara = new List<string>();
                    errpara.Add(curProduct.ProId);
                    throw new FisException("PAK138", errpara);
                }

                //e.	如果输入的[Carton No] 在数据库(CartonStatus.CartonNo) 中不存在,则报告错误:“此Carton 不存在!”
                carton.ICartonSSCCRepository cartRep = RepositoryFactory.GetInstance().GetRepository<carton.ICartonSSCCRepository, IMES.FisObject.PAK.CartonSSCC.CartonSSCC>();
                CartonStatusInfo carConf = new CartonStatusInfo();
                carConf.cartonNo = curProduct.CartonSN;
                IList<CartonStatusInfo> carList = cartRep.GetCartonStatusInfo(carConf);
                if (carList.Count == 0)
                {
                    List<string> errpara = new List<string>();
                    errpara.Add(curProduct.ProId);
                    throw new FisException("PAK139", errpara);//此Carton 不存在!
                }

                //如果Product 非Frame Or TRO Or BaseModel Or SLICE 的话,需要报告错误:“Product is not Frame Or TRO Or BaseModel Or SLICE” 
                //SELECT @PN = Value FROM ModelInfo NOLOCk WHERE Model = @Model AND Name = 'PN'
                IModelRepository modelRep = RepositoryFactory.GetInstance().GetRepository<IModelRepository, Model>();
                string pn = "";
                string noCarton = "";
                string modelstr = curProduct.Model;
                Model curModel = modelRep.Find(curProduct.Model);
                pn = curModel.GetAttribute("PN");
                noCarton = curModel.GetAttribute("NoCarton");

                bool labelFlag = false;
                if (!string.IsNullOrEmpty(pn) && pn.Length >= 6)
                {
                    if (pn.Substring(5, 1) == "U"
                        || pn.Substring(5, 1) == "E")
                    {
                        labelFlag = true;
                    }
                }
                if (curProduct.Model.Substring(0, 3) == "156"
                        || curProduct.Model.Substring(0, 3) == "173"
                        || curProduct.Model.Substring(0, 3) == "146"
                        || curProduct.Model.Substring(0, 3) == "157"
                        || curProduct.Model.Substring(0, 3) == "158"
                        || curProduct.Model.Substring(0, 2) == "PO"
                        || curProduct.Model.Substring(0, 2) == "2P"
                        || curProduct.Model.Substring(0, 3) == "172"
                        || curProduct.Model.Substring(0, 2) == "BC"
                        || curProduct.Model.Substring(0, 2) == "JO"
                        || curProduct.Model.Substring(0, 2) == "SF")
                {
                    labelFlag = true;
                }
                if (!labelFlag)
                {
                    FisException fe = new FisException("PAK133", new string[] { });  //Product is not Frame Or TRO Or BaseModel Or SLICE
                    throw fe;
                }

                string sessionKey = curProduct.ProId;


                var repository = RepositoryFactory.GetInstance().GetRepository<IMES.FisObject.FA.Product.IProductRepository, IMES.FisObject.FA.Product.IProduct>();

                Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, SessionType);

                if (currentSession == null)
                {
                    currentSession = new Session(sessionKey, SessionType, editor, station, line, customer);

                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                    wfArguments.Add("Key", sessionKey);
                    wfArguments.Add("Station", station);
                    wfArguments.Add("CurrentFlowSession", currentSession);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", line);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", SessionType);

                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow("ReprintCombinPoInCarton.xoml", "", wfArguments);

                    currentSession.AddValue(Session.SessionKeys.PrintLogBegNo, curProduct.ProId);
                    currentSession.AddValue(Session.SessionKeys.PrintLogEndNo, curProduct.ProId);
                    currentSession.AddValue(Session.SessionKeys.PrintLogName, curProduct.ProId);
                    currentSession.AddValue(Session.SessionKeys.PrintLogDescr, "CombinInCarton");
                    currentSession.AddValue(Session.SessionKeys.Reason, reason);
                    currentSession.AddValue(Session.SessionKeys.PrintItems, printItems);
                    currentSession.SetInstance(instance);

                    if (!SessionManager.GetInstance.AddSession(currentSession))
                    {
                        currentSession.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists.");
                        FisException ex;
                        List<string> erpara = new List<string>();
                        erpara.Add(sessionKey);
                        ex = new FisException("CHK020", erpara);
                        throw ex;
                    }

                    currentSession.WorkflowInstance.Start();
                    currentSession.SetHostWaitOne();
                }
                else
                {
                    FisException ex;
                    List<string> erpara = new List<string>();
                    erpara.Add(sessionKey);
                    ex = new FisException("CHK020", erpara);
                    throw ex;
                }

                if (currentSession.Exception != null)
                {
                    if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null)
                    {
                        currentSession.ResumeWorkFlow();
                    }

                    throw currentSession.Exception;
                }

                IList<PrintItem> printList = (IList<PrintItem>)currentSession.GetValue(Session.SessionKeys.PrintItems);
                Delivery curDev = deliveryRep.Find(curProduct.DeliveryNo);

                string cQtyStr = (string)curDev.GetExtendedProperty("CQty");
                int cQty = 0;
                if (string.IsNullOrEmpty(cQtyStr))
                {
                    cQty = 5;
                }
                else
                {
                    decimal tmp = Convert.ToDecimal(cQtyStr);
                    cQty = Convert.ToInt32(tmp);
                }

                var log = new ReprintLog
                {
                    LabelName = currentSession.GetValue(Session.SessionKeys.PrintLogName).ToString(),
                    BegNo = currentSession.GetValue(Session.SessionKeys.PrintLogBegNo).ToString(),
                    EndNo = currentSession.GetValue(Session.SessionKeys.PrintLogEndNo).ToString(),
                    Descr = (string)currentSession.GetValue(Session.SessionKeys.PrintLogDescr),
                    Reason = (string)currentSession.GetValue(Session.SessionKeys.Reason),
                    Editor = editor
                };

                //当Delivery 的CQty 属性=1,但Delivery.Model 的NoCarton 属性(Model.InfoType = ‘NoCarton’)不存在,或者存在但<>’Y’ 时,也需要列印Carton Label
                string printflag = "N";
                if (cQty > 1 || (cQty == 1 && noCarton != "Y"))
                {
                    printflag = "Y";
                    IUnitOfWork uof = new UnitOfWork();
                    var rep = RepositoryFactory.GetInstance().GetRepository<IReprintLogRepository, ReprintLog>();
                    rep.Add(log, uof);
                    uof.Commit();
                }

                retList.Add(printList);
                retList.Add(0);
                retList.Add(curProduct.CartonSN);
                retList.Add(curProduct.DeliveryNo);
                retList.Add(curProduct.CUSTSN);
                retList.Add(cQty);
                retList.Add(printflag);

                return retList;

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(CombinPoInCarton)ReprintLabel End,"
                                + " [custSN]:" + inputSN
                                + " [line]:" + line
                                + " [editor]:" + editor
                                + " [station]:" + station
                                + " [customer]:" + customer);
            }
        }