Ejemplo n.º 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {            

            var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();            
            
            var product = CurrentSession.GetValue(Session.SessionKeys.Product) as IProduct;
            if (product == null)
            {
                throw new NullReferenceException("Product in session is null");
            }
            string model = (string)CurrentSession.GetValue(Session.SessionKeys.MONO);
            string prodid = (string)CurrentSession.GetValue(Session.SessionKeys.ProductIDOrCustSN);
            string partno = (string)CurrentSession.GetValue(Session.SessionKeys.PartNo);
            string prsn = (string)CurrentSession.GetValue("PRSN");

            var productLog = new ProductLog
            {
                ProductID = prodid,
                Model = model,
                Station = prsn,
                Status = StationStatus.Pass,
                Line = "PS",
                Editor = Editor,                
                Cdt = DateTime.Now
            };

            ProductLog[] logs = {productLog};
            productRepository.InsertProductLogs(logs);
            //product.AddLog(productLog);
            //productRepository.Update(product, CurrentSession.UnitOfWork);
            
            return base.DoExecute(executionContext);
        }
Ejemplo n.º 2
0
        public void Save(object part_unit, object part_owner, string station, string key)
        {
            if (part_unit == null)
            {
                throw new ArgumentNullException();
            }
            if (part_owner == null)
            {
                throw new ArgumentNullException();
            }

            Session session = SessionManager.GetInstance.GetSession(key, Session.SessionType.Product);
            if (session == null)
            {
                throw new InstanceNotFoundException("Can not get Session instance from SessionManager!");
            }
            PartUnit pu = (PartUnit)part_unit;

            if (null != session.GetValue("IsCleanRoomModel") && ((bool)session.GetValue("IsCleanRoomModel")))
            {
                IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
                IProduct product = productRepository.GetProductByIdOrSn(pu.Sn);
                if (product == null)
                {
                    throw new Exception("IsCleanRoomModel, Can not get Product instance by Part.Sn when Save !");
                }
                string prdID = product.ProId;
                
                IList<IMES.DataModel.TbProductStatus> stationList = productRepository.GetProductStatus(new List<string> { prdID });
                productRepository.UpdateProductPreStationDefered(session.UnitOfWork, stationList);

                //***** Update Product Status
                var newStatus = new IMES.FisObject.FA.Product.ProductStatus();
                newStatus.Udt = DateTime.Now;
                newStatus.StationId = "CR32";
                newStatus.Status = IMES.FisObject.Common.Station.StationStatus.Pass;
                newStatus.Line = product.Status.Line;
                newStatus.Editor = session.Editor;
                newStatus.TestFailCount = 0;
                newStatus.ReworkCode = "";
                product.UpdateStatus(newStatus);

                //***** Insert ProductLog
                var productLog = new ProductLog
                {
                    Model = product.Model,
                    Status = IMES.FisObject.Common.Station.StationStatus.Pass,
                    Editor = session.Editor,
                    Line = product.Status.Line,
                    Station = "CR32",
                    Cdt = DateTime.Now
                };
                product.AddLog(productLog);

                productRepository.Update(product, session.UnitOfWork);
            }

        }
Ejemplo n.º 3
0
        public void Save(object part_unit, object part_owner, string station, string key)
        {
            if (part_unit == null)
            {
                throw new ArgumentNullException();
            }
            if (part_owner == null)
            {
                throw new ArgumentNullException();
            }
            PartUnit pu = (PartUnit)part_unit;
            Session session = (Session)pu.CurrentSession;
            string prdID = pu.Sn;
            IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            IList<IMES.DataModel.TbProductStatus> stationList = productRepository.GetProductStatus(new List<string> {prdID});
            productRepository.UpdateProductPreStationDefered(session.UnitOfWork, stationList);

            //***** Update Product Status
            IProduct product= productRepository.Find(prdID);
            if (product == null)
            { return; }
            var newStatus = new IMES.FisObject.FA.Product.ProductStatus();
            newStatus.Udt= DateTime.Now;
            newStatus.StationId = "CR32";
            newStatus.Status = IMES.FisObject.Common.Station.StationStatus.Pass;
            newStatus.Line = session.Line;
            newStatus.Editor = session.Editor;
            newStatus.TestFailCount = 0;
            newStatus.ReworkCode = "";
            product.UpdateStatus(newStatus);
                //  productRepository.Update(product, session.UnitOfWork);
            //***** Insert ProductLog
            var productLog = new ProductLog
            {
                Model = product.Model,
                Status = IMES.FisObject.Common.Station.StationStatus.Pass,
                Editor = session.Editor,
                Line = session.Line,
                Station = "CR32",
                Cdt = DateTime.Now
            };

            product.AddLog(productLog);
            productRepository.Update(product, session.UnitOfWork);

        }
