Exemple #1
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);
        }
        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;
            }

        }
Exemple #3
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;
        }
Exemple #4
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;
        }