Пример #1
0
 /// <summary>
 /// 获取DN表相关信息
 /// </summary>
 /// <param name="dn">dn</param>
 public S_RowData_ShipDate GetDN(string dn)
 {
     logger.Debug("(_UpdateShipDate)GetDN start.");
     try
     {
         S_RowData_ShipDate ret = new S_RowData_ShipDate();
         Delivery reDelivery = new Delivery();
         reDelivery = currentRepository.Find(dn);
         if (null == reDelivery)
         {
             ret.dn = "";
             return ret;
         }
         ret.Qty = reDelivery.Qty.ToString();
         ret.ShipDate = reDelivery.ShipDate.ToString("yyyy - MM - dd");
         ret.Status = reDelivery.Status;
         ret.dn = reDelivery.DeliveryNo;
         return ret;
     }
     catch (FisException e)
     {
         logger.Error(e.mErrmsg, e);
         throw new Exception(e.mErrmsg);
     }
     catch (Exception e)
     {
         logger.Error(e.Message, e);
         throw new SystemException(e.Message);
     }
     finally
     {
         logger.Debug("(_UpdateShipDate)GetDN end.");
     }
 }
Пример #2
0
        /// <summary>
        /// GetValue
        /// </summary>
        /// <param name="session"></param>
        /// <param name="product"></param>
        /// <param name="mb"></param>
        /// <param name="delivery"></param>
        /// <param name="part"></param>
        /// <param name="testLog"></param>
        /// <param name="name"></param>
        /// <param name="spliter"></param>
        /// <returns></returns>
        public static string GetValue(Session session, IProduct product, IMB mb, Delivery delivery, IPart part,
                                                    TestLog testLog, string name, char spliter)
        {
            string ret = null;
            int index = name.IndexOf(spliter);
            if (index < 1)
            {
                throw new Exception("wrong method name : " + name);
            }

            string objName = name.Substring(0, index);
            string objMethod = name.Substring(index + 1).Trim();

            if (resolveTestLog(testLog, objName, objMethod, true, out ret))
            {
                return ret;
            }

            return getValueInner(session, product, mb, delivery, part, name, spliter, true); 
        }
Пример #3
0
        /// <summary>
        /// Resolve UPS Parameter Name/Value
        /// </summary>
        /// <param name="srcData"></param>
        /// <param name="session"></param>
        /// <param name="product"></param>
        /// <param name="dn"></param>
        /// <param name="part"></param>
        /// <param name="hpPOInfo"></param>
        /// <param name="spliter"></param>
        /// <returns></returns>
        public static string replaceUPSParameter(string[] srcData, 
                                                                     Session session, 
                                                                      IProduct product, 
                                                                      Delivery dn, 
                                                                      IPart part,
                                                                      UPSHPPOInfo  hpPOInfo,                                                                        
                                                                      char spliter)
        {
           
            int index = 0;
            foreach (string value in srcData)
            {
                if (value.Contains(spliter))
                {
                    string s = GetValue(hpPOInfo, value, spliter);
                    if (string.IsNullOrEmpty(s))
                    {
                        s = ResolveValue.GetValue(session, product, null, dn, part, value, spliter);
                    }

                    if (string.IsNullOrEmpty(s))
                    {
                        throw new FisException("CQCHK0006", new List<string> { value });
                    }
                    srcData[index] = s;
                }
                index++;
            }
            return string.Join(",", srcData);
        }
Пример #4
0
        /// <summary>
        /// constructure
        /// </summary>
        /// <param name="session">session object</param>       
        /// <param name="modelName"> model name</param>
        /// <param name="moNo">MO Id</param>
        /// <param name="dnNo">Delivery No</param>
        /// <param name="partNo">Part No</param>
        /// <param name="customer">Customer</param>
        public PrintUtility(Session session, 
                                  string modelName, string moNo,
                                  string dnNo, string partNo, 
                                  string customer)
        {
            _session = session;
            _product =session.GetValue(Session.SessionKeys.Product) as Product;
            _mb = session.GetValue(Session.SessionKeys.MB) as MB;

            if (_product != null)
            {
                _customer = _product.Customer;
                if (string.IsNullOrEmpty(modelName) ||
                   modelName == _product.Model)
                {
                    modelName = _product.Model;
                    _model = _product.ModelObj;
                }               

                if (string.IsNullOrEmpty(moNo))
                {
                    moNo = _product.MO;
                }

                if (string.IsNullOrEmpty(dnNo))
                {
                    dnNo = _product.DeliveryNo;
                }

                //if (!string.IsNullOrEmpty(dnNo))
                //    _delivery = dnRep.Find(dnNo);
            }
            else if (_mb != null)
            {
                _customer = _mb.Customer;
                if (string.IsNullOrEmpty(modelName) &&
                    !string.IsNullOrEmpty(_mb.MB1397))
                {
                    modelName = _mb.MB1397;
                    _model = _mb.Model1397Obj;
                }

                if (string.IsNullOrEmpty(moNo))
                {
                    moNo = _mb.SMTMO;
                }
               

                if (string.IsNullOrEmpty(dnNo))
                {
                    dnNo = _mb.DeliveryNo;
                }

                //if (!string.IsNullOrEmpty(dnNo))
                //    _delivery = dnRep.Find(dnNo);

                if (string.IsNullOrEmpty(partNo))
                {
                    partNo = _mb.Model;
                }
            }

            _moNo = moNo;
            _modelName= modelName;
            _dnNo = dnNo;
            _partNo = partNo;

            if(string.IsNullOrEmpty(_customer))
            {
                _customer = customer;
            }            

            if(!string.IsNullOrEmpty(partNo))
            {
                _part =partRep.Find(partNo);
            }

            if (_model == null && !string.IsNullOrEmpty(_modelName))
            {
               _model= modelRep.Find(_modelName);
            }

            if (_delivery == null && !string.IsNullOrEmpty(_dnNo))
            {
                _delivery = dnRep.Find(_dnNo);
            }

        }
Пример #5
0
 private bool checkDelivery(Delivery dn, string name, string value)
 {
     bool ret = false;
     switch (name.ToUpper())
     {
         case "DELIVERYNO":
             ret = Regex.IsMatch(dn.DeliveryNo, value);
             break;
         case "SHIPMENTNO":
             ret = Regex.IsMatch(dn.ShipmentNo, value);
             break;
         case "PONO":
             ret = Regex.IsMatch(dn.PoNo, value);
             break;
         case "MODEL":
             ret = Regex.IsMatch(dn.ModelName, value);
             break;               
         default:
             break;
     }
     return ret;
 }
