Пример #1
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);
            }

        }
Пример #2
0
        /// <summary> 
        /// </summary>        
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var currentStation = default(string);

            currentStation = Station;

            IList<IProduct> prodList = new List<IProduct>();
            prodList = (IList<IProduct>)CurrentSession.GetValue(Session.SessionKeys.ProdList);

            foreach (IProduct currentProduct in prodList)
            {
                var newStatus = new ProductStatus();

                string line = default(string);
                if (string.IsNullOrEmpty(this.Line))
                {
                    line = currentProduct.Status.Line;
                }
                else
                {
                    line = this.Line;
                }

                newStatus.Status = StationStatus.Pass;
                newStatus.StationId = currentStation;
                newStatus.Editor = Editor;
                newStatus.Line = line;

                newStatus.TestFailCount = 0;
                
                IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
                if (!string.IsNullOrEmpty(currentProduct.Status.ReworkCode) && productRepository.IsLastReworkStation(currentProduct.Status.ReworkCode, Station, (int)StationStatus.Pass))
                {
                    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(CurrentSession.UnitOfWork, r, currentProduct.ProId);
                }
                else
                {
                    newStatus.ReworkCode = currentProduct.Status.ReworkCode;
                }
                newStatus.ProId = currentProduct.ProId;


                currentProduct.UpdateStatus(newStatus);

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

            return base.DoExecute(executionContext);
        }
Пример #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);

        }
Пример #4
0
        /// <summary>
        /// 执行根据Carton修改所有属于该Carton的Product状态的操作
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            Pallet currentPallet = (Pallet)CurrentSession.GetValue(Session.SessionKeys.Pallet);

            String PalletNo = currentPallet.PalletNo;

            ProductStatus newStatus = new ProductStatus();
            newStatus.Editor = Editor;
            newStatus.Line = Line;
            newStatus.StationId = Station;
            newStatus.Status = Status;
            newStatus.ReworkCode = "";


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

            List<string> productIDList = new List<string>();

            productIDList = productRepository.GetProductIDListByPalletNo(PalletNo);



//            CurrentSession.AddValue(Session.SessionKeys.NewScanedProductIDList, productIDList);


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


            
            return base.DoExecute(executionContext);
        }
Пример #5
0
 /// <summary>
 /// 更新ProductStatus
 /// </summary>
 /// <param name="station">station</name>
 /// <param name="status">status</name>
 /// <param name="editor">editor</name>
 /// <param name="prod">prod</name>
 /// <returns></returns>
 public void UpdateProStatus(string station, string status, string editor, string prod)
 {
     IMES.FisObject.FA.Product.ProductStatus newStatus = new IMES.FisObject.FA.Product.ProductStatus();
     newStatus.Editor = status;
     newStatus.StationId = station;
     newStatus.Udt = DateTime.Now;
     string[] prodIds = new string[1];
     prodIds[0] = prod;
     try
     {
          productRepository.UpdateProductStatuses(newStatus, prodIds);
     }
     catch (Exception ee)
     {
         throw ee;
     }
 }
Пример #6
0
        /// <summary>
        /// To the input COANumber, check.
        ///    1. if it exists in the given table.
        ///    2. COAStatus.Status必须是'A1'
        ///    3. 此COA不可已经与机器绑定并且该机器当前在“85”或“9A”站。
        /// </summary>
        /// <param name="COANumber"></param>
        /// <param name="pdLine"></param>
        /// <param name="prodId"></param>
        /// <param name="editor"></param>
        /// <param name="stationId"></param>
        /// <param name="customerId"></param>
        /// <returns></returns>
        public ArrayList InputCOANumber(/*string _guid, */string COANumber, string pdLine, string prodId, string editor, string stationId, string customerId, string action, string cause)
        {
            logger.Debug("(_COARemoval)InputCOANumber start, COANumber:" + COANumber + " pdLine:" + pdLine + " prodId:" + prodId + " editor:" + editor + " stationId:" + stationId + " customerId:" + customerId);
            ArrayList this_array_list_return = new ArrayList();
           // FisException ex;
            List<string> erpara = new List<string>();
            //string sessionKey = prodId;
            try
            {
                string CurrentCOASN = COANumber;
                IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
                ICOAStatusRepository coaStatusRepository = RepositoryFactory.GetInstance().GetRepository<ICOAStatusRepository, COAStatus>();
                /* 1)所输入COA No在COAStatus数据表中存在。否则提示“无此COA记录!”
                 */
                COAStatus status = coaStatusRepository.Find(CurrentCOASN);
                if (status == null)
                {
                    //This COA does not exist!
                    FisException _ex = new FisException("CHK235", new string[]{});
                    throw _ex;
                }

                /* 2)5.	For Remove,COAStatus.Status必须是'A1'; 
                 * For Scrap,COAStatus.Status必须是'A0' or 'A2' or 'A3'。
                 * 否则提示 该COA的当前状态是”+COAStatus.Status+“。”
                 */
                if (action != "scrap")
                {
                    if (!status.Status.Equals("A1"))
                    {
                        // Only can remove a COA whose status is 'A1', current COA's status is %1
                        FisException _ex = new FisException("CHK236", new string[] { status.Status });
                        throw _ex;
                    }

                }
                else
                {
                    if (!status.Status.Equals("A0") && !status.Status.Equals("A2") && !status.Status.Equals("A3"))
                    {
                        // Only can remove a COA whose status is 'A0''A2''A3', current COA's status is %1
                        FisException _ex = new FisException("CHK525", new string[] { status.Status });
                        throw _ex;
                    }
                    var cond = new COAReturnInfo();
                    cond.coasn = "coano";
                    /*示例
                    var set = [ICOAStatusRepository Instance].GetCOAReturnInfoList(cond, null);
                    int cnt = (from item in set where item.status == string.Empty select item).Count();*/
                    IList<COAReturnInfo> coareturnlist = coaStatusRepository.GetCOAReturnInfoList(cond, null);
                    if (coareturnlist.Count != 0)
                    {
                        //报告错误:“该COA No 已Scarp!” !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!未改全
                        FisException _ex = new FisException("CHK526", new string[] { });
                        throw _ex;

                    }


                }
                /* 
                 *  Attention: now I think status.IECPN 就是 product 的 SN
                 *             所以,从它来得到 product 对象
                 *             
                 * 3)此COA不可已经与机器绑定并且该机器当前在“85”或“9A”站。否则提示“机器已上栈板或已经出货 !!”
                 * 
                 *   If exists (select a.ProductID from Product a (nolock), 
                 *   Product_Part b (nolock), ProductStatus c (nolock) 
                 *   where a.ProductID=b.ProductID and b.PartSn=@coano and 
                 *   a.ProductID=c.ProductID and (c.Station=’85’ or c.Station=’9A’))
                 * 
                 * IProductRepository::
                 *   bool CheckExistProductByPartSnAndStations(string partSn, string[] stations);
                 * 
                 */
                string partSn = CurrentCOASN;
/////////////////////////////////////////////////////////////////////////

                string productID = "";
                string CUSTSN = "";
                bool first_in = true;

                IMES.FisObject.FA.Product.ProductStatus newStatus = new IMES.FisObject.FA.Product.ProductStatus();
                IList<string> product_list = new List<string>();
                IList<ProductAndCustInfo> product_and_cust_info_list = productRep.GetProductAndCustInfoListByPartSn(partSn);
                foreach (ProductAndCustInfo node in product_and_cust_info_list)
                {
                    if (first_in)
                    {

                        productID = node.productId;
                        IProduct _product = productRep.FindOneProductWithProductIDOrCustSN(productID);
                        CUSTSN = node.custSn;

                        COAReturnInfo cod = new COAReturnInfo();
                        cod.custsn = CUSTSN;
                        IList<COAReturnInfo> reCOAReturnInfo = coaStatusRepository.GetCOAReturnInfoList(cod, null);
                        if (reCOAReturnInfo.Count == 0)
                        {

                            string[] stations = { "85", "9A" };
                            if (productRep.CheckExistProductByPartSnAndStations(partSn, stations) || productRep.CheckExistProductByPartSnAndStationsWithPizzaPart(partSn, stations))
                            {
                                FisException _ex = new FisException("CHK237", new string[] { }); //"Machine has been in stack or out!"
                                throw _ex;
                            }
                        }
                        first_in = false;
                    }
                    break;
                }
                IList<IProduct> pizza_list = productRep.GetProductInfoListByPizzaPartSn(partSn);
                foreach (IProduct node in pizza_list)
                {
                    productID = node.ProId;

                    IProduct _product = productRep.FindOneProductWithProductIDOrCustSN(productID);
                    CUSTSN = node.CUSTSN;

                    COAReturnInfo cod = new COAReturnInfo();
                    cod.custsn = CUSTSN;
                    IList<COAReturnInfo> reCOAReturnInfo = coaStatusRepository.GetCOAReturnInfoList(cod, null);
                    if (reCOAReturnInfo.Count == 0)
                    {

                        string[] stations = { "85", "9A" };
                        if (productRep.CheckExistProductByPartSnAndStations(partSn, stations) || productRep.CheckExistProductByPartSnAndStationsWithPizzaPart(partSn, stations))
                        {
                            FisException _ex = new FisException("CHK237", new string[] { }); //"Machine has been in stack or out!"
                            throw _ex;
                        }
                    }



                    break;
                }
/////////////////////////////////////////////////////////////////////////


                this_array_list_return.Add("OK!");
                this_array_list_return.Add(COANumber);
                this_array_list_return.Add(action);
                this_array_list_return.Add(cause);

                return this_array_list_return;

        }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                logger.Debug("(_COARemoval)InputCOANumber end, COANumber:" + COANumber + " pdLine:" + pdLine + " prodId:" + prodId + " editor:" + editor + " stationId:" + stationId + " customerId:" + customerId);
            }
        }