Ejemplo n.º 4
0
        /// <summary>
        /// Check RMN
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            Product curProduct = (Product)CurrentSession.GetValue(Session.SessionKeys.Product);

            CurrentSession.AddValue("LanguageMessage", "");

            var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            IModelRepository modelRep = RepositoryFactory.GetInstance().GetRepository<IModelRepository, Model>();
            IBOMRepository bomRep = RepositoryFactory.GetInstance().GetRepository<IBOMRepository>();
            IPalletRepository palletRep = RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>();
            IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
            IDeliveryRepository DeliveryRepository = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
            
            Delivery curDelivery = DeliveryRepository.Find(curProduct.DeliveryNo);
            Model curModel = modelRep.Find(curProduct.Model);
            

            //1.	请参考下表,如果ModelBOM 中Model 的直接下阶存在对应的Part 时,就表明需要列印该Label
            //,如果都不存在,则不需要列印这些Label (如果存在,应只存在其中一个)
            //Label	        Part No
            //China label	6060B0464901        
            //China label	6060BCHINA01        
            //GOST label	6060B000GS01        
            //GOST label	6060B000GS02        
            //ICASA Label	6060BICASA01        
            //ICASA Label for South Africa	6060B0763601        
            //KC Label	6060B000KC01        
            //Taiwan Label	6060B0487001        
            //Taiwan Label	6060BTAIWAN1        

            IHierarchicalBOM curBom = bomRep.GetHierarchicalBOMByModel(curProduct.Model);
            IList<IBOMNode> bomList = curBom.FirstLevelNodes;
            string language = string.Empty;

            int checkChina = 0;
            foreach (IBOMNode node in bomList)
            {
                if (node.Part.PN == "6060B0464901" || node.Part.PN == "6060BCHINA01")
                {
                    checkChina =2;
                    if (node.Part.PN == "6060B0464901")
                    {
                        checkChina =3;
                    }
                    language = "China label";
                    break;
                }
                else if(node.Part.PN == "6060B000GS01" || node.Part.PN == "6060B000GS02")
                {
                    language = "GOST Lable";
                    break;
                }
                else if (node.Part.PN == "6060BICASA01")
                {
                    language = "ICASA Label L";
                    break;
                }
                else if (node.Part.PN == "6060B0763601")
                {
                    language = "ICASA Label L";
                    break;
                }
                else if (node.Part.PN == "6060B000KC01")
                {
                    language = "KC Label";
                    break;
                }
                else if (node.Part.PN == "6060B0487001" || node.Part.PN == "6060BTAIWAN1")
                {
                    language = "Taiwan Label";
                    break;
                }
            }
            if (string.IsNullOrEmpty(language))
            {
                //无需打印
                CurrentSession.AddValue("LanguageLabel", "");
                return base.DoExecute(executionContext);
            }
            else
            {
                CurrentSession.AddValue("LanguageLabel", language);
            }

            //当需要列印ICASA Label, ICASA Label2时,
            if (language == "ICASA Label L")
            {
                //对于在ModelBOM 中Model 的直接下阶中BomNodeType = 'PL' AND IMES_GetData..Part.Descr='ICASA Label2' 的Part,
                //并且与Product 结合的Part 中存在BomNodeType = 'KP' 并且Vendor CT (IMES_FA..Product_Part.PartSn)以'G' 开头的Part 时,
                //取与Product 结合的Part 中BomNodeType = 'KP' 并且Vendor CT (IMES_FA..Product_Part.PartSn)以'G' 开头的Part 的记录,
                //取这些Vendor CT 的前5位(作Distinct),使用这些不同的Vendor CT 前5位等于FA..ICASA.CT 查询FA..ICASA,查询到的ICASA 字段值,
                //即是环境变量ICASA 的取值
                //如果有使用Vendor CT 前5位等于FA..ICASA.CT 查询FA..ICASA 表没有记录的情况,
                //则报告错误:“存在未Maintain 的CT,请IE Maintain!”
                ILCMRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<ILCMRepository>();
                foreach (IBOMNode node in bomList)
                {
                    if (node.Part.BOMNodeType != "PL" || node.Part.Descr != "ICASA Label2")
                    {
                        continue;
                    }
                    IList<ProductPart> partList = partRep.GetProductPart("G", "KP", curProduct.ProId);
                    
                    foreach (ProductPart part in partList)
                    {
                        string vendorCT = part.PartSn.Substring(0, 5);
                        ICASADef iCASA = itemRepository.GetICASAInfoByVC(vendorCT);
                        if (iCASA == null)
                        {
                            FisException fe = new FisException("PAK145", new string[] { });   //存在未Maintain 的CT,请IE Maintain!
                            throw fe;
                        }
                    }

                }

            }



           //对于China Label 需要在列印完Label 后,满足下文所述情况,需提示用户:@family + “请贴” + @lpn + “ China Label!”
            if (language == "China label")
            {
                string size = string.Empty;
                //a)取Product 绑定的Delivery (IMES_FA..Product.DeliveryNo)赋值给变量@dn
                string dn = curProduct.DeliveryNo;
                //b)取Product Family (IMES_GetData..Model.Family)赋值给变量@family
                string family = curModel.FamilyName;
                //c)取Delivery 的属性RegId (IMES_PAK..DeliveryInfo.InfoValue,Condition: InfoType = 'RegId') / Flag (IMES_PAK..DeliveryInfo.InfoValue,Condition: InfoType = 'Flag') / Country (IMES_PAK..DeliveryInfo.InfoValue,Condition: InfoType = 'Country')
                //赋值给变量@regid / @flag / @country
                string regid = (string)curDelivery.GetExtendedProperty("RegId");
                string flag = (string)curDelivery.GetExtendedProperty("Flag");
                string country = (string)curDelivery.GetExtendedProperty("Country");

                //d)取@family第一个空格前的字符串赋值给变量@family3
                string[] splitpattern = family.Split(' ');
                string family3 = splitpattern[0].Trim();
                string family2 = string.Empty;

                //e)如果使用UPPER(Family) like @family3 +'%' 查询IMES_PAK..ChinaLabel表存在记录,
                //并且在ModelBOM 中Model的直接下阶中存在Part No = '6060B0464901' 的记录时,按照如下方法获取@lpn;
                //如果不满足上述条件,则不需要提示,退出
                IList<ChinaLabelInfo> chinaList = palletRep.GetChinaLabelByLikeFamily(family3);
                if ((checkChina !=3) ||(chinaList.Count==0))
                {
                    //无需提示
                    CurrentSession.AddValue("LanguageMessage", "");
                    return base.DoExecute(executionContext);
                }

                //i.首先在IMES_FA..Product_Part 表中取PartSn 以字符'C' 开头BomNodeType 为'KP' 的记录的PartSn 的前5为赋值给变量@lcm
                //ii.取在ModelBOM 中@lcm 直接上阶BomNodeType 为'KP' 的Part 的Descr 属性,
                //ModelBOM.Component = @lcm
                //并将Descr 属性的第5,6位字符串赋值给变量@size
                
                IList<ProductPart> partList = partRep.GetProductPart("C", "KP",curProduct.ProId);
                if (partList.Count == 0)
                {
                    return base.DoExecute(executionContext);
                }
                string lcm = partList[0].PartSn.Substring(0, 5);

                IList<IBOMNode> tmpList = bomRep.GetParentBomNode(lcm);
                foreach (IBOMNode node in tmpList)
                {
                    if (node.Part.Type == "KP")
                    {
                        size = node.Part.Descr.Substring(4, 2);
                        break;
                    }
                }

                string lpn = string.Empty;
                IList<ChinaLabelInfo> cList = new List<ChinaLabelInfo>();
                ChinaLabelInfo citem= new ChinaLabelInfo();
                //iii.	如果@family 中含有'DD' 或者'TT',则按照如下方法获取@lpn
                if (family.Contains("DD") || family.Contains("TT"))
                {
                    //SELECT @family2=LEFT(@family,CHARINDEX(' ',@family)-1)+' '+@size
                    //SELECT @lpn=PN FROM ChinaLabel WHERE Family=@family2
                    family2 = splitpattern[0]+ size;
                    citem.family = family2;
                    cList = palletRep.GetChinaLabel(citem);
                    lpn = cList[0].pn;
                }
                else //iv.	如果@family 中不含有'DD' 和'TT',则按照如下方法获取@lpn
                {
                    //IF CHARINDEX(' ',@family)>0
                    //BEGIN
	                //SELECT @lpn=PN FROM ChinaLabel WHERE Family=LEFT(@family,CHARINDEX(' ',@family)-1)
                    //END
                    //ELSE
                    //BEGIN
	                //SELECT @lpn=PN FROM ChinaLabel WHERE UPPER(Family)=RTRIM(UPPER(@family))
                    //END
                    if (splitpattern.Length > 1)
                    {
                        citem.family = splitpattern[0];
                        cList = palletRep.GetChinaLabel(citem);
                        lpn = cList[0].pn;
                    }
                    else
                    {
                        citem.family = family.ToUpper();
                        cList = palletRep.GetChinaLabel(citem);
                        lpn = cList[0].pn;
                    }
                }

                string languageMsg = string.Empty;
                //v.	如果ModelBOM 中Model 的直接下阶中存在Part No 为'6060B0464901' 或者'6060BCHINA01' 的Part,
                //并且(@regid='SCN' or (@flag='C' AND @country='CHINA' ))时,需要提示用户,并记录ProductLog;否则不需要提示
                //记录ProductLog
                //Line – 'China Label'
                //Station – 'CL'
                //Status – '1'
                //Editor – 'PAK'

                if ((regid == "SCN" || flag == "C") && (country == "CHINA"))
                {
                    //@family + “请贴” + @lpn + “ China Label!”
                    languageMsg = family + "请贴" + lpn + " China Label!";
                    CurrentSession.AddValue("LanguageMessage", languageMsg);

                    var productLog = new ProductLog
                    {
                        Model = curProduct.Model,
                        Status = IMES.FisObject.Common.Station.StationStatus.Pass,
                        Editor = "PAK",
                        Line = "China Label",
                        Station = "CL",
                        Cdt = DateTime.Now
                    };

                    curProduct.AddLog(productLog);
                    productRepository.Update(curProduct, CurrentSession.UnitOfWork);
                }
                else
                {
                    CurrentSession.AddValue("LanguageMessage", "");
                }

            }

	        return base.DoExecute(executionContext);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 更新ProductStatus
 /// </summary>
 /// <param name="station">station</param>
 /// <param name="editor">editor</param> 
 /// <param name="prod">prod</param>
 /// <returns></returns>
 public void InsertProLog(string station, string editor, string prod)
 {
     try
     {
         ProductStatusInfo statusIfo = productRepository.GetProductStatusInfo(prod);
         ProductLog[] items = new ProductLog[1];
         items[0].Line = statusIfo.pdLine;
         items[0].Station = station;
         items[0].ProductID = prod;
         items[0].Editor = editor;
         items[0].Cdt = DateTime.Now;
         productRepository.InsertProductLogs(items);
     }
     catch (Exception ee)
     {
         throw ee;
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 执行根据DeliveryNo修改所有属于该DeliveryNo的Product状态的操作
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            Product currentProduct = ((Product)CurrentSession.GetValue(Session.SessionKeys.Product));
            INumControlRepository numCtrlRepository = RepositoryFactory.GetInstance().GetRepository<INumControlRepository, NumControl>();
            string  stag =(string) CurrentSession.GetValue(Session.SessionKeys.CN);
            IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
            string sn = currentProduct.CUSTSN;
            string prodid = currentProduct.ProId;
           
            if (stag == "S")
            {
                //NumControl nc = new NumControl(-1, "CPQSNO", "", sn, "HP");

               // numCtrlRepository.InsertNumControlDefered(CurrentSession.UnitOfWork, nc);

                string line = default(string);
                var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
               
                //IMES.FisObject.Common.Station
                StationStatus status = (StationStatus)(1);
                line = string.IsNullOrEmpty(this.Line) ? currentProduct.Status.Line : this.Line;

                    var productLog = new ProductLog
                    {
                        Model = currentProduct.Model,
                        Status = status,
                        Editor = Editor,
                        Line = line,
                        Station = "58",
                        Cdt = DateTime.Now
                    };

                    currentProduct.AddLog(productLog);
                    productRepository.Update(currentProduct, CurrentSession.UnitOfWork);
               
            }

            if (stag == "T")
            {       
               // void InsertForceNWC(ForceNWCInfo item);
               //  bool CheckExistForceNWC(ForceNWCInfo condition);
                ForceNWCInfo cond = new ForceNWCInfo();
                cond.productID = currentProduct.ProId;
                bool bExist = partRep.CheckExistForceNWC(cond);
                if (bExist == true)
                {
                    partRep.UpdateForceNWCByProductID("58", "59", currentProduct.ProId);
                }
                else
                {
                    ForceNWCInfo newinfo = new ForceNWCInfo();
                    newinfo.editor = this.Editor;
                    newinfo.forceNWC = "58";
                    newinfo.preStation = "59";
                    newinfo.productID = currentProduct.ProId;
                    partRep.InsertForceNWC(newinfo);
                }
            }

            CurrentSession.AddValue(Session.SessionKeys.PrintLogDescr, prodid);
            CurrentSession.AddValue(Session.SessionKeys.PrintLogName, "MasterLabel");
            CurrentSession.AddValue(Session.SessionKeys.PrintLogBegNo, prodid);
            CurrentSession.AddValue(Session.SessionKeys.PrintLogEndNo, prodid);



            return base.DoExecute(executionContext);
        }
        /// <summary>
        /// insert into productlog by dn
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            string CurrentDeliveryNo = (string)CurrentSession.GetValue(Session.SessionKeys.DeliveryNo);
            ProductLog newLog = new ProductLog();
            newLog.Editor = Editor;
            newLog.Line = Line;
            newLog.Station = Station;
            newLog.Status = Status;

            IProductRepository currentProductRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository>();
            currentProductRepository.WriteUnPackProductLogByDeliveryNoDefered(CurrentSession.UnitOfWork, CurrentDeliveryNo, newLog);
            return base.DoExecute(executionContext);
        }