Пример #6
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="session"></param>
        /// <param name="product"></param>
        /// <param name="mb"></param>
        /// <param name="delivery"></param>
        /// <param name="part"></param>
        /// <param name="name"></param>
        /// <param name="spliter"></param>
        /// <returns></returns>
        public static string GetValue(Session session, 
                                                    IProduct product, 
                                                    IMB mb, 
                                                    Delivery delivery, 
                                                    IPart part,
                                                    string name, char spliter)
        {
            int index = name.IndexOf(spliter);
            if (index < 1)
            {
                throw new Exception("wrong method name : " + name);
            }

            string objName = name.Substring(0, index).ToUpper();
            string objMethod = name.Substring(index + 1).Trim();

            if (objName == GlobalConstName.ResolveValue.PRODUCTINFO)
            {
                if (product == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Product" });
                }
                return product.ProductInfoes
                                            .Where(x => x.InfoType == objMethod)
                                            .Select(y => y.InfoValue).FirstOrDefault();
            }
            if (objName == GlobalConstName.ResolveValue.PRODUCTATTR)
            {
                if (product == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Product" });
                }
                if (product.ProductAttributes == null ||
                    !product.ProductAttributes.Any(x => x.AttributeName == objMethod))
                {
                    throw new FisException("CHK1036", new List<string> { product.ProId, name });
                }
                return product.ProductAttributes
                                            .Where(x => x.AttributeName == objMethod)
                                            .Select(y => y.AttributeValue).FirstOrDefault().Trim();
            }

            if (objName == GlobalConstName.ResolveValue.MODEL)
            {
                if (product == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Product" });                   
                }

                if (product.ModelObj == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Product.ModelObj" });
                }

                object value = product.ModelObj.GetProperty(objMethod);
                if (value == null)
                {
                    return null;
                }
                return value.ToString().Trim();

            }

            if (objName == GlobalConstName.ResolveValue.MODELINFO)
            {
                if (product == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Product" });
                }

                if (product.ModelObj == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Product.ModelObj" });
                }

                return product.ModelObj.Attributes
                                            .Where(x => x.Name == objMethod)
                                            .Select(y => y.Value).FirstOrDefault();
            }

            if (objName == GlobalConstName.ResolveValue.FAMILYINFO)
            {
                if (product == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Product" });
                }
                string family = product.Family;
                //IFamilyRepository familyRep = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>();
                IList<FamilyInfoDef> familyInfoList = familyRep.GetExistFamilyInfo(new FamilyInfoDef { family = family, name = objMethod });

                if (familyInfoList == null || familyInfoList.Count == 0)
                {
                    throw new FisException("CHK1036", new List<string> { family, objMethod });
                }

                return familyInfoList[0].value;
            }

            if (objName == GlobalConstName.ResolveValue.PRODUCT)
            {
                if (product == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Product" });
                }
                object value = product.GetProperty(objMethod);
                if (value==null)
                {
                    throw new FisException("not exists property name:" + name);
                }
                return value.ToString();
            }

            #region disable for ICI HTC case
            //if (objName == GlobalConstName.ResolveValue.IMGOSVER)
            //{
            //    if (product == null)
            //    {
            //       throw new FisException("CQCHK0006", new List<string> { "Product" });                   
            //    }

            //    if (product.ModelObj == null ||
            //        string.IsNullOrEmpty(product.ModelObj.OSCode) ||
            //        product.ModelObj.LastEffectiveOSVer == null)
            //    {
            //        throw new FisException("CQCHK0006", new List<string> { "No setup ImgOSVer" });
            //    }

            //    object value = product.ModelObj.LastEffectiveOSVer.GetField(objMethod);
            //    if (value == null)
            //    {
            //        throw new FisException("not exists field name:" + name);
            //    }

            //    return value.ToString().Trim();
            //} 
            #endregion

            if (objName == GlobalConstName.ResolveValue.PCB)
            {
                if (mb == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "PCB" });
                }
                object value = mb.GetProperty(objMethod);
                if (value == null)
                {
                    throw new FisException("not exists property name:" + name);
                }
                return value.ToString();
            }

            if (objName == GlobalConstName.ResolveValue.PCBINFO)
            {
                if (mb == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "PCB" });
                }

                return mb.MBInfos
                               .Where(x => x.InfoType == objMethod)
                               .Select(y => y.InfoValue).FirstOrDefault();
            }

            if (objName == GlobalConstName.ResolveValue.DELIVERY)
            {
                if (delivery == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Delivery" });
                }
                object value = delivery.GetProperty(objMethod);
                if (value == null)
                {
                    throw new FisException("not exists property name:" + name);
                }
                return value.ToString();
            }

            if (objName == GlobalConstName.ResolveValue.DELIVERYINFO)
            {
                if (delivery == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Delivery" });
                }
                return delivery.DeliveryInfoes
                              .Where(x => x.InfoType == objMethod)
                              .Select(y => y.InfoValue).FirstOrDefault();
            }


            if (objName == GlobalConstName.ResolveValue.PART)
            {
                if (part == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Delivery" });
                }
                object value = part.GetProperty(objMethod);
                if (value==null)
                {
                    throw new FisException("not exists property name:" + name);
                }
                return value.ToString();
            }

            if (objName == GlobalConstName.ResolveValue.PARTINFO)
            {
                if (part == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Delivery" });
                }
                return part.Attributes
                             .Where(x => x.InfoType == objMethod)
                             .Select(y => y.InfoValue).FirstOrDefault();
            }

            if (objName == GlobalConstName.ResolveValue.SESSION)
            {
                if (session == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Session" });                    
                }
                object value = session.GetValue(objMethod);
                if (value == null)
                {
                    throw new FisException("not exists session key name:" + name);
                }
                return value.ToString().Trim();
            }
            if (objName == GlobalConstName.ResolveValue.DATETIME)
            {
                DateTime now = DateTime.Now;
                return now.ToString(objMethod);
            }

            if (objName == GlobalConstName.ResolveValue.CONSTANT)
            {
                return objMethod;
            } 
            throw new Exception("not support resolve name:" + name);
        }
Пример #7
0
        private bool CheckFamilyAndModel(LabelTypeRuleDef rule, string family, string model, Delivery delivery,
            IList<IMES.FisObject.Common.Model.ModelInfo> modelInfos)
        {
           
            if (!string.IsNullOrEmpty(rule.Family) && !Regex.IsMatch(family,rule.Family)) 
            {               
                return false;
            }

            if (!string.IsNullOrEmpty(rule.Model) && !Regex.IsMatch(model, rule.Model))
            {
                return false;
            }

            IList<PartInfo> checkModelInfos = new List<PartInfo>();
            if (!string.IsNullOrEmpty(rule.ModelConstValue))
            {
                checkModelInfos = GetConstValue(rule.ModelConstValue);
            }

            if (checkModelInfos.Count > 0)
            {
                if (
                    modelInfos.Count == 0 || 
                    !CheckModelInfo(modelInfos, checkModelInfos)
                    )
                {
                    return false;
                }                
            }

            IList<PartInfo> checkDeliveryInfos = new List<PartInfo>();
            if (!string.IsNullOrEmpty(rule.DeliveryConstValue))
            {
                checkDeliveryInfos = GetConstValue(rule.DeliveryConstValue);
            }
            if (checkDeliveryInfos.Count > 0)
            {
                if (
                    delivery==null ||
                    !CheckDeliveryInfo(delivery.DeliveryInfoes, checkDeliveryInfos)
                    )
                {
                    return false;
                }
               
            }

            return true;
        }