Пример #7
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="session"></param>
        /// <param name="product"></param>
        /// <param name="conditionInfoList"></param>
        /// <param name="productPart"></param>
        /// <param name="editor"></param>
        public static void UnPackProduct(Session session,
                                                            IProduct product,
                                                          IList<ConstValueInfo> conditionInfoList,
                                                          IProductPart productPart,
                                                          string editor)
        {

            var matchInfo = conditionInfoList.Where(x => x.name == productPart.PartType).FirstOrDefault();
            //IProductRepository prodRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository>();

            if (matchInfo != null)
            {
                string returnStation = matchInfo.value;
                string snRE = matchInfo.description;
                string custSN = null;
                if (string.IsNullOrEmpty(snRE)  ||
                    !snRE.Contains("<SN>"))
                {
                    custSN = productPart.PartSn;
                }
                else
                {
                    Match match = Regex.Match(productPart.PartSn, snRE, RegexOptions.Compiled);
                    if (match.Success)
                    {                       
                        Group groupSN =match.Groups["SN"];
                        if (groupSN != null && 
                            groupSN.Success)
                        {
                            custSN = groupSN.Value;
                        }
                    }
                }
                if (!string.IsNullOrEmpty(custSN))
                {
                    IProduct unpackProd = prodRep.FindOneProductWithProductIDOrCustSN(custSN);
                    if (unpackProd != null)
                    {
                        DateTime now = DateTime.Now;

                        unpackProd.AddLog(new ProductLog
                        {
                            ProductID = unpackProd.ProId,
                            Model = unpackProd.Model,
                            Line = unpackProd.Status.Line,
                            Station = returnStation,
                            Status = IMES.FisObject.Common.Station.StationStatus.Pass,
                            Editor = editor,
                            Cdt = now
                        });

                        var newStatus = new IMES.FisObject.FA.Product.ProductStatus();

                        newStatus.Status = IMES.FisObject.Common.Station.StationStatus.Pass;
                        newStatus.StationId = returnStation;
                        newStatus.Editor = editor;
                        newStatus.Line = unpackProd.Status.Line;
                        newStatus.TestFailCount = 0;
                        newStatus.ReworkCode = "";
                        unpackProd.UpdateStatus(newStatus);

                        IList<IMES.DataModel.TbProductStatus> stationList = prodRep.GetProductStatus(new List<string> { unpackProd.ProId });
                        prodRep.UpdateProductPreStationDefered(session.UnitOfWork, stationList);

                        prodRep.Update(unpackProd, session.UnitOfWork);
                    }
                }
            }
        }