Ejemplo n.º 8
0
        private bool checkPreHoldStation(IProduct prod, out ProductLog lastLog, out ProductLog actualStationLog )
        {
            lastLog = null;
            actualStationLog = null;
            IProductRepository prodRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            ProductStatusExInfo preStation = (ProductStatusExInfo)CurrentSession.GetValue("PreStation");
            string isPreHoldStation = (string)CurrentSession.GetValue("IsPreHoldStation");
            string preStationId=null;
            string curStation = prod.Status.StationId;
            DateTime preStationUdt=DateTime.Now;

            if (preStation == null)
            {
                IList<ProductStatusExInfo> preStatusList = prodRep.GetProductPreStation(new List<string> { prod.ProId });
                if (preStatusList == null || 
                    preStatusList.Count == 0 || 
                    string.IsNullOrEmpty(preStatusList[0].PreStation))
                {
                    return false;
                }
               
                preStation = preStatusList[0];
                CurrentSession.AddValue("PreStation",preStation);
                preStationId = preStation.PreStation;
                preStationUdt = preStation.PreUdt;

                if (string.IsNullOrEmpty(isPreHoldStation))
                {
                    IStationRepository stationRep = RepositoryFactory.GetInstance().GetRepository<IStationRepository>();
                    isPreHoldStation = stationRep.GetStationAttrValue(preStationId, "IsHold");
                    CurrentSession.AddValue("IsPreHoldStation",isPreHoldStation);
                }
            }
            else
            {
                preStationId = preStation.PreStation;
                preStationUdt = preStation.PreUdt;
            }

            if (isPreHoldStation == "Y")
            {
                IList<string> excludeStation = new List<string>() {preStationId,
                                                                                          curStation,
                                                                                          "Release"};
                                                                                                   
                IList<ProductLog> prodLogList = prod.ProductLogs;
                
                var logList = prodLogList.Where(x => !excludeStation.Contains(x.Station));
                if (logList != null && logList.Count() > 0)
                {
                    lastLog = logList.OrderByDescending(x => x.Cdt).First();                    
                }

                var stationLogList = prodLogList.Where(x => x.Cdt < preStationUdt && x.Station == curStation);
                if (stationLogList != null && stationLogList.Count() > 0)
                {
                    actualStationLog = stationLogList.OrderByDescending(x => x.Cdt).First();                    
                }

               
                return true;                
            }

            return false;
        }
Ejemplo n.º 9
0
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {

            String currentPallet = (String)CurrentSession.GetValue(Session.SessionKeys.Pallet);


            IList<ProductLog> logList = new List<ProductLog>();

            IProductRepository ProductRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();


            IList<IMES.DataModel.ProductModel> productModelList = ProductRepository.GetProductListByPalletNo(currentPallet);


            foreach (IMES.DataModel.ProductModel model in productModelList)
            {
                ProductLog newLog = new ProductLog();

                newLog.Editor = Editor;
                newLog.Line = Line;
                newLog.Station = Station;
                newLog.Status = Status;
                newLog.ProductID = model.ProductID;
                newLog.Model = model.Model;

                logList.Add(newLog);

            }


            ProductRepository.WriteProductListLogDefered(CurrentSession.UnitOfWork, logList);

            return base.DoExecute(executionContext);

        }
Ejemplo n.º 10
0
        /// <summary>
        /// 用于更新一组Product的状态
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {

            ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            logger.Error("------------------ begin WriteProductListLog ------------------------");
            IList<ProductLog> logList = new List<ProductLog>();

            IProductRepository ProductRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            IList<string> ProductIDList = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.NewScanedProductIDList);
            IList<string> ProductModelList = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.NewScanedProductModelList);
            IList<string> ProductLineList = new List<string>();
            if (string.IsNullOrEmpty(Line))
            {
                ProductLineList = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.NewScanedProductLineList);
            }
            
            if (ProductIDList != null && ProductModelList != null)
            {
                for (int i = 0; i < ProductIDList.Count; i++)
                {
                    ProductLog newLog = new ProductLog();
                    newLog.Editor = Editor;
                    if (string.IsNullOrEmpty(Line) && ProductLineList != null)
                    {
                        newLog.Line = ProductLineList[i];
                    }
                    else
                    {
                        newLog.Line = Line;
                    }
                    newLog.Station = Station;
                    newLog.Status = Status;
                    newLog.ProductID = ProductIDList[i];
                    newLog.Model = ProductModelList[i];
                    logList.Add(newLog);
                }
                string[] strs = ProductIDList.ToArray();
                string ret = string.Format("'{0}'", string.Join("','", strs));
                logger.Error("------------------ ProductIDList= " + ret + "------------------------");
            }

            ProductRepository.WriteProductListLogDefered(CurrentSession.UnitOfWork, logList);
            logger.Error("------------------ end WriteProductListLog ------------------------");
            return base.DoExecute(executionContext);
        }