Пример #8
0
        IList<PrintItem> IPrintContentWarranty.WarrantyPrint(string productID, Boolean conPrintFlag, IList<PrintItem> printItems)
        {
            logger.Debug("[DX](PrintContentWarrantyImpl)WarrantyPrint start, prodId:" + productID);
            //FisException ex;
            //List<string> erpara = new List<string>();
            string sessionKey = productID;

            try
            {
                Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, ProductSessionType);

                if (currentSession == null)
                {
                    FisException ex;
                    List<string> erpara = new List<string>();
                    erpara.Add(sessionKey);
                    ex = new FisException("CHK021", erpara);
                    throw ex;
                }
                else
                {
                    Product curProduct = (Product)currentSession.GetValue(Session.SessionKeys.Product);

                    IBOMRepository bomRepository = RepositoryFactory.GetInstance().GetRepository<IBOMRepository>();
                    IDeliveryRepository DeliveryRepository = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();

                    Delivery curDelivery = new Delivery();
                    if (!string.IsNullOrEmpty(curProduct.DeliveryNo))
                    {
                        curDelivery = DeliveryRepository.Find(curProduct.DeliveryNo);
                    }

                    //5A.不需要打印Warranty Card
                    //A. 当不需要打印Warranty Card时,则提示错误信息” No need to print Warranty Card!”
                    //移动至web端提示

                    Boolean WarrantyPrint = (Boolean)currentSession.GetValue("WarrantyPrint");
                    if (WarrantyPrint)
                    {
                        //5B. 没有维护Warranty Card
                        //Product.Model在ModelInfo中找不到对应的Name=” WRNT”的记录
                        string wrnt = (string)curProduct.GetModelProperty("WRNT");
                        if (string.IsNullOrEmpty(wrnt))
                        {
                            SessionManager.GetInstance.RemoveSession(currentSession);
                            FisException ex;
                            List<string> erpara = new List<string>();
                            erpara.Add(sessionKey);
                            ex = new FisException("PAK060", erpara);//没有Maintain,请联系PE
                            throw ex;
                        }

                        //5C. Warranty维护错误
                        //[5B]中得到的值,应该是用”,”分隔的,按照”,”解析到数组中,得到数组Ubound值小于2时,报错
                        string[] sArray = wrnt.Split(',');
                        if (sArray.Length < 2)
                        {
                            SessionManager.GetInstance.RemoveSession(currentSession);
                            FisException ex;
                            List<string> erpara = new List<string>();
                            erpara.Add(sessionKey);
                            ex = new FisException("PAK084", erpara);//资料有误
                            throw ex;
                        }

                        //5D. unit还没有结合DN
                        //Product.DeliveryNo=””
                        //if ((curProduct.DeliveryNo == null) || (curProduct.DeliveryNo == ""))
                        //{
                        //    SessionManager.GetInstance.RemoveSession(currentSession);
                        //    FisException ex;
                        //    List<string> erpara = new List<string>();
                        //    erpara.Add(sessionKey);
                        //    ex = new FisException("PAK062", erpara);//请先结合DN
                        //    throw ex;
                        //}

                        ////5E. unit结合DN没有ShipDate
                        ////当DN的RegId属性值等于SCN and DN的ShipTp属性值等于CTO时,若Delivery.ShipDate=””

                        //String shipData = curDelivery.ShipDate.ToString();
                        //if (shipData == "")
                        //{
                        //    SessionManager.GetInstance.RemoveSession(currentSession);
                        //    FisException ex;
                        //    List<string> erpara = new List<string>();
                        //    erpara.Add(sessionKey);
                        //    ex = new FisException("PAK063", erpara);//無ShipDate,不能打印
                        //    throw ex;
                        //}
                    }
                    currentSession.AddValue(Session.SessionKeys.PrintItems, printItems);
                    currentSession.AddValue(Session.SessionKeys.IsComplete, true);
                    currentSession.AddValue(Session.SessionKeys.ValueToCheck, conPrintFlag);

                    currentSession.Exception = null;
                    currentSession.SwitchToWorkFlow();


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

                        throw currentSession.Exception;
                    }


                    IList<PrintItem> returnList = (IList<PrintItem>)currentSession.GetValue(Session.SessionKeys.PrintItems);
                    return returnList;

                }
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw e;
            }
            finally
            {
                logger.Debug("(PrintContentWarrantyImpl)WarrantyPrint end, prodId:" + productID);
            }
        }