Пример #8
0
        /// <summary>
        /// To every one in a COANoList, delete bound to Product and COA No, set status to current product.
		/// set status to COA, and insert COA log.
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            string editor = this.Editor;
            string pdLine = this.Line;
            string scrap = (string)CurrentSession.GetValue("scrap");
            string cause = (string)CurrentSession.GetValue("cause");

            List<string> list = (List<string>)CurrentSession.GetValue(Session.SessionKeys.COASNList);
            List<string> Actionlist = (List<string>)CurrentSession.GetValue("ActionList");
            List<string> Causelist = (List<string>)CurrentSession.GetValue("CauseList");
            int listcount = list.Count;
            int i = 0;
            IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            ICOAStatusRepository coaStatusRep = RepositoryFactory.GetInstance().GetRepository<ICOAStatusRepository, COAStatus>();

            IPizzaRepository repPizza = RepositoryFactory.GetInstance().GetRepository<IPizzaRepository, Pizza>();
          
            try
            {
                foreach (string coaNo in list)
                {
                    bool found = false;
                    string productID = "";
                    string CUSTSN = "";
                    string CustPartNo = "";

                    string pizzaID = "";

                    bool first_in = true;
                    string partSn = coaNo;
                    IMES.FisObject.FA.Product.ProductStatus newStatus = new IMES.FisObject.FA.Product.ProductStatus();
                    IList<string> product_list = new List<string>();
                    IList<ProductAndCustInfo> product_and_cust_info_list = productRep.GetProductAndCustInfoListByPartSn(partSn);
                    foreach (ProductAndCustInfo node in product_and_cust_info_list)
                    {
                        if (first_in)
                        {
                            productID = node.productId;
                            IProduct _product = productRep.FindOneProductWithProductIDOrCustSN(productID);
                            pizzaID = _product.PizzaID;
                            newStatus = _product.Status;
                            CUSTSN = node.custSn;
                            CustPartNo = node.custPno; //_product.ModelObj.CustPN;
                            found = true;
                            first_in = false;
                        }

                        product_list.Add(node.productId);
                        break;
                    }

                    if (found == false)
                    {
                        //FisException _ex = new FisException("CHK238"); //Get COA no bounding product info error!
                        //throw _ex;
                    }
                    /////////////////////////////////////////////////////////////////////////////
                    /* 
                     * delete Pizza_Part where PartSn=@coano and PizzaID=@PizzaId
                     */
                    ////////////////////////////////////////////////////////////////////////////////

                    IList<IProduct> pizza_list = productRep.GetProductInfoListByPizzaPartSn(partSn);
                    foreach (IProduct node in pizza_list)
                    {
                        pizzaID = node.PizzaID;
                        productID = node.ProId;
                        product_list.Add(productID);

                        break;
                    }
                    if (pizzaID != "")
                    {
                        PizzaPart delpizza = new PizzaPart();

                        delpizza.PizzaID = pizzaID;
                        delpizza.PartSn = partSn;

                        repPizza.DeletePizzaPartDefered(CurrentSession.UnitOfWork, delpizza);
                    }

                    /*
                     * 
                     * 6.解除Product与COA No的绑定:
                     * delete Product_Part where PartSn=@coano and ProductID=@productID
                     * 设置对应Product的当前状态:
                     * Update ProductStatus set Station=’69’, Editor=@user, Udt=GetDate where ProducntID=@productID
                     * 设置COA状态:
                     * Update COAStatus set Line=’REM’,Status=’A2’,Editor=@user, Udt=GetDate where COASN=@coano
                     * 记录COA Log:
                     * insert COALog values (@coano, 'A2',custsn+'/'+hppno, rtrim(@user), GetDate, ‘COA’)
                     * -----------------------------------------------------------------------------------------------
                     * IProductRepository::
                     * void DeleteProductPartByPartSn(string prodId, string partSn);
                     * 或void DeleteProductPartByPartSnDefered(IUnitOfWork uow, string prodId, string partSn);
                     * 
                     * 
                     * ProductStatus的修改请使用主体对象Product的Status属性,其被修改后,调用IProductRepository的Update方法来更新修改。
                     * 
                     * 
                     * COAStatus的更新使用ICOAStatusRepository的Update方法.
                     *
                     *
                     * ICOAStatusRepository::
                     * void InsertCOALog(COALog newLog);
                     * 或void InsertCOALogDefered(IUnitOfWork uow, COALog newLog);
                     * 
                     */

                    // if found == false, product_list has no node, and it does not exist in product_part.
                    // so we need not do:
                    //    1. productRep.DeleteProductPartByPartSn(productID, partSn)
                    //    2. productRep.UpdateProductListStatus.
                    if (found == true || pizzaID != "")
                    {
                        productRep.DeleteProductPartByPartSnDefered(CurrentSession.UnitOfWork, productID, partSn);
                        
                        //IMES.FisObject.FA.Product.ProductStatus newStatus = new IMES.FisObject.FA.Product.ProductStatus();
                        //Station=’69’, Editor=@user, Udt=GetDate where ProducntID=@productID
                        //上海mantis 0002406: PAK Remove COA 功能優化-- 判斷目前機器停留在 FA 站時不需要修改站點為69 站
                        IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
                        IList<ConstValueTypeInfo> nonChange69StationList  = partRep.GetConstValueTypeList("RemoveCOANotChange69Station");

                        if (nonChange69StationList==null  ||  
                            nonChange69StationList.Count==0 ||  
                            !nonChange69StationList.Any(x => x.value == newStatus.StationId))
                        {
                            IList<IMES.DataModel.TbProductStatus> stationList = productRep.GetProductStatus(new List<string>() { productID });
                            productRep.UpdateProductPreStationDefered(CurrentSession.UnitOfWork, stationList);

                            newStatus.StationId = "CR";
                            newStatus.Editor = editor;
                            newStatus.Udt = DateTime.UtcNow;
                            newStatus.ProId = productID;
                            productRep.UpdateProductListStatusDefered(CurrentSession.UnitOfWork, newStatus, product_list); //Defered(CurrentSession.UnitOfWork, newStatus, ProductIDList);
                            productRep.WriteProductLogDefered(CurrentSession.UnitOfWork, 
                                                                                        new List<string>() { productID }, 
                                                                                        "RemoveCOA", 
                                                                                        newStatus.StationId , 
                                                                                        (int)newStatus.Status,
                                                                                        newStatus.Editor);
                        }
                    }

                    COAStatus _coaStatus = coaStatusRep.GetCoaStatus(coaNo);

                    if (Actionlist[i] == "Scrap")
                    {
                        ////////////////////////////////////////////////////////////////////////////
                        //Update COAStatus set Status=@cause,Editor=@user, Udt=GetDate where COASN=@coano
                        string strcause;
                        strcause = Causelist[i].Substring(0, Causelist[i].IndexOf(" "));

                        _coaStatus.Status = strcause;
                        _coaStatus.Editor = editor;
                        _coaStatus.Udt = DateTime.UtcNow;
                        _coaStatus.COASN = coaNo;
                        coaStatusRep.UpdateCOAStatusDefered(CurrentSession.UnitOfWork, _coaStatus);

                        ////////////////////////////////////////////////////////////////////////////
                        COAReturnInfo setCOA = new COAReturnInfo();
                        setCOA.status = strcause;
                        setCOA.editor = editor.Trim();
                        setCOA.udt = DateTime.UtcNow;

                        COAReturnInfo conditionCOA = new COAReturnInfo();
                        conditionCOA.coasn = coaNo;

                        coaStatusRep.UpdateCOAReturnInfoDefered(CurrentSession.UnitOfWork, setCOA, conditionCOA);

                    }
                    else
                    {
                        // found == true || found == false, program comes here, that is to say, COA Staus = 'A1',
                        // so we must update COA status to be 'A2'.
                        //Update COAStatus set Line=’REM’,Status=’A2’,Editor=@user, Udt=GetDate where COASN=@coano
                        _coaStatus.LineID = "REM";
                        _coaStatus.Status = "A2";
                        _coaStatus.Editor = editor;
                        _coaStatus.Udt = DateTime.UtcNow;
                        _coaStatus.COASN = coaNo;
                        coaStatusRep.UpdateCOAStatusDefered(CurrentSession.UnitOfWork, _coaStatus);
                    
                    }

                    // if found == false, we do not know the CUSTSN, and so we can not make a COALog.
                    if (found == true || pizzaID != "")
                    {
                        if (Actionlist[i] == "Scrap")
                        {
                            // insert COALog values (@coano, @cause,@coapn, rtrim(@user), GetDate, ‘COA’)
                            //Note:
                            //@cause – 该COA No录入时,选择的Cause
                            //@coapn – 该COA No 对应的COAStatus.IECPN
                            string strcause;
                            strcause = Causelist[i].Substring(0, Causelist[i].IndexOf(" "));

                            COALog newLog = new COALog();
                            newLog.COASN = coaNo;
                            newLog.StationID = strcause;
                            newLog.LineID = _coaStatus.IECPN;
                            newLog.Editor = editor.Trim();
                            newLog.Cdt = DateTime.Now;
                            newLog.Tp = "COA";

                            coaStatusRep.InsertCOALogDefered(CurrentSession.UnitOfWork, newLog);
                        }
 
                        else
                        {
                            //insert COALog values (@coano, 'A2',custsn+'/'+hppno, rtrim(@user), GetDate, ‘COA’)
                            COALog newLog = new COALog();
                            newLog.COASN = coaNo;
                            newLog.StationID = "A2";
                            newLog.LineID = CUSTSN + "/" + CustPartNo;
                            newLog.Editor = editor.Trim();
                            newLog.Cdt = DateTime.Now;
                            newLog.Tp = "COA";

                            coaStatusRep.InsertCOALogDefered(CurrentSession.UnitOfWork, newLog);
                        }
                    }
                    i++;
                }
            }
            catch(FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw e;
            }

            return base.DoExecute(executionContext);
        }
        /// <summary>
        /// 执行根据DeliveryNo修改所有属于该DeliveryNo的Product状态的操作
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            string CurrentDeliveryNo = (string)CurrentSession.GetValue(Session.SessionKeys.DeliveryNo);

            ProductStatus newStatus = new ProductStatus();
            newStatus.Editor = Editor;
            newStatus.Line = Line;
            newStatus.StationId = Station;
            newStatus.Status =  Status;
            newStatus.ReworkCode = "";
            IProductRepository currentProductRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository>();

            currentProductRepository.UpdateUnPackProductStatusByDeliveryNoDefered(CurrentSession.UnitOfWork, newStatus, CurrentDeliveryNo);
            return base.DoExecute(executionContext);
        }
        /// <summary> 
        /// </summary>        
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var prodMo = (MO)CurrentSession.GetValue(Session.SessionKeys.ProdMO);
            var prodNoList = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.ProdNoList);
        
            
            var subProdList = new List<IProduct>();
            CurrentSession.AddValue(Session.SessionKeys.ProdList, subProdList);

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

            //将所有的ProdId插入Product表,ID=ProdId#, MOID=mo#, ModelID=model#
            string ecr = (string)CurrentSession.GetValue(Session.SessionKeys.ECR);
            foreach (string item in prodNoList)
            {

                Product prod = new Product(item);

                prod.MO = prodMo.Key.ToString();
                prod.Model = prodMo.Model;
                ProductStatus prodStatus = new ProductStatus();
                prodStatus.Editor = this.Editor;
                prodStatus.Line = this.Line;
                prodStatus.StationId = "F0";
                prodStatus.ProId = item;
                prodStatus.Status = StationStatus.Pass;
                prodStatus.ReworkCode = string.Empty;
                prod.Status = prodStatus;
                
                if (!String.IsNullOrEmpty(ecr))
                    prod.SetExtendedProperty("ECR", ecr.ToUpper(), this.Editor);

                prodRepository.Add(prod, CurrentSession.UnitOfWork);
                subProdList.Add(prod);
            }
            IList<string> range = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.ProdNoList);
            string mo = (string)CurrentSession.GetValue(Session.SessionKeys.MONO);
            CurrentSession.AddValue(Session.SessionKeys.PrintLogName, "PrdId");
            CurrentSession.AddValue(Session.SessionKeys.PrintLogBegNo, range[0]);
            CurrentSession.AddValue(Session.SessionKeys.PrintLogEndNo, range[range.Count - 1]);
            CurrentSession.AddValue(Session.SessionKeys.PrintLogDescr, mo);

            return base.DoExecute(executionContext);
        }