Ejemplo n.º 11
0
        public ArrayList Save(List<string> SNList,
                              List<string> PNList,
                              List<string> errList, string Editor, string Station, string customer)
        {
            logger.Debug("(ReturnUsedKeysImpl)Save start" 
                
                + " [editor]:" + Editor
                + " [station]:" + Station
                + " [customer]:" + customer);
            FisException ex;
            List<string> erpara = new List<string>();
            ArrayList retvaluelist = new ArrayList();
            string ECOAReturnStatus = "0";
            var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            var currentRepository = RepositoryFactory.GetInstance().GetRepository<ICOAStatusRepository, COAStatus>();

            try
            {
                ///生成group id
                SqlTransactionManager.Begin();
                IUnitOfWork Number_uof = new UnitOfWork();//使用自己的UnitOfWork
                string prestr = "";
                string maxnum = "";
                bool addflag = false;
               
                INumControlRepository numControl = RepositoryFactory.GetInstance().GetRepository<INumControlRepository, NumControl>();
                maxnum = numControl.GetMaxNumber("GroupID", prestr + "{0}");
                if (string.IsNullOrEmpty(maxnum))
                {
                    maxnum = "001";
                    addflag = true;
                }
                else
                {
                    if (maxnum.Substring(6, 3).ToUpper() == "999")
                    {
                        maxnum = "001";
                    }
                    else
                    {
                        int count = Int32.Parse(maxnum.Substring(6, 3));
                        count = count + 1;
                        maxnum = (count).ToString().PadLeft(3, '0');
                    }
                }
                DateTime dd = DateTime.Now;
                string Groupid = dd.Year.ToString().Substring(2,2) + dd.Month.ToString().PadLeft(2, '0') + dd.Day.ToString().PadLeft(2, '0') + maxnum;
                NumControl item = new NumControl();
                item.NOType = "GroupID";
                item.Value = Groupid;
                item.NOName = "";
                item.Customer = "HP";

                numControl.SaveMaxNumber(item, addflag, prestr + "{0}");
               
                Number_uof.Commit();  //立即提交UnitOfWork更新NumControl里面的最大值
                SqlTransactionManager.Commit();//提交事物,释放行级更新锁

                
                 
                /////////////////////////////////////////////////

                for (int i = 0; i < SNList.Count; i++)
                {
                    IProduct CurrentProduct = null;
                    if (errList[i] == "Pass")
                    {
                        string custSn = SNList[i];
                        
                        IUnitOfWork work = new UnitOfWork();
                        CurrentProduct = productRepository.GetProductByCustomSn(custSn);
                        if (CurrentProduct == null)
                        {
                            continue;
                        }
                        string line = CurrentProduct.Status.Line;
                        StationStatus Status = StationStatus.Pass;
                      
                        var productLog = new ProductLog
                        {
                            Model = CurrentProduct.Model,
                            Status = Status,
                            Editor = Editor,
                            Line = line,
                            Station = Station,
                            Cdt = DateTime.Now
                        };
                        CurrentProduct.AddLog(productLog);
                      
                        /////////update product status
                        var newStatus = new ProductStatus();
                        newStatus.Status = Status;
                        newStatus.StationId = Station;
                        newStatus.Editor = Editor;
                        newStatus.Line = line;
                        newStatus.TestFailCount = 0;

                        if (!string.IsNullOrEmpty(CurrentProduct.Status.ReworkCode) && productRepository.IsLastReworkStation(CurrentProduct.Status.ReworkCode, Station, (int)Status))
                        {
                            newStatus.ReworkCode = "";
                            IMES.DataModel.Rework r = new IMES.DataModel.Rework();
                            r.ReworkCode = CurrentProduct.Status.ReworkCode;
                            r.Editor = Editor;
                            r.Status = "3";
                            r.Udt = DateTime.Now;
                            productRepository.UpdateReworkConsideredProductStatusDefered(work, r, CurrentProduct.ProId);
                        }
                        else
                        {
                            newStatus.ReworkCode = CurrentProduct.Status.ReworkCode;
                        }
                        newStatus.ProId = CurrentProduct.ProId;
                        CurrentProduct.UpdateStatus(newStatus);
                        
                        productRepository.Update(CurrentProduct, work);

                        ECOAReturnStatus = "1";
                    }
                    dm.EcoareturnInfo item1 = new dm.EcoareturnInfo();
                    item1.custsn = SNList[i];
                    item1.partNo = PNList[i];
                    item1.message = errList[i];
                    item1.status = ECOAReturnStatus;
                    item1.line = CurrentProduct.Status.Line;
                    item1.groupNo = Groupid;
                    
                    currentRepository.InsertEcoareturn(item1);

                }
                retvaluelist.Add(Groupid);
                return retvaluelist;

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);

                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw e;
            }
            finally
            {
                logger.Debug("(ReturnUsedKeysImpl)Save end" 
                    
                    + " [editor]:" + Editor
                    + " [station]:" + Station
                    + " [customer]:" + customer);
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 执行根据DeliveryNo修改所有属于该DeliveryNo的Product状态的操作
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            string Delivery = (string)CurrentSession.GetValue(Session.SessionKeys.DeliveryNo);
            Delivery CurrentDelivery = (Delivery)CurrentSession.GetValue(Session.SessionKeys.Delivery);

            IDeliveryRepository DeliveryRepository = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
            IProductRepository repProduct = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            ////
           

            IList<string> nameList = new List<string>();
            nameList.Add("UCC");
            nameList.Add("BoxId");
            repProduct.BackUpProductByDnPure( Delivery, Editor);
            repProduct.BackUpProductInfoByDn( Delivery, Editor, nameList);
            repProduct.BackUpProductStatusByDnPure( Delivery, Editor);
           
            ////
            ProductStatus newStatus = new ProductStatus();
            newStatus.Editor = Editor;
            newStatus.Line = Line;
            newStatus.StationId = Station;
            newStatus.Status = StationStatus.Pass;
            newStatus.ReworkCode = "";

            repProduct.UpdateUnPackProductStatusByDn(newStatus, Delivery);
            carton.ICartonSSCCRepository cartRep = RepositoryFactory.GetInstance().GetRepository<carton.ICartonSSCCRepository, IMES.FisObject.PAK.CartonSSCC.CartonSSCC>();
            IPalletRepository palletRep = RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>();

            ////
            ProductLog newLog = new ProductLog();
            newLog.Editor = Editor;
            newLog.Line = Line;
            newLog.Station = Station;
            newLog.Status = StationStatus.Pass;

            repProduct.WriteUnPackProductLogByDn(Delivery,newLog);

            //////
            repProduct.UnPackProductInfoByDeliveryNoAndInfoType("UCC",Delivery);
            repProduct.UnPackProductInfoByDeliveryNoAndInfoType("BoxId", Delivery);
            
            ////////
            if (Station != "8U")
            {
                IList<IProduct> lstProduct = repProduct.GetProductObjListByDn(Delivery);
                if (lstProduct != null && lstProduct.Count > 0)
                {
                    foreach(IProduct tmp in lstProduct)
                    {
                        string carton = tmp.CartonSN;
                        DM.CartonInfoInfo condition = new DM.CartonInfoInfo();
                        condition.cartonNo = carton;
                        cartRep.DeleteCartonInfo(condition);

                        //mantis 1395
                        DM.CartonStatusInfo cond = new DM.CartonStatusInfo();
                        DM.CartonStatusInfo sv = new DM.CartonStatusInfo();
                        cond.cartonNo = tmp.CartonSN;
                        sv.station = Station;
                        sv.status = 1;
                        sv.editor = Editor;
                        sv.udt = DateTime.Now;
                        cartRep.UpdateCartonStatusDefered(CurrentSession.UnitOfWork, sv, cond);

                        DM.CartonLogInfo item = new DM.CartonLogInfo();
                        item.cartonNo = tmp.CartonSN;
                        item.cdt = DateTime.Now;
                        item.editor = Editor;
                        item.line = tmp.Status.Line;
                        item.station = Station;
                        item.status = 1;
                        cartRep.AddCartonLogInfoDefered(CurrentSession.UnitOfWork, item);
                        //mantis 1395


                        string palletNo = tmp.PalletNo;
                        DM.PakLocMasInfo setValue = new DM.PakLocMasInfo();
                        DM.PakLocMasInfo pakLoc_condition = new DM.PakLocMasInfo();
                        setValue.pno = "";
                        setValue.editor = Editor;
                        pakLoc_condition.pno = palletNo;
                        pakLoc_condition.tp = "PakLoc";
                        palletRep.UpdatePakLocMasInfo(setValue, pakLoc_condition);
                    }
                }
            }

            if (Station != "8U")
                repProduct.UnPackProductByDn(Delivery);
            else
                repProduct.UnPackProductByDnWithoutCartonSN(Delivery);

    /////////////////////
            CurrentDelivery.Status = "00";
            CurrentDelivery.Editor = this.Editor;
            CurrentDelivery.Udt = DateTime.Now;
            DeliveryRepository.Update(CurrentDelivery, CurrentSession.UnitOfWork);
    /////////////////////


            return base.DoExecute(executionContext);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Unpack CombinePizza
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            List<string> errpara = new List<string>();

            IProductRepository prodRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            IPizzaRepository pizzaRepository = RepositoryFactory.GetInstance().GetRepository<IPizzaRepository, Pizza>();

            IList<IProduct> prodList = null;
            string cartonSN = CurrentSession.GetValue("CartonSN") as string;

            if (!string.IsNullOrEmpty(cartonSN))
            {
                prodList = prodRep.GetProductListByCartonNo(cartonSN);
            }
            else
            {
                Product curProduct = CurrentSession.GetValue(Session.SessionKeys.Product) as Product;
                prodList = new List<IProduct>();
                prodList.Add(curProduct);
            }

            IList<Pizza> updatePizzasJC = new List<Pizza>();
            IList<Pizza> updatePizzas173 = new List<Pizza>();
            
            bool modelIsJC = false;
            bool modelIs173 = false;

            foreach (IProduct p in prodList)
            {
                //modelIsJC = (p.Model.IndexOf("JC") == 0);
                modelIsJC = ActivityCommonImpl.Instance.CheckModelByProcReg(p.Model, "ThinClient");
                modelIs173 = (p.Model.IndexOf("173") == 0);
                if (!(modelIsJC || modelIs173))
                    continue;

                prodRep.BackUpProductDefered(CurrentSession.UnitOfWork, p.ProId, CurrentSession.Editor);
                prodRep.BackUpProductStatusDefered(CurrentSession.UnitOfWork, p.ProId, CurrentSession.Editor);
                prodRep.BackUpProductPartDefered(CurrentSession.UnitOfWork, p.ProId, CurrentSession.Editor);

                if (null != p.Status)
                    p.Status.StationId = this.Station;

                if (modelIsJC)
                {
                    Pizza pizza = pizzaRepository.Find(p.PizzaID);
                    if (pizza == null)
                    {
                        throw new NullReferenceException("Pizza in session is null");
                        //continue;
                    }

                    //if (!updatePizzasJC.Contains(p.PizzaID))
                    updatePizzasJC.Add(pizza);

                    p.PizzaID = "";
                }
                //else if (modelIs173)
                //{
                //    if (!updatePizzas173.Contains(p.PizzaID))
                //        updatePizzas173.Add(p.PizzaID);
                //}

                string line = string.IsNullOrEmpty(this.Line) ? p.Status.Line : this.Line;
                var productLog = new ProductLog
                {
                    Model = p.Model,
                    Status = Status,
                    Editor = Editor,
                    Line = line,
                    Station = Station,
                    Cdt = DateTime.Now
                };

                p.AddLog(productLog);
                prodRep.Update(p, CurrentSession.UnitOfWork);

            }

            if (modelIs173 && !string.IsNullOrEmpty(cartonSN))
            {
                IList<Pizza> pizzas = pizzaRepository.GetCombinePizzaByCartonSN(cartonSN);
                foreach (Pizza p in pizzas)
                {
                    //if (!updatePizzas173.Contains(p.PizzaID))
                    updatePizzas173.Add(p);
                }
            }

            foreach (Pizza p in updatePizzasJC)
            {
                UnpackPizzaPart(p, "PKJOK");
                UpdatePizza(p, this.StationIdJC, null);
            }

            foreach (Pizza p in updatePizzas173)
            {
                UnpackPizzaPart(p, "PKJROK");
                UpdatePizza(p, this.StationId173, "");
            }

            return base.DoExecute(executionContext);
        }