Пример #9
0
        private static string getValueInner(Session session, IProduct product, IMB mb, Delivery delivery, IPart part,
                                                            string name, char spliter, bool isThrowError)
        {
            int index = name.IndexOf(spliter);
            if (index < 1)
            {
                throw new Exception("wrong method name : " + name);
            }

            string objName = name.Substring(0, index);
            string objMethod = name.Substring(index + 1).Trim();

            if (string.Compare(objName, GlobalConstName.ResolveValue.PRODUCTINFO, true) == 0)
            {
                if (product == null)
                {
                    if (isThrowError)
                    {
                        throw new FisException("CQCHK0006", new List<string> { "Product" });
                    }
                    else
                    {
                        return null;
                    }
                }
                if (product.ProductInfoes == null ||
                   !product.ProductInfoes.Any(x => x.InfoType == objMethod))
                {
                    if (isThrowError)
                    {
                        throw new FisException("CHK1036", new List<string> { product.ProId, name });
                    }
                    else
                    {
                        return null;
                    }
                }

                return product.ProductInfoes
                                            .Where(x => x.InfoType == objMethod)
                                            .Select(y => y.InfoValue).FirstOrDefault();
            }
            if (string.Compare(objName, GlobalConstName.ResolveValue.PRODUCTATTR, true) == 0)
            {
                if (product == null)
                {
                    if (isThrowError)
                    {
                        throw new FisException("CQCHK0006", new List<string> { "Product" });
                    }
                    else
                    {
                        return null;
                    }
                }
                if (product.ProductAttributes == null ||
                    !product.ProductAttributes.Any(x => x.AttributeName == objMethod))
                {
                    if (isThrowError)
                    {
                        throw new FisException("CHK1036", new List<string> { product.ProId, name });
                    }
                    else
                    {
                        return null;
                    }
                }
                return product.ProductAttributes
                                            .Where(x => x.AttributeName == objMethod)
                                            .Select(y => y.AttributeValue).FirstOrDefault().Trim();
            }

            if (string.Compare(objName, GlobalConstName.ResolveValue.MODEL,true) == 0)
            {
                if (product == null)
                {
                    if (isThrowError)
                    {
                        throw new FisException("CQCHK0006", new List<string> { "Product" });
                    }
                    else
                    {
                        return null;
                    }
                }

                if (product.ModelObj == null)
                {
                    if (isThrowError)
                    {
                        throw new FisException("CQCHK0006", new List<string> { "Product.ModelObj" });
                    }
                    else
                    {
                        return null;
                    }                    
                }

                object value = product.ModelObj.GetProperty(objMethod);
                if (value == null)
                {
                    var model = product.ModelObj;
                    value = model.GetAttribute(objMethod);
                    if (value == null)
                    {
                        if (isThrowError)
                        {
                            throw new FisException("CHK1036", new List<string> { product.Model, name });
                        }
                        else
                        {
                            return null;
                        }
                    }
                }
                return value.ToString();

            }

            if (string.Compare(objName, GlobalConstName.ResolveValue.MODELINFO, true) == 0)
            {
                if (product == null)
                {
                    if (isThrowError)
                    {
                        throw new FisException("CQCHK0006", new List<string> { "Product" });
                    }
                    else
                    {
                        return null;
                    }
                }

                var model = product.ModelObj;
                if (model == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Product.ModelObj" });
                }

                string value = model.GetAttribute(objMethod);
                if (value == null)
                {
                    if (isThrowError)
                    {
                        throw new FisException("CHK1036", new List<string> { product.Model, name });
                    }
                    else
                    {
                        return null;
                    }
                }
                return value;
            }

            if (string.Compare(objName, GlobalConstName.ResolveValue.FAMILYINFO, true) == 0 ||
                string.Compare(objMethod, GlobalConstName.ResolveValue.FAMILY, true) == 0)
            {
                if (product == null)
                {
                    if (isThrowError)
                    {
                        throw new FisException("CQCHK0006", new List<string> { "Product" });
                    }
                    else
                    {
                        return null;
                    }
                }

                var family = product.FamilyObj;
                if (family == null)
                {                   
                    if (isThrowError)
                    {
                        throw new FisException("CQCHK0006", new List<string> { "Family" });
                    }
                    else
                    {
                        return null;
                    }
                }

                object value = family.GetProperty(objMethod);
                if (value == null)
                {
                    value = family.GetAttribute(objMethod);
                    if (value == null)
                    {
                        if (isThrowError)
                        {
                            throw new FisException("CHK1036", new List<string> { family.FamilyName, objMethod });
                        }
                        else
                        {
                            return null;
                        }
                    }
                }

                return value.ToString();
            }

            if (string.Compare(objName, GlobalConstName.ResolveValue.PRODUCT, true) == 0)
            {
                if (product == null)
                {                   
                    if (isThrowError)
                    {
                        throw new FisException("CQCHK0006", new List<string> { "Product" });
                    }
                    else
                    {
                        return null;
                    }
                }
                object value = product.GetProperty(objMethod);
                if (value == null)
                {
                    value = product.GetAttribute(objMethod);
                    if (value == null)
                    {
                        if (isThrowError)
                        {
                            throw new FisException("not exists property name:" + name);
                        }
                        else
                        {
                            return null;
                        }
                    }
                }
                return value.ToString();
            }

            #region IMGOSVER for HTC
            //if (string.Compare(objName, GlobalConstName.ResolveValue.IMGOSVER, true) == 0)
            //{
            //    if (product == null)
            //    {                    
            //        if (isThrowError)
            //        {
            //            throw new FisException("CQCHK0006", new List<string> { "Product" });
            //        }
            //        else
            //        {
            //            return null;
            //        }
            //    }

            //    if (product.ModelObj == null ||
            //        string.IsNullOrEmpty(product.ModelObj.OSCode) ||
            //        product.ModelObj.LastEffectiveOSVer == null)
            //    {                    
            //        if (isThrowError)
            //        {
            //            throw new FisException("CQCHK0006", new List<string> { "No setup ImgOSVer" });
            //        }
            //        else
            //        {
            //            return null;
            //        }

            //    }

            //    object value = product.ModelObj.LastEffectiveOSVer.GetField(objMethod);
            //    if (value == null)
            //    {
            //        if (isThrowError)
            //        {
            //            throw new FisException("not exists field name:" + name);
            //        }
            //        else
            //        {
            //            return null;
            //        }
            //    }

            //    return value.ToString().Trim();
            //}
            #endregion

            if (string.Compare(objName, GlobalConstName.ResolveValue.PCB, true) == 0)
            {
                if (mb == null)
                {                    
                    if (isThrowError)
                    {
                        throw new FisException("CQCHK0006", new List<string> { "PCB" });
                    }
                    else
                    {
                        return null;
                    }
                }
                object value = mb.GetProperty(objMethod);
                if (value == null)
                {
                    value = mb.GetAttribute(objMethod);
                    if (value == null)
                    {
                        if (isThrowError)
                        {
                            throw new FisException("not exists property name:" + name);
                        }
                        else
                        {
                            return null;
                        }
                    }
                }
                return value.ToString();
            }

            if (string.Compare(objName, GlobalConstName.ResolveValue.PCBINFO, true) == 0)
            {
                if (mb == null)
                {
                    if (isThrowError)
                    {
                        throw new FisException("CQCHK0006", new List<string> { "PCB" });
                    }
                    else
                    {
                        return null;
                    }
                }

                if (mb.MBInfos == null ||
                      !mb.MBInfos.Any(x => x.InfoType == objMethod))
                {
                    if (isThrowError)
                    {
                        throw new FisException("CHK1036", new List<string> { mb.Sn, name });
                    }
                    else
                    {
                        return null;
                    }
                }
                return mb.MBInfos
                               .Where(x => x.InfoType == objMethod)
                               .Select(y => y.InfoValue).FirstOrDefault();
            }

            if (string.Compare(objName, GlobalConstName.ResolveValue.PCBATTR, true) == 0)
            {
                if (mb == null)
                {                   
                    if (isThrowError)
                    {
                        throw new FisException("CQCHK0006", new List<string> { "PCB" });
                    }
                    else
                    {
                        return null;
                    }
                }

                if (mb.PCBAttributes == null ||
                    !mb.PCBAttributes.Any(x => x.AttributeName == objMethod))
                {
                    if (isThrowError)
                    {
                        throw new FisException("CHK1036", new List<string> { mb.Sn, name });
                    }
                    else
                    {
                        return null;
                    }
                }

                return mb.PCBAttributes
                               .Where(x => x.AttributeName == objMethod)
                               .Select(y => y.AttributeValue).FirstOrDefault().Trim();
            }

            if (string.Compare(objName, GlobalConstName.ResolveValue.DELIVERY, true) == 0)
            {
                if (delivery == null)
                {
                    if (isThrowError)
                    {
                        throw new FisException("CQCHK0006", new List<string> { "Delivery" });
                    }
                    else
                    {
                        return null;
                    }
                }
                object value = delivery.GetProperty(objMethod);
                if (value == null)
                {
                    value = delivery.GetExtendedProperty(objMethod);
                    if (value == null)
                    {
                        if (isThrowError)
                        {
                            throw new FisException("not exists property name:" + name);
                        }
                        else
                        {
                            return null;
                        }
                    }
                }
                return value.ToString();
            }

            if (string.Compare(objName, GlobalConstName.ResolveValue.DELIVERYINFO, true) == 0)
            {
                if (delivery == null)
                {                    
                    if (isThrowError)
                    {
                        throw new FisException("CQCHK0006", new List<string> { "Delivery" });
                    }
                    else
                    {
                        return null;
                    }
                }

                if (delivery.DeliveryInfoes == null ||
                    !delivery.DeliveryInfoes.Any(x => x.InfoType == objMethod))
                {
                    if (isThrowError)
                    {
                        throw new FisException("CHK1036", new List<string> { delivery.DeliveryNo, name });
                    }
                    else
                    {
                        return null;
                    }
                }

                return delivery.DeliveryInfoes
                              .Where(x => x.InfoType == objMethod)
                              .Select(y => y.InfoValue).FirstOrDefault();
            }


            if (string.Compare(objName, GlobalConstName.ResolveValue.PART, true) == 0)
            {
                if (part == null)
                {
                    if (isThrowError)
                    {
                        throw new FisException("CQCHK0006", new List<string> { "Part" });
                    }
                    else
                    {
                        return null;
                    }
                }
                object value = part.GetProperty(objMethod);
                if (value == null)
                {
                    value = part.GetAttribute(objMethod);
                    if (value == null)
                    {
                        if (isThrowError)
                        {
                            throw new FisException("not exists property name:" + name);
                        }
                        else
                        {
                            return null;
                        }
                    }
                }
                return value.ToString();
            }

            if (string.Compare(objName, GlobalConstName.ResolveValue.PARTINFO, true) == 0)
            {
                if (part == null)
                {
                    if (isThrowError)
                    {
                        throw new FisException("CQCHK0006", new List<string> { "Part" });
                    }
                    else
                    {
                        return null;
                    }
                }

                if (part.Attributes == null ||
                  !part.Attributes.Any(x => x.InfoType == objMethod))
                {
                    if (isThrowError)
                    {
                        throw new FisException("CHK1036", new List<string> { part.PN, name });
                    }
                    else
                    {
                        return null;
                    }
                }

                return part.Attributes
                             .Where(x => x.InfoType == objMethod)
                             .Select(y => y.InfoValue).FirstOrDefault();
            }

            if (string.Compare(objName, GlobalConstName.ResolveValue.SESSION, true) == 0)
            {
                if (session == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Session" });
                }
                object value = session.GetValue(objMethod);
                if (value == null)
                {
                    if (isThrowError)
                    {
                        throw new FisException("not exists session key name:" + name);
                    }
                    else
                    {
                        return null;
                    }
                }
                return value.ToString().Trim();
            }

            if (string.Compare(objName, GlobalConstName.ResolveValue.DATETIME, true) == 0)
            {
                DateTime now = DateTime.Now;
                return now.ToString(objMethod);
            }

            if (string.Compare(objName, GlobalConstName.ResolveValue.CONSTANT, true) == 0)
            {
                return objMethod;
            }
            throw new Exception("not support resolve name:" + name);
        }
Пример #10
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="product"></param>
 /// <param name="mb"></param>
 /// <param name="delivery"></param>
 /// <param name="part"></param>
 /// <param name="name"></param>
 /// <param name="spliter"></param>
 /// <returns></returns>
 public static string GetValue(IProduct product, IMB mb, Delivery delivery, IPart part,
                                            string name, char spliter)
 {
     return getValueInner(null, product, mb, delivery, part, name, spliter, true); 
 }