Пример #11
0
        /// <summary>
        /// Update Product Status
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var currentStation = default(string);

            if (IsReturnStatoin)
            {
                currentStation = CurrentSession.GetValue(Session.SessionKeys.ReturnStation).ToString();
            }
            else
            {
                currentStation = Station;
            }
            var currentProduct = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);
            var newStatus = new ProductStatus();

            string line = default(string);
            if (string.IsNullOrEmpty(this.Line))
            {
                line = currentProduct.Status.Line;
            }
            else
            {
                line = this.Line;
            }

            newStatus.Status = Status;
            newStatus.StationId = currentStation;
            newStatus.Editor = Editor;
            newStatus.Line = line;

            string AllowPass = "";

            if (CurrentSession.GetValue(ExtendSession.SessionKeys.AllowPass) != null)
            {
                AllowPass = (string)CurrentSession.GetValue(ExtendSession.SessionKeys.AllowPass);
            }

            if (AllowPass == "N" && Status == StationStatus.Fail)
            {
                newStatus.TestFailCount = currentProduct.Status.TestFailCount;  //999;
            }
            else if (currentProduct.Status.StationId == currentStation && Status == StationStatus.Fail)   //檢查相同測試站需累計測試次數
            {

                newStatus.TestFailCount = currentProduct.Status.TestFailCount + 1;
            }
            else if (Status == StationStatus.Fail)
            {
                newStatus.TestFailCount = 1;
            }
            else
            {
                newStatus.TestFailCount = 0;
            }

            IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            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(CurrentSession.UnitOfWork,r,currentProduct.ProId);
            }
            else {
                newStatus.ReworkCode = currentProduct.Status.ReworkCode;
            }
            newStatus.ProId = currentProduct.ProId;

            #region record previous product Status
            //System.Data.DataTable preStatus = CreateDataTable.CreateProductStatusTb();
            //preStatus.Rows.Add(currentProduct.ProId,
            //                                   currentProduct.Status.StationId,
            //                                   currentProduct.Status.Status == StationStatus.Pass ? 1 : 0,
            //                                   currentProduct.Status.ReworkCode,
            //                                   currentProduct.Status.Line,
            //                                   currentProduct.Status.TestFailCount,
            //                                   currentProduct.Status.Editor,
            //                                   //currentProduct.Status.Udt.ToString("yyyy-MM-dd HH:mm:ss.fff")
            //                                   currentProduct.Status.Udt
            //                                   );



            //System.Data.DataTable curStatus = CreateDataTable.CreateProductStatusTb();
            //newStatus.Udt = DateTime.Now;
            //curStatus.Rows.Add(currentProduct.ProId,
            //                                   newStatus.StationId,
            //                                   newStatus.Status == StationStatus.Pass ? 1 : 0,
            //                                   currentProduct.Status.ReworkCode,
            //                                   newStatus.Line,
            //                                   newStatus.TestFailCount,
            //                                   newStatus.Editor,
            //                                   //newStatus.Udt.ToString("yyyy-MM-dd HH:mm:ss.fff")
            //                                   newStatus.Udt
            //                                   );

            //SqlParameter para1 =new SqlParameter("PreStatus", System.Data.SqlDbType.Structured);
            //para1.Direction = System.Data.ParameterDirection.Input;
            //para1.Value = preStatus;

            //SqlParameter para2 =new SqlParameter("Status", System.Data.SqlDbType.Structured);
            //para2.Direction = System.Data.ParameterDirection.Input;
            //para2.Value = curStatus;

            
            //productRepository.ExecSpForNonQueryDefered(CurrentSession.UnitOfWork,
            //                                                                                 IMES.Infrastructure.Repository._Schema.SqlHelper.ConnectionString_FA,
            //                                                                                 "IMES_UpdateProductStatus",
            //                                                                                para1,
            //                                                                                para2);

            IList<IMES.DataModel.TbProductStatus> stationList = productRepository.GetProductStatus(new List<string>{currentProduct.ProId});
            productRepository.UpdateProductPreStationDefered(CurrentSession.UnitOfWork, stationList);
                                                                                             
            #endregion

            currentProduct.UpdateStatus(newStatus);
            
            //070031 2012.09.18
            //Vincent disable 檢查重複BoxId功能,在分配時BoxId 已做檢查
            //0001649: [Activity]修改UpdateProductStatus activity 刪除檢查重複Boxd 問題
            //var ivkBdy = productRepository.CheckTheBoxIdDefered(CurrentSession.UnitOfWork, currentProduct);
            //070031 2012.09.18

            productRepository.Update(currentProduct, CurrentSession.UnitOfWork);

            //070031 2012.09.18
            //0001649: [Activity]修改UpdateProductStatus activity 刪除檢查重複Boxd 問題
            //var ivkBdy2 = productRepository.CheckTheBoxIdDefered(CurrentSession.UnitOfWork, currentProduct);
            //ivkBdy2.DependencyIvkbdy = ivkBdy;
            //ivkBdy2.ExpectRetVal = true;
            //070031 2012.09.18

            //Vincent Add Reset ForceNWC
            string isForceNWC = (string)CurrentSession.GetValue("IsForceNWC");
            if (isForceNWC == "Y")
            {
                IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
                partRep.UpdateForceNWCByProductIDDefered(CurrentSession.UnitOfWork, "", "", currentProduct.ProId);
            }

            return base.DoExecute(executionContext);
        }
        /// <summary>
        /// 执行根据DeliveryNo修改所有属于该DeliveryNo的Product状态的操作
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            string CurrentDeliveryNo = (string)CurrentSession.GetValue(Session.SessionKeys.DeliveryNo);

            ProductStatus newStatus = new ProductStatus();
            newStatus.Editor = Editor;
            newStatus.Line = Line;
            newStatus.StationId = Station;
            newStatus.Status =  Status;
            newStatus.ReworkCode = "";
            IProductRepository currentProductRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository>();

            currentProductRepository.ExecSpForNonQueryDefered(CurrentSession.UnitOfWork,
                                                                                          IMES.Infrastructure.Repository._Schema.SqlHelper.ConnectionString_FA,
                                                                                          "IMES_DeliveryProductStatus",
                                                                                         new SqlParameter("deliveryNo",CurrentDeliveryNo),
                                                                                         new SqlParameter("station", Station),
                                                                                         new SqlParameter("status", Status == StationStatus.Pass ? 1 : 0),
                                                                                         new SqlParameter("line", Line),
                                                                                         new SqlParameter("editor", Editor),
                                                                                         new SqlParameter("udt", DateTime.Now)
                                                                                         );

            currentProductRepository.UpdateUnPackProductStatusByDeliveryNoDefered(CurrentSession.UnitOfWork, newStatus, CurrentDeliveryNo);
            return base.DoExecute(executionContext);
        }