Ejemplo n.º 14
0
        /// <summary> 
        /// </summary>        
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            //TODO 1
            ProductLog testLog = new ProductLog();
            var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();

            var product = CurrentSession.GetValue(Session.SessionKeys.Product) as IProduct;
            if (product == null)
            {
                throw new NullReferenceException("Product in session is null");
            }
            Model model = product.ModelObj;
            if (model == null)
            {
                List<string> errpara = new List<string>();
                errpara.Add(product.ProId);
                throw new FisException("CHK804", errpara);
            }
            if (model.Status == "0")
            {
                List<string> errpara = new List<string>();
                throw new FisException("CHK802", errpara);
            }
            if(product.State == "H")
            {
                List<string> errpara = new List<string>();
                throw new FisException("CHK802", errpara);
            }
            string value = (string)product.GetExtendedProperty("Exp");
            if (!String.IsNullOrEmpty(value))
            {
                List<string> errpara = new List<string>();                
                throw new FisException("CHK803", errpara);                         
            }

            IList<TsModelInfo> tsInfo = null;

            TsModelInfo cond = new TsModelInfo();
            cond.model = product.Model;
            cond.mark = "0";
            tsInfo = productRepository.GetTsModelList(cond);
            if(tsInfo != null && tsInfo.Count != 0)
            {
                List<string> errpara = new List<string>();                
                throw new FisException("CHK805", errpara);           
            }
            //
            
            IList<ProductLog> allLogs = new List<ProductLog>();


            cond.model = product.Model;
            cond.mark = "1";
            tsInfo = productRepository.GetTsModelList(cond);
            if(tsInfo == null || tsInfo.Count == 0)
            {
                allLogs = product.ProductLogs;
                IList<ProductLog> logs = new List<ProductLog>();
                ProductLog maxLog = new ProductLog();
                bool bExist = false;
                if(allLogs != null && allLogs.Count != 0)
                {
                    foreach(ProductLog temp in allLogs)
                    {
                        if(temp.Station == "66" && temp.Status == StationStatus.Pass)
                        {
                            bExist = true;
                            if(temp.Cdt.CompareTo(maxLog.Cdt) > 0)
                            {
                                maxLog = temp;
                            }
                        }
                        //else if(temp.Station == "73" || temp.Station == "74")
                        else if(temp.Station == "6A")
                        {
                            logs.Add(temp);
                        }
                    }
                    if (bExist == true)
                    {
                        foreach (ProductLog temp in logs)
                        {
                            if (temp.Cdt.CompareTo(maxLog.Cdt) > 0)
                            {
                                List<string> errpara = new List<string>();
                                throw new FisException("CHK807", errpara);
                            }
                        }
                    }
                }                
            }

            //UC 7
            allLogs = product.ProductLogs;
            if (allLogs != null && allLogs.Count > 0)
            {
                ProductLog maxLog = new ProductLog();
                foreach (ProductLog temp in allLogs)
                {
                    if (temp.Cdt.CompareTo(maxLog.Cdt) > 0)
                    {
                        maxLog = temp;
                    }
                }
                if (maxLog.Station == "66" && maxLog.Status == StationStatus.Fail)
                {
                    List<string> errpara = new List<string>();
                    throw new FisException("CHK806", errpara);
                }

                if (!(maxLog.Station == "66" && maxLog.Status == StationStatus.Pass))
                {
                    List<string> errpara = new List<string>();
                    throw new FisException("CHK845", errpara);
                }
            }

            //UC 8
            //ITC-1360-1787
            string[] code = new string[2];
            code[0] = product.Model;
            code[1] = product.CUSTSN;
            bool isHold = false;
            isHold = productRepository.CheckExistItcndCheckQcHold("1", code);
            if (isHold == true)
            {
                List<string> errpara = new List<string>();
                throw new FisException("CHK847", errpara);
            }

            //UC 9
            IBOMRepository bomRepository = RepositoryFactory.GetInstance().GetRepository<IBOMRepository>();
            IList<MoBOMInfo> mbinfo = new List<MoBOMInfo>();
            mbinfo = bomRepository.GetPnListByModelAndBomNodeTypeAndDescr(product.Model, "P1", "ECOA");
            if (mbinfo != null && mbinfo.Count > 0)
            {
                DateTime win8Time;
                DateTime logTime;
                //('P/N','KEY','HASH')
                string[] infotypes = new string[3];
                infotypes[0] = "P/N";
                infotypes[1] = "KEY";
                infotypes[2] = "HASH";
                win8Time = productRepository.GetNewestCdtFromProductInfo(product.ProId, infotypes);
                logTime = productRepository.GetNewestCdtFromProductLog(product.ProId, "66", 1);

                if (win8Time == DateTime.MinValue || logTime == DateTime.MinValue)
                {
                    List<string> errpara = new List<string>();
                    throw new FisException("CHK900", errpara);
                }

                if (DateTime.Compare(win8Time, logTime.AddMinutes(1)) > 0 ||
                    DateTime.Compare(logTime, win8Time.AddMinutes(1)) > 0)
                {
                    List<string> errpara = new List<string>();
                    throw new FisException("CHK901", errpara);
                }




                //UC10
                //最新的P/N:@ImgPN 
                //(ProductInfo.InfoValue Condtion: Uppder(ProductInfo.InfoType) = ‘P/N’ and ProductID=[ProductID] order by Udt desc)
                IList<string> infoTypes = new List<string>();
                infoTypes.Add("P/N");
                IList<IMES.FisObject.FA.Product.ProductInfo> proInfos = new List<IMES.FisObject.FA.Product.ProductInfo>();
                proInfos = productRepository.GetProductInfoListUpperCaseItemType(product.ProId, infoTypes);

                //获取BOM的ECOA的PN:@BOMPN (select b.PartNo from ModelBOM a (nolock), Part b (nolock) 
                //where a.Material = @Model
                //and a.Component = b.PartNo
                //and b.BomNodeType = 'P1'
                //and b.Descr LIKE 'ECOA%')

                //若@ImgPN与@BOMPN不相等,则报错:“ImageDownload 失败,ECOA PN 错误
                bool bCompare = false;
                if (proInfos != null && proInfos.Count > 0)
                {
                    foreach (MoBOMInfo temp in mbinfo)
                    {
                        if (temp.component == proInfos[0].InfoValue)
                        {
                            bCompare = true;
                            break;
                        }
                    }
                }
                if (bCompare == false)
                {
                    List<string> errpara = new List<string>();
                    throw new FisException("CHK927", errpara);
                }
            }

            

            return base.DoExecute(executionContext);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Wrint Product Log
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            IProduct currentProduct = null;
            RepairDefect defect = null;
            var newStatus = new ProductStatus();
            string ProductID = "";
            
            defect = (RepairDefect)CurrentSession.GetValue(Session.SessionKeys.CurrentRepairdefect);
            if (defect == null)
            {
                List<string> errpara = new List<string>();

                errpara.Add("CurrentRepairdefect");
                FisException e = new FisException("CHK194", errpara);
                e.stopWF = this.IsStopWF;
                throw e; 
            }

            if (IsNewProID) 
            {
                ProductID = defect.NewPartSno;//NEW
            }
            else 
            {
                ProductID = defect.OldPartSno;//OLD
            }
            //Vincent modify this for CQ CleanRoom trace maijor id is CT
            //currentProduct = productRepository.Find(ProductID);
            currentProduct = productRepository.GetProductByIdOrSn(ProductID);
            if (currentProduct==null)
            {
                List<string> errpara = new List<string>();

                errpara.Add(ProductID);
                FisException e = new FisException("SFC002", errpara);
                e.stopWF=this.IsStopWF;
                throw e; 
            }

            ProductID = currentProduct.ProId;
            //UnpackCarton
            if (!IsNewProID)
            {
                //var currentProductObject = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);
                //String cartonSN = currentProduct.CartonSN;
                //String palletNo = currentProduct.PalletNo;
                //String dn = currentProduct.DeliveryNo;
                //if (currentProduct != null)
                //{
                //    productId = currentProduct.ProId;
                //}
                productRepository.BackUpProduct(ProductID, this.Editor);
                //productRepository.CopyProductToUnpackDefered(CurrentSession.UnitOfWork, cartonSN, palletNo, dn, productId, this.Editor);
                currentProduct.CartonSN = "";
            }

            //write ProductStatusEx
            IList<IMES.DataModel.TbProductStatus> stationList = productRepository.GetProductStatus(new List<string> { currentProduct.ProId });
            productRepository.UpdateProductPreStationDefered(CurrentSession.UnitOfWork, stationList);
            
            //write ProductStatus
            newStatus.ProId = currentProduct.ProId;
            newStatus.Status = Status;
            newStatus.StationId = Station;
            newStatus.Editor = Editor;
            newStatus.Line =  currentProduct.Status.Line ;
            newStatus.TestFailCount = 0;
            newStatus.ReworkCode = "";
            currentProduct.UpdateStatus(newStatus);

           //write productLog
            var productLog = new ProductLog
            {
                Model = currentProduct.Model,
                Status = Status,
                Editor = Editor,
                Line = currentProduct.Status.Line,
                Station = Station,
                Cdt = DateTime.Now
            };
            currentProduct.AddLog(productLog);

            //write ProductTestLog
            if (this.IsWriteTestLog)
            {

            TestLog.TestLogStatus status = (Status== StationStatus.Pass? TestLog.TestLogStatus.Pass: TestLog.TestLogStatus.Fail);

            TestLogDefect defectItem = new TestLogDefect(0, 0,defect.DefectCodeID, this.Editor, DateTime.Now);
            //TestLog item = new TestLog(0, currentProduct.ProId, string.IsNullOrEmpty(Line) ? currentProduct.Status.Line : Line,
            //                                            "", Station, status, "", this.TestLogAction, "", "", this.Editor, "PRD", DateTime.Now);
            IList<TestLogDefect> defectItemList = new List<TestLogDefect>();
            defectItemList.Add(defectItem);

            TestLog item = new TestLog(0, currentProduct.ProId, currentProduct.Status.Line ,
                                               "", Station, defectItemList, status, "", this.TestLogAction, "", "", this.Editor, "PRD", DateTime.Now);
                       
                
            //item.AddTestLogDefect(defectItem);

            currentProduct.AddTestLog(item);
            }
            
            productRepository.Update(currentProduct, CurrentSession.UnitOfWork);
                

            return base.DoExecute(executionContext);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="passList"></param>
        /// <param name="failList"></param>
        /// <param name="reStation"></param>
        /// <param name="editor"></param>
        /// <param name="station"></param>
        /// <param name="customer"></param>
        /// <returns></returns>
        public ArrayList CheckProdPassList(IList<DataModel.ProductInfo> passList,IList<DataModel.ProductInfo> failList,
                                string reStation, string editor, string station, string customer)
        {
            logger.Debug("(ProductReinputImpl)CheckProdPassList start");

            try
            {
                ArrayList retList = new ArrayList();
                IList<DataModel.ProductInfo> okList = new List<DataModel.ProductInfo>();
                IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IMES.FisObject.FA.Product.IProduct>();
                IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
                IStationRepository stationRep = RepositoryFactory.GetInstance().GetRepository<IStationRepository>();

                foreach(DataModel.ProductInfo node in passList)
                {
                    //获取@MaxCdt (max(ProductLog.Cdt) Condtion: ProductLog.ProductID = @ProductID and Station=@ReturnStation)
                    //若@MaxCdt不存在或者为Null,则在[Fail List]添加显示:
                    //[Fail List].ProdId/CustSN = [ProductID]/[CustSN]
                    //[Fail List].Cause = ‘不能向后跳站’
                    //并在[Reinput List]删除该Product
                    IList<ProductLog> logList = new List<ProductLog>();
                    ProductLog eqCondition = new ProductLog();
                    string[] stList = { "" };
                    eqCondition.ProductID = node.id;
                    eqCondition.Station = reStation;
                    logList = productRep.GetProductLogList(eqCondition, stList);                  
                    //若@CurrentStation和@ReturnStation均在@FAStation之中,则进行如下Check:
                    //若@ReturnStation在@FAStation的位置比@CurrentStation在@FAStation的位置靠后(CHARINDEX(@ReturnStation,@FAStation,1)> CHARINDEX( @CurrentStation,@FAStation,1)),则在[Fail List]添加显示:
                    //[Fail List].ProdId/CustSN = [ProductID]/[CustSN]
                    //[Fail List].Cause = ‘不能向后跳站’
                    IList<string> valueList = new List<string>();
                    valueList = partRep.GetValueFromSysSettingByName("FAReturnStation");
                    bool backflag = false;
                    if (valueList[0].IndexOf(reStation) > valueList[0].IndexOf(node.modelId))
                    {
                        backflag = true;
                    }

                    DataModel.ProductInfo prod = node;
                    if (logList.Count == 0 || backflag)
                    {
                        prod.familyId = "不能向后跳站";
                        failList.Add(prod);
                    }
                    else
                    {
                        okList.Add(prod);
                    }
                }
                retList.Add(okList);
                retList.Add(failList);

                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("(ProductReinputImpl)CheckProdPassList end");
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Wrint Product Log
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            //if (Editor.Trim() == "")
            //    logger.Error("Editor from activity is empty!");

            string line = default(string);
            var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            if (IsSingle)
            {
                var product = CurrentSession.GetValue(Session.SessionKeys.Product) as IProduct;
                if (product == null)
                {
                    throw new NullReferenceException("Product in session is null");
                }

                line = string.IsNullOrEmpty(this.Line) ? product.Status.Line : this.Line;

                var productLog = new ProductLog
                {
                    Model = product.Model,
                    Status = Status,
                    Editor = Editor,
                    Line = line,
                    Station = Station,
                    Cdt = DateTime.Now
                };

                product.AddLog(productLog);
                productRepository.Update(product, CurrentSession.UnitOfWork);
            }
            else
            {
                var productList = CurrentSession.GetValue(Session.SessionKeys.ProdList) as List<IProduct>;
                if (productList == null)
                {
                    throw new NullReferenceException("ProdList in session is null");
                }
                foreach (var product in productList)
                {
                    line = string.IsNullOrEmpty(this.Line) ? product.Status.Line : this.Line;
                    var productLog = new ProductLog
                    {
                        Model = product.Model,
                        Status = Status,
                        Editor = Editor,
                        Line = line,
                        Station = Station,
                        Cdt = DateTime.Now
                    };

                    product.AddLog(productLog);
                    productRepository.Update(product, CurrentSession.UnitOfWork);
                }
            }

            return base.DoExecute(executionContext);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Wrint Product Log
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            if (Editor.Trim() == "")
                logger.Error("Editor from activity is empty!");

            var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();

            Boolean confFlag = (Boolean)CurrentSession.GetValue("ConfigPrint");
            
            Boolean WarrantyPrint = (Boolean)CurrentSession.GetValue("WarrantyPrint");

            var product = CurrentSession.GetValue(Session.SessionKeys.Product) as IProduct;
            if (product == null)
            {
                throw new NullReferenceException("Product in session is null");
            }
            
            //Check Asset SN:
            //Insert ProductLog: Station=SC,Line=PAK,Status=1

            string assetcheck = (string)CurrentSession.GetValue("AssetCheck");
            var assetProductLog = new ProductLog
            {
                Model = product.Model,
                Status = Status,
                Editor = Editor,
                Line = "PAK",
                Station = "SC",
                Cdt = DateTime.Now
            };
            if (assetcheck != "")
            {
                product.AddLog(assetProductLog);
                productRepository.Update(product, CurrentSession.UnitOfWork);
            }

            //打印Warranty Label:
            //Insert ProductLog: Station=8D, Line= WarrantyCardPrint, Status=1
            var warProductLog = new ProductLog
            {
                Model = product.Model,
                Status = Status,
                Editor = Editor,
                Line = "WarrantyCardPrint",
                Station = "8D",
                Cdt = DateTime.Now
            };
            if (WarrantyPrint)
            {
                product.AddLog(warProductLog);
                productRepository.Update(product, CurrentSession.UnitOfWork);
            }
           
            //打印CFG Label:
            //Insert ProductLog: Station=8D, Line= PAK, Status=1
            var cfgProductLog = new ProductLog
            {
                Model = product.Model,
                Status = Status,
                Editor = Editor,
                Line = "PAK",
                Station = "8D",
                Cdt = DateTime.Now
            };
            if (confFlag)
            {
                product.AddLog(cfgProductLog);
                productRepository.Update(product, CurrentSession.UnitOfWork);
            }

            return base.DoExecute(executionContext);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override System.Workflow.ComponentModel.ActivityExecutionStatus DoExecute(System.Workflow.ComponentModel.ActivityExecutionContext executionContext)
        { 
            IProduct product = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);
            IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            IDeliveryRepository deliveryRep = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
            IPalletRepository palletRep = RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>();
            carton.ICartonSSCCRepository cartRep = RepositoryFactory.GetInstance().GetRepository<carton.ICartonSSCCRepository, IMES.FisObject.PAK.CartonSSCC.CartonSSCC>();

            try
            {
                //2.	Assign Pallet
                //Assign Pallet 的方法:
                //1.	找到与Product.DeliveryNo 结合的Pallets  
                //2.	取其中尚未完成Combine PO in Carton 的Pallets
                //3.	按照Pallet No 正序,和Pallet 已经完成Combine PO in Carton 的数量逆序排序,取第一个Pallet
                //DECLARE @dn char(16)
                //DECLARE @pea float
                //DECLARE @pea2 int
                //SELECT @pea = InfoValue FROM DeliveryInfo (NOLOCK) WHERE DeliveryNo=@dn AND InfoType = ‘CQty’
                string peastr;
                Delivery dev = deliveryRep.Find(product.DeliveryNo);
                peastr = (string)dev.GetExtendedProperty("CQty");

                int pea = 0;
                if (string.IsNullOrEmpty(peastr))
                {
                    pea = 0;
                }
                else
                {
                    decimal tmp = Convert.ToDecimal(peastr);
                    pea = Convert.ToInt32(tmp);
                }
                

                //SET @pea2=CONVERT(int, @pea)
                //CREATE TABLE #plt (Plt char(14), qty int, tot int)
                //CREATE TABLE #Pltamount (Plt char(14), qty int)

                //INSERT #plt 
	            //SELECT PalletNo, DeliveryQty, 0 
		        //FROM Delivery_Pallet (NOLOCK) 
		        //WHERE DeliveryNo=@dn 
                IList<DeliveryPalletInfo> palletList = deliveryRep.GetDeliveryPalletListByDN(product.DeliveryNo);

                //INSERT #Pltamount
	            //SELECT PalletNo, COUNT(ProductID) as Qty
		        //FROM Product (NOLOCK)
		        //WHERE DeliveryNo = @dn 
                IList<IProduct> mountList = productRep.GetProductListByDeliveryNo(product.DeliveryNo);

                //UPDATE #plt SET tot = b.qty FROM #plt a,#Pltamount b
                //WHERE a.Plt=b.Plt
                //SELECT * FROM #plt

                //DELETE FROM #plt WHERE @pea2 * CONVERT(int, qty) – CONVERT(int, tot) < 1
                //SELECT * FROM #plt
                 for (int i = palletList.Count-1; i >= 0; i--)
                {
                    DeliveryPalletInfo node = palletList[i];
                    IList <ProductModel> proList = productRep.GetProductByDnPallet(product.DeliveryNo,node.palletNo);

                    if ((proList != null) && (proList.Count > 0))
                    {
                        int tot = proList.Count;
                        int qty = node.deliveryQty;
                        node.id = tot;
                        if (pea*qty - tot <1)
                        {
                            //ITC-1414-0116
                            palletList.RemoveAt(i);
                        }
                    }
                }
                //SELECT TOP 1 Plt as [Pallet No]
	            //FROM #plt 
	            //ORDER BY Plt, tot DESC
                 var tmpList = from item in palletList orderby item.palletNo, item.id descending select item;
                 IList<DeliveryPalletInfo> orderList = tmpList.ToList<DeliveryPalletInfo>();

                 string palletNo = orderList[0].palletNo;

                //3.	Assign Location by Pallet
                //IF EXISTS(SELECT SnoId FROM PAK_LocMas (NOLOCK)WHERE Tp='PakLoc' AND Pno=@PalletNo) 
                //BEGIN
	            //    SELECT @loc=SnoId FROM PAK_LocMas(NOLOCK) WHERE Tp='PakLoc' AND Pno=@PalletNo
                //END
                //ELSE
                //BEGIN
	            //IF EXISTS(SELECT SnoId FROM PAK_LocMas(NOLOCK) WHERE Tp='PakLoc' AND Pno='' )
	            //BEGIN
		        //SELECT @loc=SnoId FROM PAK_LocMas(NOLOCK) WHERE Tp='PakLoc' AND Pno='' ORDER BY CONVERT(int, SnoId)
		        //UPDATE PAK_LocMas SET Pno=@PalletNo,Udt=GETDATE() WHERE Tp='PakLoc' AND SnoId=@loc
	            //END
	            //ELSE	
	            //BEGIN
		        //SELECT @loc='Others'
	            //END	
                //END

                //@PalletNo – 上文分配的Pallet No
                //@loc – 系统分配的库位
                 string loc = "";
                 IList<PakLocMasInfo> macList = palletRep.GetPakLocMasList(palletNo, "PakLoc");
                 if (macList.Count > 0)
                 {
                     loc = macList[0].snoId;
                 }
                 else
                 {
                     macList = palletRep.GetPakLocMasList("", "PakLoc");
                     if (macList.Count > 0)
                     {
                         PakLocMasInfo locInfo = macList[0];
                         foreach (var item in macList)
                         {
                             if (Convert.ToInt64(locInfo.snoId) > Convert.ToInt64(item.snoId))
                             {
                                 locInfo = item;
                             }
                         }
                         loc = locInfo.snoId;

                         PakLocMasInfo sitem= new PakLocMasInfo();
                         PakLocMasInfo cond= new PakLocMasInfo();
                         sitem.pno= palletNo;
                         sitem.udt = DateTime.Now;
                         cond.tp = "PakLoc";
                         cond.snoId = loc;
                         palletRep.UpdatePakLocMasInfoDefered(CurrentSession.UnitOfWork,sitem,cond );

                     }
                     else
                     {
                         loc = "Others";
                     }
                 }
                 CurrentSession.AddValue("Location",loc);

                //4.	Product结合Pallet and Carton    
                //将页面上[Products in Carton] 中的每一个Product和上文系统分配的Pallet 以及上文生成的Carton No 进行结合 – Update Product
                //Product.PalletNo – Pallet No
                //Product.CartonSN – Carton No

                 IList<IProduct> productList = (List<IProduct>)CurrentSession.GetValue(Session.SessionKeys.ProdList);
                 foreach (var item in productList)
                 {
                     item.PalletNo = palletNo;
                     item.CartonSN = product.CartonSN;
                     //productRep.Update(item,CurrentSession.UnitOfWork);
                     productRep.UpdateForBindDNAndPalletDefered(CurrentSession.UnitOfWork, (Product)item);
                 }

                //ITC-1414-0070
                //ITC-1414-0120
                //5.	更新CartonStatus 的状态为95 (Station = ‘95’ ,Status= ‘1’),记录CartonLog
                CartonStatusInfo sinfo = new CartonStatusInfo();
                CartonStatusInfo sconf = new CartonStatusInfo();
                sconf.cartonNo = product.CartonSN;

                sinfo.editor = Editor;
                sinfo.line = Line;
                sinfo.station ="95";//Station;
                sinfo.status = 1;//pass
                sinfo.udt = DateTime.Now;
                cartRep.UpdateCartonStatusDefered(CurrentSession.UnitOfWork,sinfo,sconf);

                CartonLogInfo linfo = new CartonLogInfo();
                linfo.cartonNo = product.CartonSN;
                linfo.editor = Editor;
                linfo.line = Line;
                linfo.station = "95";
                linfo.status = 1;//pass
                linfo.cdt = DateTime.Now;
                cartRep.AddCartonLogInfoDefered(CurrentSession.UnitOfWork, linfo);

                 //6.更新Carton上所有Product 的ProductStatus 的状态为Combine Po In Carton for Docking 的站号(Station = Combine Po In Carton for Docking 的站号,Status= ‘1’),并记录ProductLog
                 string line = string.IsNullOrEmpty(this.Line) ? product.Status.Line : this.Line;

                 var newStatus = new IMES.FisObject.FA.Product.ProductStatus();
                 newStatus.Editor = Editor;
                 newStatus.Line = line;
                 newStatus.StationId = Station;
                 newStatus.Status = IMES.FisObject.Common.Station.StationStatus.Pass;

                 IList<string> ProductIDList = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.NewScanedProductIDList);
                 productRep.UpdateProductListStatusDefered(CurrentSession.UnitOfWork, newStatus, ProductIDList);

                 foreach (var item in productList)
                 {
                     var productLog = new ProductLog
                     {
                         Model = item.Model,
                         Status = IMES.FisObject.Common.Station.StationStatus.Pass,
                         Editor = Editor,
                         Line = line,
                         Station = Station,
                         Cdt = DateTime.Now
                     };

                     item.AddLog(productLog);
                     productRep.Update(item, CurrentSession.UnitOfWork);
                 }
            }
            catch (Exception)
            {
                throw;
            }
            
            return base.DoExecute(executionContext);
        }