Пример #11
0
       /// <summary>
       /// 
       /// </summary>
       /// <param name="session"></param>
       /// <param name="product"></param>
       /// <param name="mb"></param>
       /// <param name="delivery"></param>
       /// <param name="part"></param>
       /// <param name="name"></param>
       /// <param name="spliter"></param>
       /// <returns></returns>
        public static string GetValueWithoutError(Session session,IProduct product, IMB mb, Delivery delivery, IPart part,
                                                   string name, char spliter)
        {

            return getValueInner(session, product, mb, delivery, part, name, spliter, false);           
        }
Пример #12
0
        public string GetMessageByPalletAndLocation(string deliveryNo, string pallet)
        {
            IDeliveryRepository DeliveryRepository =
                    RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
            IPalletRepository palletRepository = 
                    RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>();

            Delivery DeliveryObject = new Delivery();

            DeliveryObject = DeliveryRepository.Find(deliveryNo);
            string strCarrier = string.Empty;
            string strLocation = string.Empty;
            string strPalletQty = string.Empty;

            strCarrier = (string)DeliveryObject.GetExtendedProperty("Carrier");
            //strLocation = palletRepository.GetSnoIdFromPakLocMasByPno(pallet);
            strLocation = "MyTestForLocation";
            if (strLocation == "" && pallet.Substring(0, 2) != "BA" && pallet.Substring(0, 2) != "NA")
            {
                strLocation = "Other";
            }
            else if (pallet.Substring(0, 2) == "NA")
            {
                strLocation = "Others";
            }
            else if (pallet.Substring(0, 2) == "BA")
            {
                strLocation = strCarrier.TrimEnd();
            }

            
            strPalletQty = (string)DeliveryObject.GetExtendedProperty("PalletQty");
            if (strPalletQty == "")
            {
                strPalletQty = "60";
            }
            else
            {
            }

            int iPalletTotal = 10;
            iPalletTotal = DeliveryRepository.GetSumDeliveryQtyOfACertainPallet(pallet);
            int iPalletTier = 6;
            iPalletTier = palletRepository.GetTierQtyFromPalletQtyInfo(iPalletTotal.ToString());

            string strShipWay = string.Empty;
            string strRegId = string.Empty;
            string strRegIdM = string.Empty;

            strShipWay = (string)DeliveryObject.GetExtendedProperty("ShipWay");
            strRegId = (string)DeliveryObject.GetExtendedProperty("RegId");
            strRegIdM = (string)DeliveryObject.GetExtendedProperty("RegIdM");

            strShipWay = "T001";
            strRegId = "SAF";

            string strMessage = string.Empty;
            if (strLocation == "")
            {
                strMessage = "此栈板上机器数量小於等於6台,未分配库位";
            }
            else
            {
                if (iPalletTier == 0)
                {
                    strMessage = "请搬入" + strLocation +  "IE未maintain此种栈板的一层数量";
                }
                else if (strShipWay == "T002" && strRegId != "SNE" && strRegIdM != "SCE" && iPalletTotal >= iPalletTier)
                {
                    strMessage = "请搬入" + strLocation + "海運,滿一層請使用大的木頭棧板";
                }
                else if (strShipWay == "T002" && (strRegId == "SNE" || strRegIdM == "SCE"))
                {
                    strMessage = "请搬入" + strLocation + "EMEA海運,請使用大的木頭棧板";
                }
                else if (strShipWay == "T001" && strRegId == "SNL")
                {
                    strMessage = "请搬入" + strLocation + "滿一層請使用綠色塑料棧板";
                }
                else if (strShipWay == "T001" && (strRegId == "SNE" || strRegIdM == "SCE") && iPalletTotal >= iPalletTier)
                {
                    strMessage = "请搬入" + strLocation + "滿一層請使用chep棧板";
                }
                else if (strShipWay == "T001" && (strRegId == "SNU" || strRegIdM == "SCU") && iPalletTotal >= iPalletTier)
                {
                    strMessage = "请搬入" + strLocation + "滿一層請使用藍色塑料棧板";
                }
                else if (strShipWay == "T001" && strRegId == "SAF" && iPalletTotal >= iPalletTier)
                {
                    strMessage = "请搬入" + strLocation + "滿一層請使用新的木头棧板";
                }
                else if (strShipWay == "T001" && strRegId == "SCN" && iPalletTotal >= iPalletTier)
                {
                    strMessage = "请搬入" + strLocation + "滿一層請使用大的木头棧板";
                }
                else
                {
                    strMessage = "请搬入" + strLocation;
                }
            }


            return strMessage;
        }