Пример #13
0
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var mb = (MB)CurrentSession.GetValue(Session.SessionKeys.MB);
            string item = this.Key;

            if (mb.GetAttributeValue("Model") == null)
            {
                List<string> errpara = new List<string>();

                errpara.Add(item);

                throw new FisException("SFC014", errpara); // Need Change error code for No PCB Mapping to  Model
            }

            string model = (string)mb.GetAttributeValue("Model");

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

            IList<IProduct> lstProduct = prodRepository.GetProductListByPCBID(item);

            if (lstProduct != null)
            {
                foreach (var product in lstProduct)
                {
                    if (product.ProId != item)
                    {
                        List<string> erpara = new List<string>();
                        erpara.Add("MB");
                        erpara.Add(item);
                        erpara.Add(product.ProId);
                        var ex = new FisException("CHK009", erpara);
                        throw ex;
                    }
                }
            }

            ProductStatus prodStatus = new ProductStatus();

            prodStatus.Editor = this.Editor;
            prodStatus.Line = this.Line;
            prodStatus.StationId = this.Station;
            prodStatus.ProId = item;
            prodStatus.Status = this.IsPass; //StationStatus.Pass;
            prodStatus.ReworkCode = string.Empty;
            prodStatus.Udt = DateTime.Now;

            Product prod = new Product(item);

            var currentProduct = prodRepository.GetProductByIdOrSn(item);
            if (currentProduct == null)
            {
                prod.MAC = mb.MAC;
                prod.MO = mb.SMTMO;
                prod.Model = model;
                prod.PCBID = item;
                prod.PCBModel = mb.Model;
                prod.MBECR = mb.ECR;
                prod.Status = prodStatus;
                prod.CUSTSN = mb.CustSn;

                prodRepository.Add(prod, CurrentSession.UnitOfWork);
                CurrentSession.AddValue(Session.SessionKeys.Product, prod);
             }
            else 
            {
                currentProduct.MAC = mb.MAC;
                currentProduct.MO = mb.SMTMO;
                currentProduct.Model = model;
                currentProduct.PCBID = item;
                currentProduct.PCBModel = mb.Model;
                currentProduct.MBECR = mb.ECR;
                currentProduct.CUSTSN = mb.CustSn;
                currentProduct.UpdateStatus(prodStatus);

                prodRepository.Update(currentProduct, CurrentSession.UnitOfWork);
                CurrentSession.AddValue(Session.SessionKeys.Product, currentProduct);
            }

            return base.DoExecute(executionContext);
        }
Пример #14
0
        ///<summary>
        ///</summary>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            string model = CurrentSession.GetValue(Session.SessionKeys.ModelName).ToString();
             IMORepository imr = RepositoryFactory.GetInstance().GetRepository<IMORepository, MO>();
             MO prodMo=null;
            if (IsBindMO)
            {

                string moNo = imr.GetActiveMOWithNoneLock(model);
                if (string.IsNullOrEmpty(moNo))
                { 
                    moNo = imr.GetActiveMO(model);
                }
                if (string.IsNullOrEmpty(moNo))
                {
                    throw new FisException("CHK1025", new string[] { });
                }
                prodMo = imr.Find(moNo);
            }



            var prodNoList = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.ProdNoList);
            string ecr=CurrentSession.GetValue(Session.SessionKeys.ECR)==null?"":CurrentSession.GetValue(Session.SessionKeys.ECR).ToString();
            var subProdList = new List<IProduct>();
            CurrentSession.AddValue(Session.SessionKeys.ProdList, subProdList);

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

            //将所有的ProdId插入Product表,ID=ProdId#, MOID=mo#, ModelID=model#,ECR=ecr# 
            //记录Product的状态,在ProductStatus插入记录
            
            foreach (string item in prodNoList)
            {

                Product prod = new Product(item);
                prod.ECR = ecr;
                if (IsBindMO)
                {
                    prod.MO = prodMo.Key.ToString();
                    prod.Model = prodMo.Model;
                    imr.AssignedMO(prodMo.MONO);
                }
                else
                {
                    prod.Model = model;
                }
                

                ProductStatus prodStatus = new ProductStatus();
                prodStatus.Editor = this.Editor;
                prodStatus.Line = this.Line;
                prodStatus.StationId = this.Station;
                prodStatus.ProId = item;
                prodStatus.Status = StationStatus.Pass;
                prodStatus.ReworkCode = string.Empty;
                prod.Status  = prodStatus;
                prodRepository.Add(prod, CurrentSession.UnitOfWork);
                subProdList.Add(prod);

            }
            if (prodNoList.Count == 1)
            {
                CurrentSession.AddValue(Session.SessionKeys.Product, subProdList[0]);
            }

            return base.DoExecute(executionContext);
        }