Ejemplo n.º 20
0
        /// <summary> 
        /// </summary>        
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            //TODO 1
            ProductLog testLog = new ProductLog();
            var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();

            var product = CurrentSession.GetValue(Session.SessionKeys.Product) as IProduct;
            if (product == null)
            {
                throw new NullReferenceException("Product in session is null");
            }
            Model model = product.ModelObj;
            if (model == null)
            {
                List<string> errpara = new List<string>();
                errpara.Add(product.ProId);
                throw new FisException("CHK804", errpara);
            }
            if (model.Status == "0")
            {
                List<string> errpara = new List<string>();
                throw new FisException("CHK802", errpara);
            }
            if(product.State == "H")
            {
                List<string> errpara = new List<string>();
                throw new FisException("CHK802", errpara);
            }
            string value = (string)product.GetExtendedProperty("Exp");
            if (!String.IsNullOrEmpty(value))
            {
                List<string> errpara = new List<string>();                
                throw new FisException("CHK803", errpara);
            }

            #region mark by Vincent
            //IList<TsModelInfo> tsInfo = null;

            //TsModelInfo cond = new TsModelInfo();
            //cond.model = product.Model;
            //cond.mark = "0";
            //tsInfo = productRepository.GetTsModelList(cond);
            //if(tsInfo != null && tsInfo.Count != 0)
            //{
            //    List<string> errpara = new List<string>();                
            //    throw new FisException("CHK805", errpara);           
            //}
            ////
            
            //IList<ProductLog> allLogs = new List<ProductLog>();


            //cond.model = product.Model;
            //cond.mark = "1";
            //tsInfo = productRepository.GetTsModelList(cond);
            //if(tsInfo == null || tsInfo.Count == 0)
            //{
            //    allLogs = product.ProductLogs;
            //    IList<ProductLog> logs = new List<ProductLog>();
            //    ProductLog maxLog = new ProductLog();
            //    bool bExist = false;
            //    if(allLogs != null && allLogs.Count != 0)
            //    {
            //        foreach(ProductLog temp in allLogs)
            //        {
            //            if(temp.Station == "66" && temp.Status == StationStatus.Pass)
            //            {
            //                bExist = true;
            //                if(temp.Cdt.CompareTo(maxLog.Cdt) > 0)
            //                {
            //                    maxLog = temp;
            //                }
            //            }
            //            //else if(temp.Station == "73" || temp.Station == "74")
            //            else if(temp.Station == "6A")
            //            {
            //                logs.Add(temp);
            //            }
            //        }
            //        if (bExist == true)
            //        {
            //            foreach (ProductLog temp in logs)
            //            {
            //                if (temp.Cdt.CompareTo(maxLog.Cdt) > 0)
            //                {
            //                    List<string> errpara = new List<string>();
            //                    throw new FisException("CHK807", errpara);
            //                }
            //            }
            //        }
            //    }                
            //}

            ////UC 7
            //allLogs = product.ProductLogs;
            //if (allLogs != null && allLogs.Count > 0)
            //{
            //    ProductLog maxLog = new ProductLog();
            //    foreach (ProductLog temp in allLogs)
            //    {
            //        if (temp.Cdt.CompareTo(maxLog.Cdt) > 0)
            //        {
            //            maxLog = temp;
            //        }
            //    }
            //    if (maxLog.Station == "66" && maxLog.Status == StationStatus.Fail)
            //    {
            //        List<string> errpara = new List<string>();
            //        throw new FisException("CHK806", errpara);
            //    }

            //    if (!(maxLog.Station == "66" && maxLog.Status == StationStatus.Pass))
            //    {
            //        List<string> errpara = new List<string>();
            //        throw new FisException("CHK845", errpara);
            //    }
            //}
            #endregion

            //UC 8
            //ITC-1360-1787
            string[] code = new string[2];
            code[0] = product.Model;
            code[1] = product.CUSTSN;
            bool isHold = false;
            isHold = productRepository.CheckExistItcndCheckQcHold("1", code);
            if (isHold == true)
            {
                List<string> errpara = new List<string>();
                throw new FisException("CHK847", errpara);
            }

            IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();

            // mantis 485
            bool needCheck6R = true;
            IList<ConstValueTypeInfo> lstConstValueType = partRepository.GetConstValueTypeList("NoCheckRunInTimeSN");
            if (null != lstConstValueType)
                foreach (ConstValueTypeInfo vi in lstConstValueType)
                {
                    if (null != product.CUSTSN && product.CUSTSN.Equals(vi.value))
                    {
                        needCheck6R = false;
                        break;
                    }
                }

            if (needCheck6R)
            {
                lstConstValueType = partRepository.GetConstValueTypeList("NoCheckRunInTimeModel");
                if (null != lstConstValueType)
                {
                    foreach (ConstValueTypeInfo vi in lstConstValueType)
                    {
                        if (null != product.Model && product.Model.Equals(vi.value))
                        {
                            needCheck6R = false;
                            break;
                        }
                    }

                    if (needCheck6R)
                    {
                        foreach (ConstValueTypeInfo vi in lstConstValueType)
                        {
                            if (null != product.Family && product.Family.Equals(vi.value))
                            {
                                needCheck6R = false;
                                break;
                            }
                        }
                    }
                }
            }


            //UC 9
            IBOMRepository bomRepository = RepositoryFactory.GetInstance().GetRepository<IBOMRepository>();
            //Marked by Benson at 20130517
          //  IList<MoBOMInfo> mbinfo = new List<MoBOMInfo>();
            //mbinfo = bomRepository.GetPnListByModelAndBomNodeTypeAndDescr(product.Model, "P1", "ECOA");
            //Marked by Benson at 20130517
            IList<MoBOMInfo> mbinfo = new List<MoBOMInfo>();
            mbinfo = GetWin8Bom(product.Model);
            if (mbinfo != null && mbinfo.Count > 0)
           {
               if (NeedCheckOA3Time(product))
               {
                   DateTime win8Time;
                   DateTime logTime;
                   //('P/N','KEY','HASH')
                   string[] infotypes = new string[3];
                   infotypes[0] = "P/N";
                   infotypes[1] = "KEY";
                   infotypes[2] = "HASH";
                   win8Time = productRepository.GetNewestCdtFromProductInfo(product.ProId, infotypes);
                   logTime = productRepository.GetNewestCdtFromProductLog(product.ProId, "66", 1);

                   if (win8Time == DateTime.MinValue || logTime == DateTime.MinValue)
                   {
                       List<string> errpara = new List<string>();
                       //throw new FisException("CHK900", errpara);
                       errpara.Add("");
                       // ImageDownload 失败 %1
                       throw new FisException("CQCHK0034", errpara);
                   }

                   // mantis 430, FA ITCNDTS 站卡win8 key上传时间 需要维护
                   int win8TimeoutSecond = 60;
                   IList<string> valueList = partRepository.GetValueFromSysSettingByName("Win8KeyUploadTimeOut");
                   if (valueList != null && valueList.Count > 0)
                   {
                       win8TimeoutSecond = Convert.ToInt16(valueList[0]);
                   }
                   IList<ConstValueInfo> constlist = partRepository.GetConstValueListByType("Win8KeyUploadTimeOut").Where(x=>x.name==product.Family).ToList();
                   if (constlist != null && constlist.Count > 0)
                   {
                       win8TimeoutSecond = Convert.ToInt16(constlist[0].value);
                   }
                   if (DateTime.Compare(win8Time, logTime.AddSeconds(win8TimeoutSecond)) > 0 ||
                       DateTime.Compare(logTime, win8Time.AddSeconds(win8TimeoutSecond)) > 0)
                   {
                       List<string> errpara = new List<string>();
                       throw new FisException("CHK901", errpara);
                   }
               }

                //UC10
                //最新的P/N:@ImgPN 
                //(ProductInfo.InfoValue Condtion: Uppder(ProductInfo.InfoType) = ‘P/N’ and ProductID=[ProductID] order by Udt desc)
                IList<string> infoTypes = new List<string>();
                infoTypes.Add("P/N");
                IList<IMES.FisObject.FA.Product.ProductInfo> proInfos = new List<IMES.FisObject.FA.Product.ProductInfo>();
                proInfos = productRepository.GetProductInfoListUpperCaseItemType(product.ProId, infoTypes);

                //获取BOM的ECOA的PN:@BOMPN (select b.PartNo from ModelBOM a (nolock), Part b (nolock) 
                //where a.Material = @Model
                //and a.Component = b.PartNo
                //and b.BomNodeType = 'P1'
                //and b.Descr LIKE 'ECOA%')

                //若@ImgPN与@BOMPN不相等,则报错:“ImageDownload 失败,ECOA PN 错误
                bool bCompare = false;
                if (proInfos != null && proInfos.Count > 0)
                {
                    foreach (MoBOMInfo temp in mbinfo)
                    {
                        if (temp.component == proInfos[0].InfoValue)
                        {
                            bCompare = true;
                            break;
                        }
                    }
                }
                if (bCompare == false)
                {
                    List<string> errpara = new List<string>();
                    throw new FisException("CHK927", errpara);
                }
            }
            
            

            // UC11 OA3
            var site = CurrentSession.GetValue("Site") as string;
            if (!"ICC".Equals(site))
            {
                //UC11(win8)
                //前提条件:Select Upper(Value)  from ConstValue nolock
                //where Type = 'CheckOA3State'
                //and Name = left(ProductStatus.Line,1)
                //等于“N”,则不进行下面的操作;未维护数据或者不等于“N”,则继续执行下面的操作
                //请参考《CI-MES12-SPEC-PAK-UC Upload Shipment Data to SAP.docx》2.1.5 Step 5 Check OA3 状态

                IList<ConstValueInfo> cvInfo = new List<ConstValueInfo>();

                ConstValueInfo cvCond = new ConstValueInfo();
                cvCond.type = "CheckOA3State";
                cvCond.name = product.Status.Line.Substring(0, 1);
                cvInfo = partRepository.GetConstValueInfoList(cvCond);
                if (cvInfo == null || cvInfo.Count == 0)
                {
                    //do
                    CheckOA3(product);
                }
                else
                {
                    bool findN = false;
                    foreach (ConstValueInfo tmp in cvInfo)
                    {
                        if (tmp.value.ToUpper() == "N")
                        {
                            findN = true;
                            break;
                        }
                    }
                    if (findN == false)
                    {
                        //do
                        CheckOA3(product);
                    }
                }
            }

            // UC12 ICC run in time
            if ("ICC".Equals(site))
            {
                ProductLog log65 = productRepository.GetLatestLogByWcAndStatus(product.ProId, "65", 1);
                if (null == log65)
                {
                    List<string> errpara = new List<string>();
                    errpara.Add("65");
                    throw new FisException("CHK1008", errpara); // 無記錄
                }
                DateTime time65 = log65.Cdt;
                //6R 不會上傳fail
                //ProductLog log6RFail = productRepository.GetLatestLogByWcAndStatus(product.ProId, "6R", 0);
                //if (log6RFail != null && log65.Cdt < log6RFail.Cdt)
                //{
                //    time65 = log6RFail.Cdt;
                //}

                

                ConstValueInfo cvCond = null;
                IList<ConstValueInfo> cvInfo = null;
                int allowedTime = -1;

                if (needCheck6R)
                {
                    // UC.a
                    ProductLog log6R = productRepository.GetLatestLogByWcAndStatus(product.ProId, "6R", 1);
                    //if (null == log6R || time65 > log6R.Cdt)
                    if (log6R == null)
                    {
                        List<string> errpara = new List<string>();
                        errpara.Add("6R");
                        throw new FisException("CHK1008", errpara); // 無記錄
                    }
                    DateTime time6R = log6R.Cdt;

                    cvCond = new ConstValueInfo();
                    cvCond.type = "ImageRuninTime";
                    cvCond.name = product.Family;
                    cvInfo = partRepository.GetConstValueInfoList(cvCond);
                    if (cvInfo == null || cvInfo.Count == 0 || string.IsNullOrEmpty(cvInfo[0].value) || "0".Equals(cvInfo[0].value))
                    {
                        List<string> errpara = new List<string>();
                        errpara.Add("Image run in time");
                        throw new FisException("CHK1009", errpara); // Image run in time 未設定時間差,請聯繫IE設定
                    }

                    allowedTime = Convert.ToInt16(cvInfo[0].value);
                    if (allowedTime > Math.Abs((time6R - time65).TotalMinutes))
                    {
                        List<string> errpara = new List<string>();
                        errpara.Add("Image run in test");
                        throw new FisException("CHK1010", errpara); // Image run in test不足
                    }

                    // UC.b
                    ProductLog log66 = productRepository.GetLatestLogByWcAndStatus(product.ProId, "66", 1);
                    if (null == log66 || log65.Cdt > log66.Cdt)
                    {
                        List<string> errpara = new List<string>();
                        errpara.Add("66");
                        throw new FisException("CHK1008", errpara); // 無記錄
                    }
                    DateTime time66 = log66.Cdt;

                    cvCond = new ConstValueInfo();
                    cvCond.type = "PostTestTime";
                    cvCond.name = product.Family;
                    cvInfo = partRepository.GetConstValueInfoList(cvCond);
                    if (cvInfo == null || cvInfo.Count == 0 || string.IsNullOrEmpty(cvInfo[0].value) || "0".Equals(cvInfo[0].value))
                    {
                        List<string> errpara = new List<string>();
                        errpara.Add("Post Test time");
                        throw new FisException("CHK1009", errpara); // Post Test time 未設定時間差,請聯繫IE設定
                    }
                    allowedTime = Convert.ToInt16(cvInfo[0].value);
                    if (allowedTime < (DateTime.Now - time66).TotalMinutes)
                    {
                        List<string> errpara = new List<string>();
                        errpara.Add("Post test");
                        throw new FisException("CQCHK1004", errpara); // Post test 超時
                    }
                }
                
            }

            // UC ICC bios
            if ("ICC".Equals(site))
            {
                ConstValueInfo cvCond = new ConstValueInfo();
                cvCond.type = "BIOSVer";
                cvCond.name = product.Model;
                IList<ConstValueInfo> cvInfo = partRepository.GetConstValueInfoList(cvCond);
                if (cvInfo == null || cvInfo.Count == 0)
                {
                    cvCond.name = product.Model.Substring(0, 6);
                    cvInfo = partRepository.GetConstValueInfoList(cvCond);
                }
                if (cvInfo != null && cvInfo.Count > 0)
                {
                    string[] BIOSVerList = cvInfo[0].value.Split('~');

                    List<string> infoTypes = new List<string>();
                    infoTypes.Add("BIOS");
                    IList<IMES.FisObject.FA.Product.ProductInfo> proInfos = productRepository.GetProductInfoListUpperCaseItemType(product.ProId, infoTypes);
                    if (proInfos != null && proInfos.Count > 0)
                    {
                        foreach (IMES.FisObject.FA.Product.ProductInfo pi in proInfos)
                        {
                            if (string.IsNullOrEmpty(pi.InfoValue))
                            {
                                List<string> errpara = new List<string>();
                                errpara.Add("BIOS");
                                throw new FisException("CHK1011", errpara); // 相关信息还未上传
                            }
                            bool bCompareBios = false;
                            for (int i = 0; i < BIOSVerList.Length; i++)
                            {
                                if (pi.InfoValue.Equals(BIOSVerList[i]))
                                {
                                    bCompareBios = true;
                                    break;
                                }
                            }
                            if (!bCompareBios)
                            {
                                List<string> errpara = new List<string>();
                                errpara.Add("BIOS");
                                throw new FisException("CHK1012", errpara); // BIOS 版本錯誤
                            }
                        }
                    }
                }
                else   // throw error 
                {
                    throw new FisException("CHK1070", new string[] { product.Model });
                }
            }

            return base.DoExecute(executionContext);
        }