Пример #13
0
        ArrayList IPrintContentWarranty.InputCustomerSN(string customerSN, string line, string editor, string station, string customer)
        {
            logger.Debug("(PrintContentWarrantyImpl)InputCustomerSN start, customerSN:" + customerSN
                          + "editor:" + editor + "station:" + station + "customer:" + customer);

            try
            {
                string assetCheck = "";
                string assetMessage = "";
                ArrayList retList = new ArrayList();

                var currentProduct = CommonImpl.GetProductByInput(customerSN, CommonImpl.InputTypeEnum.CustSN);
                string sessionKey = currentProduct.ProId;

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

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

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

                    string wfName, rlName;
                    RouteManagementUtils.GetWorkflow(station, "PrintContentWarranty.xoml", "PrintContentWarranty.rules", out wfName, out rlName);
                    //RouteManagementUtils.GetWorkflow(station, "104KPPrint.xoml", null, out wfName, out rlName);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments);

                    currentSession.AddValue(Session.SessionKeys.Product, sessionKey);
                    currentSession.AddValue(Session.SessionKeys.IsComplete, false);
                    currentSession.SetInstance(instance);

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

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


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

                    throw currentSession.Exception;
                }
                //===============================================================================
                //Get infomation
                Product curProduct = (Product)currentSession.GetValue(Session.SessionKeys.Product);

                IBOMRepository bomRepository = RepositoryFactory.GetInstance().GetRepository<IBOMRepository>();
                IDeliveryRepository DeliveryRepository = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
                
                Delivery curDelivery = new Delivery();
                if (!string.IsNullOrEmpty(curProduct.DeliveryNo))
                {
                    curDelivery = DeliveryRepository.Find(curProduct.DeliveryNo);
                }
                //------Modify Kaisheng 2012/07/21
                //5A.不需要打印Warranty Card
                //Model<>'PC47011QM03Y'且BOM中不存在BomNodeType='PR' and Descr ='Warranty Card'的part
                //FlatBOM curBOM = (FlatBOM)currentSession.GetValue(Session.SessionKeys.SessionBom);
                IHierarchicalBOM curBOM = null;
                Boolean printFlag = false;
                curBOM = bomRepository.GetHierarchicalBOMByModel(curProduct.Model);
                IList<IBOMNode> bomNodeLst = new List<IBOMNode>();

                if (curProduct.Model != "PC47011QM03Y")
                {
                    //Boolean printFlag = false;
                    bomNodeLst = curBOM.FirstLevelNodes;
                    if (bomNodeLst != null && bomNodeLst.Count > 0)
                    {
                        foreach (IBOMNode ibomnode in bomNodeLst)
                        {
                            IPart currentPart = ibomnode.Part;
                            if (currentPart.BOMNodeType == "PR" && currentPart.Descr == "Warranty Card")
                            {
                                printFlag = true;
                                break;
                            }
                        }
                    }

                    //currentSession.AddValue("WarrantyPrint", printFlag);
                }
                currentSession.AddValue("WarrantyPrint", printFlag);
                //------end 2012/07/21------------

                //6. BOM 中有资产标签,并且内销,才需要Check
                //select b.Tp,Type,Message,Sno1 from Special_Det a,Special_Maintain b where a.SnoId=@Productid 
                //and b.Type=a.Tp and b.SWC=”8D” order by Type,b.Tp
                //得到的Tp=”C”,表示需要check Ast SN,且Sno1为Asset Tag SN(目前只考虑得到一条记录的情况)
                //弹出的对话框信息是记录中的Message
                IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IMES.FisObject.FA.Product.IProduct>();
                IList<SpecialCombinationInfo> infoList = productRepository.GetSpecialDetSpecialMaintainInfoList(curProduct.ProId, "8D");

                foreach (SpecialCombinationInfo infoNode in infoList)
                {
                    if (infoNode.maintainInfo.tp.Trim() == "C")
                    {
                        assetCheck = infoNode.detInfo.sno1;
                        assetMessage = infoNode.maintainInfo.message;
                    } 
                }

                //10. 判断是否需要打印Configuration Label   
                //Unit绑定的DN对应的RegId='SCN' 且  ShipTp='CTO'时,需要打印label
                Boolean conPrintFlag = false;
                //打印配置标签优先检查SIE维护的料号,如果没匹配到再检查DN.
                IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
                IList<ConstValueTypeInfo> lstConst = partRep.GetConstValueTypeList("PrintContentPartNoList");
                IList<IBOMNode> NodeLst = curBOM.FirstLevelNodes;
                bool bCompareBios = false;
                if (NodeLst != null && NodeLst.Count > 0 && lstConst != null && lstConst.Count>0)
                {
                    foreach (IBOMNode ibomnode in NodeLst)
                    {
                        var partLabelList = (from p in lstConst
                                             where p.value == ibomnode.Part.PN
                                             select p.value).ToList();
                        if (partLabelList != null && partLabelList.Count > 0)
                        {
                            bCompareBios = true;
                            conPrintFlag = true;
                            break;
                        }
                    }
                }
                if (!bCompareBios)
                {
                    if (!string.IsNullOrEmpty(curProduct.DeliveryNo))
                    {
                        string reg = (string)curDelivery.GetExtendedProperty("RegId");
                        if (reg != null && reg.Length == 3)
                        { reg = reg.Substring(1, 2); }
                        else
                        { reg = ""; }
                        string tp = (string)curDelivery.GetExtendedProperty("ShipTp");
                        // if ((reg == "CN") && (tp == "CTO"))
                        if ((ActivityCommonImpl.Instance.CheckDomesticDN(reg)) && (tp == "CTO"))
                        {
                            conPrintFlag = true;
                        }
                        //currentSession.AddValue("ConfigPrint", conPrintFlag);
                    }
                }
                currentSession.AddValue("ConfigPrint", conPrintFlag);
                //Model.CustPN
                string custPN = "";
                IModelRepository modelRepository = RepositoryFactory.GetInstance().GetRepository<IModelRepository, Model>();
                custPN = modelRepository.Find(curProduct.Model.Trim()).CustPN;

                currentSession.AddValue("AssetCheck", assetCheck);

                retList.Add(curProduct.ProId);   //productID
                retList.Add(custPN);   //customerPN
                retList.Add((string)curProduct.GetModelProperty("WRNT"));    //Warranty
                retList.Add((string)curProduct.GetModelProperty("TYP"));     //configuration
                retList.Add(assetCheck);
                retList.Add(conPrintFlag);
                retList.Add(assetMessage);
                //Add kaisheng,2012/07/21
                retList.Add(printFlag);
                //===============================================================================
                return retList;
            }
            catch (Exception)
            {
                throw;
            }

        }
Пример #14
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="session"></param>
        /// <param name="product"></param>
        /// <param name="mb"></param>
        /// <param name="delivery"></param>
        /// <param name="part"></param>
        /// <param name="name"></param>
        /// <param name="spliter"></param>
        /// <returns></returns>
        public static string GetValue(Session session, 
                                                    IProduct product, 
                                                    IMB mb, 
                                                    Delivery delivery, 
                                                    IPart part,
                                                    string name, char spliter)
        {
            int index = name.IndexOf(spliter);
            if (index < 1)
            {
                throw new Exception("wrong method name : " + name);
            }

            string objName = name.Substring(0, index).ToUpper();
            string objMethod = name.Substring(index + 1).Trim();

            if (objName == "PRODUCTINFO")
            {
                if (product == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "ProductInfo" });
                }
                return product.ProductInfoes
                                            .Where(x => x.InfoType == objMethod)
                                            .Select(y => y.InfoValue).FirstOrDefault();
            }

            if (objName == "MODELINFO")
            {
                if (product == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Product" });
                }
                return product.ModelObj.Attributes
                                            .Where(x => x.Name == objMethod)
                                            .Select(y => y.Value).FirstOrDefault();
            }

            if (objName == "FAMILYINFO")
            {
                if (product == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Product" });
                }
                string family = product.Family;
               
                IList<FamilyInfoDef> familyInfoList = familyRep.GetExistFamilyInfo(new FamilyInfoDef { family = family, name = objMethod });

                if (familyInfoList == null || familyInfoList.Count == 0)
                {
                    throw new FisException("CHK1036", new List<string> { family, objMethod });
                }

                return familyInfoList[0].value;
            }

            if (objName == "PRODUCT")
            {
                if (product == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Product" });
                }
                string value = (string)product.GetProperty(objMethod);
                if (string.IsNullOrEmpty(value))
                {
                    throw new FisException("not exists property name:" + name);
                }
                return value;
            }

            if (objName == "PCB")
            {
                if (mb == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "PCB" });
                }
                string value = (string)mb.GetProperty(objMethod);
                if (string.IsNullOrEmpty(value))
                {
                    throw new FisException("not exists property name:" + name);
                }
                return value;
            }

            if (objName == "PCBINFO")
            {
                if (mb == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "PCB" });
                }

                return mb.MBInfos
                               .Where(x => x.InfoType == objMethod)
                               .Select(y => y.InfoValue).FirstOrDefault();
            }

            if (objName == "DELIVERY")
            {
                if (delivery == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Delivery" });
                }
                string value = (string)delivery.GetProperty(objMethod);
                if (string.IsNullOrEmpty(value))
                {
                    throw new FisException("not exists property name:" + name);
                }
                return value;
            }

            if (objName == "DELIVERYINFO")
            {
                if (delivery == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Delivery" });
                }
                return delivery.DeliveryInfoes
                              .Where(x => x.InfoType == objMethod)
                              .Select(y => y.InfoValue).FirstOrDefault();
            }


            if (objName == "PART")
            {
                if (part == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Part" });
                }
                string value = (string)part.GetProperty(objMethod);
                if (string.IsNullOrEmpty(value))
                {
                    throw new FisException("not exists property name:" + name);
                }
                return value;
            }

            if (objName == "PARTINFO")
            {
                if (part == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Part" });
                }
                return part.Attributes
                             .Where(x => x.InfoType == objMethod)
                             .Select(y => y.InfoValue).FirstOrDefault();
            }

            throw new Exception("not support resolve name:" + name);
        }