Пример #15
0
        /// <summary> 
        /// </summary>        
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var currentStation = default(string);

            currentStation = Station;
            

            IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            IList<IProduct> prodList = new List<IProduct>();
            prodList = (IList<IProduct>)CurrentSession.GetValue(Session.SessionKeys.ProdList);

            #region  record multi-productId product status
             
            //System.Data.DataTable productTb = CreateDataTable.CreateStringListTb();
            //foreach (IProduct currentProduct in prodList)
            //{
            //    productTb.Rows.Add(currentProduct.ProId);
            //}
            //SqlParameter para1 = new SqlParameter("ProductIDList", System.Data.SqlDbType.Structured);
            //para1.Direction = System.Data.ParameterDirection.Input;
            //para1.Value = productTb;

            //IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
               
            //productRep.ExecSpForNonQueryDefered(CurrentSession.UnitOfWork,
            //                                                                                IMES.Infrastructure.Repository._Schema.SqlHelper.ConnectionString_FA,
            //                                                                                "IMES_MultiUpdateProductStatus",
            //                                                                               para1,
            //                                                                               new SqlParameter("station", Station),
            //                                                                               new SqlParameter("status", 1),
            //                                                                               new SqlParameter("line", Line),
            //                                                                               new SqlParameter("editor", Editor),
            //                                                                               new SqlParameter("udt", DateTime.Now)
            //                                                                               );

            var productIDList = (from item in prodList
                                             select item.ProId).ToList();

            IList<IMES.DataModel.TbProductStatus> stationList = productRepository.GetProductStatus(productIDList);
            productRepository.UpdateProductPreStationDefered(CurrentSession.UnitOfWork, stationList);

  
            #endregion

            foreach (IProduct currentProduct in prodList)
            {
                var newStatus = new ProductStatus();

                string line = default(string);
                if (string.IsNullOrEmpty(this.Line))
                {
                    line = currentProduct.Status.Line;
                }
                else
                {
                    line = this.Line;
                }

                newStatus.Status = StationStatus.Pass;
                newStatus.StationId = currentStation;
                newStatus.Editor = Editor;
                newStatus.Line = line;

                newStatus.TestFailCount = 0;
                
                
               
                if (!string.IsNullOrEmpty(currentProduct.Status.ReworkCode) && productRepository.IsLastReworkStation(currentProduct.Status.ReworkCode, Station, (int)StationStatus.Pass))
                {
                    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(CurrentSession.UnitOfWork, r, currentProduct.ProId);
                }
                else
                {
                    newStatus.ReworkCode = currentProduct.Status.ReworkCode;
                }
                newStatus.ProId = currentProduct.ProId;


                currentProduct.UpdateStatus(newStatus);

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

            return base.DoExecute(executionContext);
        }
Пример #16
0
        /// <summary> 
        /// </summary>        
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var prodMo = (MO)CurrentSession.GetValue(Session.SessionKeys.ProdMO);
            var prodNoList = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.ProdNoList);            
            var shipDate = CurrentSession.GetValue(IMES.Infrastructure.Extend.ExtendSession.SessionKeys.DeliveryDate).ToString();
            string bomremark = (string)CurrentSession.GetValue("BomRemark");
            string remark = (string)CurrentSession.GetValue("Remark");
            string exception = (string)CurrentSession.GetValue("Exception");
            string inFAI = (string)CurrentSession.GetValue("inFAI");
            var subProdList = new List<IProduct>();
            CurrentSession.AddValue(Session.SessionKeys.ProdList, subProdList);

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

            //将所有的ProdId插入Product表,ID=ProdId#, MOID=mo#, ModelID=model#
            
            foreach (string item in prodNoList)
            {

                Product prod = new Product(item);

                prod.MO = prodMo.Key.ToString();
                prod.Model = prodMo.Model;
                ProductStatus prodStatus = new ProductStatus();
                prodStatus.Editor = this.Editor;
                prodStatus.Line = this.Line;
                prodStatus.StationId = this.Station;
                prodStatus.ProId = item;
                prodStatus.Status = StationStatus.Pass;
                prodStatus.ReworkCode = string.Empty;
                prod.Status = prodStatus;
                //ITC-1360-1337 ITC-1360-1300
                prod.SetExtendedProperty("ShipDate", shipDate, this.Editor);
                if(!String.IsNullOrEmpty(bomremark))
                    prod.SetExtendedProperty("BomRemark", bomremark.ToUpper(), this.Editor);
                if(!String.IsNullOrEmpty(remark))
                    prod.SetExtendedProperty("Remark", remark.ToUpper(), this.Editor);
                if(!String.IsNullOrEmpty(exception))
                    prod.SetExtendedProperty("Exception", exception, this.Editor);
                if (inFAI == "Y")
                    prod.SetExtendedProperty("FAIinFA", "Y", this.Editor);
                prod.SetExtendedProperty("PdLine", this.Line, this.Editor);
                //TODO 1.
                prodRepository.Add(prod, CurrentSession.UnitOfWork);
                subProdList.Add(prod);
            }
            IList<string> range = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.ProdNoList);
            string mo = (string)CurrentSession.GetValue(Session.SessionKeys.MONO);
            CurrentSession.AddValue(Session.SessionKeys.PrintLogName, "PrdId");
            CurrentSession.AddValue(Session.SessionKeys.PrintLogBegNo, range[0]);            
            CurrentSession.AddValue(Session.SessionKeys.PrintLogEndNo, range[range.Count-1]);
            CurrentSession.AddValue(Session.SessionKeys.PrintLogDescr, mo);
                          
            return base.DoExecute(executionContext);
        }
Пример #17
0
 /// <summary>
 /// 执行根据Carton修改所有属于该Carton的Product状态的操作
 /// </summary>
 /// <param name="executionContext"></param>
 /// <returns></returns>
 protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
 {
     string currentCarton = (string)CurrentSession.GetValue(Session.SessionKeys.Carton);
     if (currentCarton == null||currentCarton=="")
     {
         List<string> errpara = new List<string>();
         throw new FisException("CHK109", errpara);
     }
     ProductStatus newStatus = new ProductStatus();
     newStatus.Editor = Editor;
     newStatus.Line = Line;
     newStatus.StationId = Station;
     newStatus.Status =  Status;
     newStatus.ReworkCode = "";
     IProductRepository currentProductRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository>();
     //currentProductRepository.UpdateProductStatusByCartonDefered(CurrentSession.UnitOfWork, currentCarton, newStatus);
     currentProductRepository.UpdateProductListReworkDefered(CurrentSession.UnitOfWork, newStatus, null, currentCarton);
     return base.DoExecute(executionContext);
 }
Пример #18
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);
        }
Пример #19
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var prodRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository>();
            Session session = CurrentSession;
            IProduct product = (IProduct)session.GetValue(Session.SessionKeys.Product);
            string returnStation = product.GetAttributeValue(this.AttrName);

            if (!string.IsNullOrEmpty(returnStation))
            {
                 IMES.FisObject.FA.Product.ProductStatus preStatus = product.Status;
              
                IList<IMES.DataModel.TbProductStatus> preStationList = new List<TbProductStatus>();
                preStationList.Add(new TbProductStatus
                {
                    ProductID = preStatus.ProId,
                    Line = preStatus.Line,
                    ReworkCode = preStatus.ReworkCode,
                    Station = preStatus.StationId,
                    Status = (int)preStatus.Status,
                    Editor = preStatus.Editor,
                    TestFailCount = preStatus.TestFailCount,
                    Udt=DateTime.Now
                });
                IMES.FisObject.FA.Product.ProductStatus curStatus = new IMES.FisObject.FA.Product.ProductStatus()
                {
                    ProId = preStatus.ProId,
                    ReworkCode = preStatus.ReworkCode,
                    TestFailCount = preStatus.TestFailCount,
                    Editor = this.Editor,
                    Status = IMES.FisObject.Common.Station.StationStatus.Pass,
                    StationId = returnStation,
                    Line = this.Line,
                    Cdt = DateTime.Now,
                    Udt = DateTime.Now
                };
                product.UpdateStatus(curStatus);

                var productLog = new ProductLog
                {
                    Model = product.Model,
                    Status = IMES.FisObject.Common.Station.StationStatus.Pass,
                    Editor = this.Editor,
                    Line = this.Line,
                    Station = returnStation,
                    Cdt = DateTime.Now
                };

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

                prodRep.UpdateProductPreStationDefered(CurrentSession.UnitOfWork, preStationList);            
                
            }
          
            
            return base.DoExecute(executionContext);
        }
Пример #20
0
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var prodMo = (MO)CurrentSession.GetValue(Session.SessionKeys.ProdMO);
            var prodNoList = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.ProdNoList);
         //   var ecr = CurrentSession.GetValue(Session.SessionKeys.ECR).ToString();
            var shipDate = CurrentSession.GetValue(IMES.Infrastructure.Extend.ExtendSession.SessionKeys.DeliveryDate).ToString();
            var sku = CurrentSession.GetValue(IMES.Infrastructure.Extend.ExtendSession.SessionKeys.SKU).ToString();
            var subProdList = new List<IProduct>();
            CurrentSession.AddValue(Session.SessionKeys.ProdList, subProdList);

            IProductRepository prodRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
           
            //将所有的ProdId插入Product表,ID=ProdId#, MOID=mo#, ModelID=model#,ECR=ecr# 
            //记录Product的状态,在ProductStatus插入记录
            
            foreach (string item in prodNoList)
            {

                Product prod = new Product(item);

          //      prod.ECR = ecr;
                prod.MO = prodMo.Key.ToString ();
                prod.Model = prodMo.Model;
                ProductStatus prodStatus = new ProductStatus();
                prodStatus.Editor = this.Editor;
                prodStatus.Line = this.Line;
                prodStatus.StationId = this.Station;
                prodStatus.ProId = item;
                prodStatus.Status = StationStatus.Pass;
                prodStatus.ReworkCode = string.Empty;
                prod.Status  = prodStatus;
                prod.SetExtendedProperty("ShipDate",shipDate,this.Editor);
                if (!string.IsNullOrEmpty(sku))
                { prod.SetExtendedProperty("SKU", sku, this.Editor); }

                prodRepository.Add(prod, CurrentSession.UnitOfWork);
                subProdList.Add(prod);
           }


            return base.DoExecute(executionContext);
        }
        /// <summary>
        /// 更新一组ProductID的Status
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            ProductStatus newStatus = new ProductStatus();
            newStatus.Editor = Editor;
            newStatus.Line = Line;
            newStatus.StationId = Station;
            newStatus.Status = Status;
            IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();

            IList<string> ProductIDList = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.NewScanedProductIDList);
            #region  record multi-productId product status
            //System.Data.DataTable productTb= CreateDataTable.CreateStringListTb();
            //foreach (string id in ProductIDList)
            //{
            //    productTb.Rows.Add(id);
            //}
            //SqlParameter para1 = new SqlParameter("ProductIDList", System.Data.SqlDbType.Structured);
            //para1.Direction = System.Data.ParameterDirection.Input;
            //para1.Value = productTb;

            //productRepository.ExecSpForNonQueryDefered(CurrentSession.UnitOfWork,
            //                                                                                IMES.Infrastructure.Repository._Schema.SqlHelper.ConnectionString_FA,
            //                                                                                "IMES_MultiUpdateProductStatus",
            //                                                                               para1,
            //                                                                               new SqlParameter("station",Station),
            //                                                                               new SqlParameter("status",Status== StationStatus.Pass?1:0 ),
            //                                                                               new SqlParameter("line",Line),
            //                                                                               new SqlParameter("editor",Editor),
            //                                                                               new SqlParameter("udt",DateTime.Now)
            //                                                                               );

            IList<IMES.DataModel.TbProductStatus> stationList = productRepository.GetProductStatus(ProductIDList);
            productRepository.UpdateProductPreStationDefered(CurrentSession.UnitOfWork, stationList);

            #endregion
            productRepository.UpdateProductListStatusDefered(CurrentSession.UnitOfWork, newStatus, ProductIDList);
            

            return base.DoExecute(executionContext);
        }
Пример #22
0
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            ProductStatus newStatus = new ProductStatus();
            newStatus.Editor = Editor;
            newStatus.Line = Line;
            newStatus.StationId = Station;
            newStatus.Status = Status;
            IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();

            IList<string> ProductIDList = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.NewScanedProductIDList);
            //productRepository.UpdateProductListStatusDefered(CurrentSession.UnitOfWork, newStatus, ProductIDList);
            productRepository.UpdateProductListReworkDefered(CurrentSession.UnitOfWork, newStatus, ProductIDList, "");

            return base.DoExecute(executionContext);
        }
Пример #23
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);
        }