Пример #15
0
        /// <summary>
        /// 
        /// </summary>       
        /// <param name="product"></param>
        /// <param name="mb"></param>
        /// <param name="delivery"></param>
        /// <param name="part"></param>
        /// <param name="name"></param>
        /// <param name="spliter"></param>
        /// <returns></returns>
        public static string GetValue(IProduct product, IMB mb, Delivery delivery, Part part,
                                                    string name, char spliter)
        {
            int index = name.IndexOf(spliter);
            if (index < 1)
            {
                throw new Exception("wrong method name : " + name);
            }

            string objName = name.Substring(0, index).ToUpper();
            string objMethod = name.Substring(index + 1).Trim();

            if (objName == GlobalConstName.ResolveValue.PRODUCTINFO)
            {
                if (product == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Product" });
                }
                if (product.ProductInfoes == null || 
                    !product.ProductInfoes.Any(x => x.InfoType == objMethod))
                {
                     throw new FisException("CHK1036", new List<string> { product.ProId, name });
                }
                return product.ProductInfoes
                                            .Where(x => x.InfoType == objMethod)
                                            .Select(y => y.InfoValue).FirstOrDefault().Trim();
            }


            if (objName == GlobalConstName.ResolveValue.PRODUCTATTR)
            {
                if (product == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Product" });
                }
                if (product.ProductAttributes == null ||
                    !product.ProductAttributes.Any(x => x.AttributeName == objMethod))
                {
                    throw new FisException("CHK1036", new List<string> { product.ProId, name });
                }
                return product.ProductAttributes
                                            .Where(x => x.AttributeName == objMethod)
                                            .Select(y => y.AttributeValue).FirstOrDefault().Trim();
            }

            if (objName == GlobalConstName.ResolveValue.MODELINFO)
            {
                if (product == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Product" });
                }

                if (product.ModelObj ==null||
                    product.ModelObj.Attributes == null ||
                    !product.ModelObj.Attributes.Any(x => x.Name == objMethod))
                {
                     throw new FisException("CHK1036", new List<string> { product.Model, name });
                }

                return product.ModelObj.Attributes
                                            .Where(x => x.Name == objMethod)
                                            .Select(y => y.Value).FirstOrDefault().Trim();
            }

            if (objName == GlobalConstName.ResolveValue.FAMILYINFO)
            {
                if (product == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Product" });
                }
                string family = product.Family;
                //IFamilyRepository familyRep = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>();
                IList<FamilyInfoDef> familyInfoList = familyRep.GetExistFamilyInfo(new FamilyInfoDef { family = family, name = objMethod });

                if (familyInfoList == null || familyInfoList.Count == 0)
                {
                    throw new FisException("CHK1036", new List<string> { family, name });
                }

                return familyInfoList[0].value.Trim();
            }

            if (objName == GlobalConstName.ResolveValue.PRODUCT)
            {
                if (product == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Product" });
                }
                string value = (string)product.GetProperty(objMethod);
                if (string.IsNullOrEmpty(value))
                {
                    throw new FisException("not exists property name:" + name);
                }
                return value.Trim();
            }

            if (objName == GlobalConstName.ResolveValue.PCB)
            {
                if (mb == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "PCB" });
                }
                string value = (string)mb.GetProperty(objMethod);
                if (string.IsNullOrEmpty(value))
                {
                    throw new FisException("not exists property name:" + name);
                }
                return value.Trim();
            }

            if (objName == GlobalConstName.ResolveValue.PCBINFO)
            {
                if (mb == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "PCB" });
                }

                if (mb.MBInfos==null || 
                    !mb.MBInfos.Any(x => x.InfoType == objMethod))
                {
                    throw new FisException("CHK1036", new List<string> { mb.Sn, name });
                }

                return mb.MBInfos
                               .Where(x => x.InfoType == objMethod)
                               .Select(y => y.InfoValue).FirstOrDefault().Trim();
            }

            if (objName == GlobalConstName.ResolveValue.DELIVERY)
            {
                if (delivery == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Delivery" });
                }
                string value = (string)delivery.GetProperty(objMethod);
                if (string.IsNullOrEmpty(value))
                {
                    throw new FisException("not exists property name:" + name);
                }
                return value.Trim();
            }

            if (objName == GlobalConstName.ResolveValue.DELIVERYINFO)
            {
                if (delivery == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Delivery" });
                }

                if (delivery.DeliveryInfoes==null||
                    !delivery.DeliveryInfoes.Any(x => x.InfoType == objMethod))
                {
                    throw new FisException("CHK1036", new List<string> { delivery.DeliveryNo, name });
                }

                return delivery.DeliveryInfoes
                              .Where(x => x.InfoType == objMethod)
                              .Select(y => y.InfoValue).FirstOrDefault().Trim();
            }


            if (objName == GlobalConstName.ResolveValue.PART)
            {
                if (part == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Part" });
                }
                string value = (string)part.GetProperty(objMethod);
                if (string.IsNullOrEmpty(value))
                {
                    throw new FisException("not exists property name:" + name);
                }
                return value.Trim();
            }

            if (objName == GlobalConstName.ResolveValue.PCBINFO)
            {
                if (part == null)
                {
                    throw new FisException("CQCHK0006", new List<string> { "Part" });
                }

                if (part.Attributes==null ||
                    !part.Attributes.Any(x => x.InfoType == objMethod))
                {
                    throw new FisException("CHK1036", new List<string> { part.PN, name });
                }

                return part.Attributes
                             .Where(x => x.InfoType == objMethod)
                             .Select(y => y.InfoValue).FirstOrDefault().Trim();
            }

            throw new Exception("not support resolve name:" + name);
        }
Пример #16
0
        /// <summary>
        /// Delivery 分配原则
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {

            List<string> errpara = new List<string>();
            Product curProduct = (Product)CurrentSession.GetValue(Session.SessionKeys.Product);

            IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            IDeliveryRepository deliveryRep = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
            IModelRepository modelRep = RepositoryFactory.GetInstance().GetRepository<IModelRepository, Model>();

           /*IList<ProductBTInfo> btList = productRep.GetProductBT(curProduct.ProId);
            if (btList.Count > 0 && Station.Trim() == "92")
            {
                return base.DoExecute(executionContext);
            }
            */
            Delivery assignDelivery = new Delivery();
            CurrentSession.AddValue("HasDN", "N");
            //CDSI 机器Assign Delivery的特殊要求
            //IList<IMES.FisObject.Common.Model.ModelInfo> GetModelInfoByModelAndName(string model, string name);
            IList<IMES.FisObject.Common.Model.ModelInfo> infoList = modelRep.GetModelInfoByModelAndName(curProduct.Model, "PO");
            Model model = modelRep.Find(curProduct.Model);
            string cdsi = "";
            cdsi= model.GetAttribute("PO");
            if (cdsi != "Y")
            {
                cdsi = "";
                cdsi = model.GetAttribute("ATSNAV");
                if (!string.IsNullOrEmpty(cdsi))
                {
                    cdsi = "cdsi";
                }
            }
            else
            {
                cdsi = "cdsi";
            }
            CurrentSession.AddValue("CDSI", cdsi);

            if (cdsi == "cdsi")
            {
                if (!string.IsNullOrEmpty(curProduct.DeliveryNo))
                {
                    assignDelivery = deliveryRep.Find(curProduct.DeliveryNo);
                    CurrentSession.AddValue(Session.SessionKeys.Delivery, assignDelivery);
                    CurrentSession.AddValue("HasDN", "Y");
                    return base.DoExecute(executionContext);
                }

                string factoryPo = "";
                //获取Product 结合的Factory Po,对于CDSI 机器如果获取不到结合的Factory Po,
                //需要报告错误:“CDSI AST MISSING DATA!”
                //SELECT @FactoryPo = Sno FROM CDSIAST NOLOCK WHERE SnoId = @ProductId AND Tp = 'FactoryPO'

                CdsiastInfo conf = new CdsiastInfo();
                conf.snoId = curProduct.ProId;
                conf.tp = "FactoryPO";
                IList<CdsiastInfo> cdsiList = productRep.GetCdsiastInfoList(conf);
                if (cdsiList.Count == 0)
                {
                    errpara.Add(this.Key);
                    throw new FisException("PAK140", errpara);//“CDSI AST MISSING DATA!”
                }
                factoryPo = cdsiList[0].sno;
                IList<Delivery> dnList = deliveryRep.GetDeliveryListByModelPrefix(factoryPo, "PC", 12, "00");

                //IF @Delivery = ''	SELECT 'CDSI 机器,无此PoNo: ' + @FactoryPo + ' 的Delivery!'
                if (dnList.Count == 0)
                {
                    errpara.Add(factoryPo);
                    throw new FisException("PAK141", errpara);//'CDSI 机器,无此PoNo: ' + @FactoryPo + ' 的Delivery!'
                }
                assignDelivery = dnList[0];
                curProduct.DeliveryNo = assignDelivery.DeliveryNo;

            }
            else if (!curProduct.IsBT)
            {

                //a)选择的DN需要满足如下要求:
                //Delivery.ShipDate 大于3天前 (例如:当天为2011/9/13,那么获取的DN 的ShipDate 要大于2011/9/10) – 即ShipDate>=convert(char(10),getdate()-3,111)
                //Note:
                //ShipDate 需要转换为YYYY/MM/DD 格式显示
                //Sample: 2009/05/11
                //Delivery.Status = ‘00’
            	//Delivery.Model 长度为12 位
                //Delivery.Model 前两码为’PC’

                //系统自动分配另外一个DN(列表中满足条件的Delivery按照ShipDate,Qty,DeliveryNo 排序取第一个),

                DNQueryCondition condition = new DNQueryCondition();
                DateTime temp = DateTime.Now;
                temp = temp.AddDays(-3);
                condition.ShipDateFrom = new DateTime(temp.Year, temp.Month, temp.Day, 0, 0, 0, 0);
                condition.Model = curProduct.Model;
                IList<DNForUI> dnList = deliveryRep.GetDNListByConditionWithSorting(condition);
                foreach (DNForUI tmp in dnList)
                {
                    if (tmp.Status != "00")
                    {
                        continue;
                    }
                    if (!(tmp.ModelName.Length == 12 && tmp.ModelName.Substring(0, 2) == "PC"))
                    {
                        continue;
                    }
                    //tmp.Editor = deliveryRep.GetDeliveryInfoValue(tmp.DeliveryNo, "PartNo");//CustomerPN

                    int qty = 0;
                    int packedQty = 0;
                    qty = tmp.Qty;
                    IList<IProduct> productList = new List<IProduct>();
                    productList = productRep.GetProductListByDeliveryNo(tmp.DeliveryNo);
                    packedQty = productList.Count;
                    if (packedQty+1 > qty)
                    {
                        continue;
                    }

                    assignDelivery = deliveryRep.Find(tmp.DeliveryNo);
                    break;
                }
                if (assignDelivery == null)
                {
                    FisException fe = new FisException("PAK103", new string[] { });   //没找到可分配的delivery
                    throw fe;
                }
                curProduct.DeliveryNo = assignDelivery.DeliveryNo;
            }
           
            CurrentSession.AddValue(Session.SessionKeys.Delivery, assignDelivery);

            return base.DoExecute(executionContext);
        }