Пример #24
0
        /// <summary>
        /// To the input COANumber list, check.
        ///    1. if it exists in the given table.
        ///    2. COAStatus.Status必须是'A1'
        ///    3. 此COA不可已经与机器绑定并且该机器当前在“85”或“9A”站。
        /// </summary>
        /// <param name="COANumber"></param>
        /// <param name="pdLine"></param>
        /// <param name="prodId"></param>
        /// <param name="editor"></param>
        /// <param name="stationId"></param>
        /// <param name="customerId"></param>
        /// <returns></returns>
        public ArrayList InputCOANumberList(IList<string> COANumberList, string pdLine, string prodId, string editor, string stationId, string customerId, string action)
        {
            logger.Debug("(_COARemoval)InputCOANumber start, COANumber List:" + COANumberList + " pdLine:" + pdLine + " prodId:" + prodId + " editor:" + editor + " stationId:" + stationId + " customerId:" + customerId);
            ArrayList this_array_list_return = new ArrayList();
            //FisException ex;
            FisException _ex;
            string error = "";
            List<string> erpara = new List<string>();

            List<string> errorList = new List<string>();

            try
            {
                foreach (string node in COANumberList)
                {
                    if (node != "")
                    {
                        //string CurrentCOASN = COANumberList[0]; modify by 2012.8.9
                        string CurrentCOASN = node;

                        IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
                        ICOAStatusRepository coaStatusRepository = RepositoryFactory.GetInstance().GetRepository<ICOAStatusRepository, COAStatus>();
                        /* 1)所输入COA No在COAStatus数据表中存在。否则提示“无此COA记录!”
                         */
                        COAStatus status = coaStatusRepository.Find(CurrentCOASN);
                        if (status == null)
                        {
                            //This COA does not exist!
                            errorList.Add(CurrentCOASN);
                        }
                        else
                        {
                            /* 2)5.	For Remove,COAStatus.Status必须是'A1'; 
                             * For Scrap,COAStatus.Status必须是'A0' or 'A2' or 'A3'。
                             * 否则提示 该COA的当前状态是”+COAStatus.Status+“。”
                             */
                            if (action != "scrap")
                            {
                                if (!status.Status.Equals("A1"))
                                {
                                    errorList.Add(CurrentCOASN);
                                }
                            }
                            else
                            {
                                if (!status.Status.Equals("A0") && !status.Status.Equals("A2") && !status.Status.Equals("A3"))
                                {
                                    errorList.Add(CurrentCOASN);
                                }
                                var cond = new COAReturnInfo();
                                cond.coasn = "coano";
                                /*示例
                                var set = [ICOAStatusRepository Instance].GetCOAReturnInfoList(cond, null);
                                int cnt = (from item in set where item.status == string.Empty select item).Count();*/
                                IList<COAReturnInfo> coareturnlist = coaStatusRepository.GetCOAReturnInfoList(cond, null);
                                if (coareturnlist.Count != 0)
                                {
                                    errorList.Add(CurrentCOASN);

                                }
                            }
                            /* 
                             *  Attention: now I think status.IECPN 就是 product 的 SN
                             *             所以,从它来得到 product 对象
                             *             
                             * 3)此COA不可已经与机器绑定并且该机器当前在“85”或“9A”站。否则提示“机器已上栈板或已经出货 !!”
                             * 
                             *   If exists (select a.ProductID from Product a (nolock), 
                             *   Product_Part b (nolock), ProductStatus c (nolock) 
                             *   where a.ProductID=b.ProductID and b.PartSn=@coano and 
                             *   a.ProductID=c.ProductID and (c.Station=’85’ or c.Station=’9A’))
                             * 
                             * IProductRepository::
                             *   bool CheckExistProductByPartSnAndStations(string partSn, string[] stations);
                             * 
                             */
                            string partSn = CurrentCOASN;

                            string productID = "";
                            string CUSTSN = "";
                            bool first_in = true;

                            IMES.FisObject.FA.Product.ProductStatus newStatus = new IMES.FisObject.FA.Product.ProductStatus();
                            IList<string> product_list = new List<string>();
                            IList<ProductAndCustInfo> product_and_cust_info_list = productRep.GetProductAndCustInfoListByPartSn(partSn);
                            foreach (ProductAndCustInfo node1 in product_and_cust_info_list)
                            {
                                if (first_in)
                                {

                                    productID = node1.productId;
                                    IProduct _product = productRep.FindOneProductWithProductIDOrCustSN(productID);
                                    CUSTSN = node1.custSn;

                                    COAReturnInfo cod = new COAReturnInfo();
                                    cod.custsn = CUSTSN;
                                    IList<COAReturnInfo> reCOAReturnInfo = coaStatusRepository.GetCOAReturnInfoList(cod, null);
                                    if (reCOAReturnInfo.Count == 0)
                                    {

                                        string[] stations = { "85", "9A" };
                                        if (productRep.CheckExistProductByPartSnAndStations(partSn, stations) || productRep.CheckExistProductByPartSnAndStationsWithPizzaPart(partSn, stations))
                                        {
                                            errorList.Add(CurrentCOASN);
                                        }
                                    }
                                    first_in = false;
                                }
                                break;
                            }

                            IList<IProduct> pizza_list = productRep.GetProductInfoListByPizzaPartSn(partSn);
                            foreach (IProduct node2 in pizza_list)
                            {
                                productID = node2.ProId;

                                IProduct _product = productRep.FindOneProductWithProductIDOrCustSN(productID);
                                CUSTSN = node2.CUSTSN;

                                COAReturnInfo cod = new COAReturnInfo();
                                cod.custsn = CUSTSN;
                                IList<COAReturnInfo> reCOAReturnInfo = coaStatusRepository.GetCOAReturnInfoList(cod, null);
                                if (reCOAReturnInfo.Count == 0)
                                {

                                    string[] stations = { "85", "9A" };
                                    if (productRep.CheckExistProductByPartSnAndStations(partSn, stations) || productRep.CheckExistProductByPartSnAndStationsWithPizzaPart(partSn, stations))
                                    {
                                        errorList.Add(CurrentCOASN);
                                    }
                                }



                                break;
                            }

                        }
                    }
               }
                IEnumerable<string> distinctAges = errorList.Distinct();
                List<string> returnerrorList = distinctAges.ToList();
                string strerrorlist = "";

                if (returnerrorList != null && returnerrorList.Count > 0)
                {
                    foreach (string tmp in returnerrorList)
                    {
                        //“文件中存在Invalid COA No,请注意!” – No1 / No2 / … / Non No1 ,No2,Non – 前文解析时发现的Invalid COA No
                        strerrorlist += tmp + "/";

                    }
                    strerrorlist = "-" + strerrorlist.Substring(0, strerrorlist.Length - 1);
                    _ex = new FisException("CHK527", new string[] { strerrorlist });//错误提示:“文件中存在Invalid COA No,请注意! – No1 / No2 / … / Non”
                    error = _ex.mErrmsg;
                    //throw _ex;

                }

                bool bExist = false;
                for (int j = 0; j < COANumberList.Count; j++)
                {
                    for (int m = 0; m < returnerrorList.Count; m++)
                    {
                        if (returnerrorList[m] == COANumberList[j])
                        {
                            //this_array_list_return.Add(error);
                            bExist = true;

                        }

                    }
                    if (bExist == false)
                    {
                        //this_array_list_return.Add("OK!");
                        if (COANumberList[j] != "")
                            this_array_list_return.Add(COANumberList[j]);

                    }
                    bExist = false;
                }

                this_array_list_return.Add(error);

                 return this_array_list_return;
                    
 

            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                //logger.Debug("(_COARemoval)InputCOANumber end, COANumber:" + COANumber + " pdLine:" + pdLine + " prodId:" + prodId + " editor:" + editor + " stationId:" + stationId + " customerId:" + customerId);
            }
        }