Пример #17
0
        public string GetMessageByPalletAndLocation(string deliveryNo, string pallet)
        {
            IDeliveryRepository DeliveryRepository =
                    RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
            IPalletRepository palletRepository = 
                    RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>();

            Delivery DeliveryObject = new Delivery();

            DeliveryObject = DeliveryRepository.Find(deliveryNo);
            string strCarrier = string.Empty;
            string strLocation = string.Empty;
            string strPalletQty = string.Empty;

            strCarrier = (string)DeliveryObject.GetExtendedProperty("Carrier");
            //strLocation = palletRepository.GetSnoIdFromPakLocMasByPno(pallet);
            strLocation = "MyTestForLocation";
            if (strLocation == "" && pallet.Substring(0, 2) != "BA" && pallet.Substring(0, 2) != "NA")
            {
                strLocation = "Other";
            }
            else if (pallet.Substring(0, 2) == "NA")
            {
                strLocation = "Others";
            }
            else if (pallet.Substring(0, 2) == "BA")
            {
                strLocation = strCarrier.TrimEnd();
            }

            
            strPalletQty = (string)DeliveryObject.GetExtendedProperty("PalletQty");
            if (strPalletQty == "")
            {
                strPalletQty = "60";
            }
            else
            {
            }

            int iPalletTotal = 10;
            iPalletTotal = DeliveryRepository.GetSumDeliveryQtyOfACertainPallet(pallet);
            int iPalletTier = 6;
            iPalletTier = palletRepository.GetTierQtyFromPalletQtyInfo(iPalletTotal.ToString());

            string strShipWay = string.Empty;
            string strRegId = string.Empty;
            string strRegIdM = string.Empty;

            strShipWay = (string)DeliveryObject.GetExtendedProperty("ShipWay");
            strRegId = (string)DeliveryObject.GetExtendedProperty("RegId");
            if (strRegId != null && strRegId.Length == 3)
            { strRegId = strRegId.Substring(1, 2); }
            else
            { strRegId = ""; }
            strRegIdM = (string)DeliveryObject.GetExtendedProperty("RegIdM");

            strShipWay = "T001";
            strRegId = "AF";
            
            string strMessage = string.Empty;
            string site = IMES.Infrastructure.Utility.Common.CommonUti.GetSite();
            if (site == "ICC")
            {
                if (strLocation == "")
                {
                    strMessage = "此栈板上机器数量小於等於6台,未分配库位";
                }
                else
                {
                    IList<PalletType> lstPalletType = IMES.Infrastructure.Utility.Common.CommonUti.GetPalletType(pallet, deliveryNo);
                    string type = "";
                    if (lstPalletType.Count> 0)
                    { 
                        PalletType palletType = lstPalletType[0];
                        type = palletType.Type;
                    }
                    if (string.IsNullOrEmpty(type))
                    { strMessage = "请搬入" + strLocation + "滿一層請使用Other棧板"; }
                    else
                    { strMessage = "请搬入" + strLocation + "滿一層請使用" + type; }
                }
            }
            else
            {
                if (strLocation == "")
                {
                    strMessage = "此栈板上机器数量小於等於6台,未分配库位";
                }
                else
                {
                    if (iPalletTier == 0)
                    {
                        strMessage = "请搬入" + strLocation + "IE未maintain此种栈板的一层数量";
                    }
                    else if (strShipWay == "T002" && strRegId != "NE" && strRegIdM != "CE" && iPalletTotal >= iPalletTier)
                    {
                        strMessage = "请搬入" + strLocation + "海運,滿一層請使用大的木頭棧板";
                    }
                    else if (strShipWay == "T002" && (strRegId == "NE" || strRegIdM == "CE"))
                    {
                        strMessage = "请搬入" + strLocation + "EMEA海運,請使用大的木頭棧板";
                    }
                    else if (strShipWay == "T001" && strRegId == "NL")
                    {
                        strMessage = "请搬入" + strLocation + "滿一層請使用綠色塑料棧板";
                    }
                    else if (strShipWay == "T001" && (strRegId == "NE" || strRegIdM == "CE") && iPalletTotal >= iPalletTier)
                    {
                        strMessage = "请搬入" + strLocation + "滿一層請使用chep棧板";
                    }
                    else if (strShipWay == "T001" && (strRegId == "NU" || strRegIdM == "CU") && iPalletTotal >= iPalletTier)
                    {
                        strMessage = "请搬入" + strLocation + "滿一層請使用藍色塑料棧板";
                    }
                    else if (strShipWay == "T001" && strRegId == "AF" && iPalletTotal >= iPalletTier)
                    {
                        strMessage = "请搬入" + strLocation + "滿一層請使用新的木头棧板";
                    }                        
                    //else if (strShipWay == "T001" && strRegId == "CN" && iPalletTotal >= iPalletTier)
                    else if (strShipWay == "T001" && ActivityCommonImpl.Instance.CheckDomesticDN(strRegId) && iPalletTotal >= iPalletTier)
                    {
                        strMessage = "请搬入" + strLocation + "滿一層請使用大的木头棧板";
                    }
                    else
                    {
                        strMessage = "请搬入" + strLocation;
                    }
            
            }


           
            }


            return strMessage;
        }