Beispiel #1
0
        /// <summary>
        /// 在添加controller之前做检查
        /// </summary>
        /// <param name="typeInfo">controller类型</param>
        /// <param name="addNumber">增加的数量</param>
        /// <returns></returns>
        private bool CheckBeforeAddController(CentralController typeInfo, int addNumber)
        {
            ControllerLayoutType type = glProject.ControllerLayoutType;
            int controllerQty         = GetControllerQty();
            int outdoorQty            = GetOutdoorQty();
            int indoorQty             = GetIndoorQty();
            int ccControllerQty       = GetControllerQty(ControllerType.CentralController);
            int onoffQty = GetControllerQty(ControllerType.ONOFF);
            int unitQty  = outdoorQty + indoorQty;

            //累加上需要新增的数量
            controllerQty += addNumber;
            switch (typeInfo.Type)
            {
            case ControllerType.ONOFF:
                onoffQty += addNumber;
                break;

            case ControllerType.Software:     //软件不统计数量,但是因为会同时增加一个实体controller,所以需要加上
            case ControllerType.CentralController:
                ccControllerQty += addNumber;
                break;
            }

            int deviceQty = controllerQty + unitQty;  //TODO: 此处还需要加上remote controller的数量

            ////检查产品类型是否匹配
            //if (CheckProductType(ucDropOutdoor1.GetProductTypes(), typeInfo.ProductType) == false)
            //{
            //    return false;
            //}

            //区分exchanger 和system 选中的Controller on 20170830 by xyj
            if (CheckSystemAndExchanger(ucDropOutdoor1.GetOutdoorAndExchanger(), typeInfo.ProductType) == false)
            {
                return(false);
            }

            //区分exchanger类型对应的Controller 类型是否相同on 20170904 by xyj
            if (CheckExchangerIsMatch(ucDropOutdoor1.GetExchangerTypesList(), typeInfo.ProductType) == false)
            {
                return(false);
            }

            //EU暂时忽略设备数及Hlink限制   add on 20180621 by Vince
            if (_mainRegion == "EU_E" || _mainRegion == "EU_S" || _mainRegion == "EU_W")
            {
                return(true);
            }

            //检查设备数量是否符合拖动的controller的限制
            if (CheckSystemQtyLimitation(typeInfo, indoorQty, outdoorQty, deviceQty + addNumber) == false)
            {
                return(false);
            }

            //检查设备数量是否在H-Link的限制范围之内
            bool isHLinkII = !(typeInfo.Protocol.Trim().ToUpper() == "H-LINK" || HasHLinkI());

            if (CheckHLinkLimiation(isHLinkII, indoorQty, outdoorQty, deviceQty + addNumber) == false)
            {
                return(false);
            }

            ////1 - Can be connected upto 8 Central Controllers in 1 H-Link
            //if (typeInfo.Type == ControllerType.CentralController && ccControllerQty > Model.ConstValue.HLINKII_MAX_CC_QTY)
            //{
            //    JCMsg.ShowWarningOK(Msg.CONTROLLER_HLINK_CENTRAL_CONTROLLER_QTY(Model.ConstValue.HLINKII_MAX_CC_QTY));
            //    return false;
            //}



            //1 - Can be connected upto 8 Central Controllers in 1 H-Link
            if (typeInfo.MaxControllerNumber > 0 && ccControllerQty > typeInfo.MaxControllerNumber)
            {
                JCMsg.ShowWarningOK(Msg.CONTROLLER_HLINK_CENTRAL_CONTROLLER_QTY(ControllerConstValue.HLINKII_MAX_CC_QTY));
                return(false);
            }

            //2 - combination limitation
            CheckCombinationLimitation(typeInfo);

            //3 - check quantity of this model
            if (typeInfo.MaxSameModel > 0 && GetControllerQty(typeInfo.Model) + addNumber > typeInfo.MaxSameModel)
            {
                JCMsg.ShowWarningOK(Msg.CONTROLLER_HLINK_CONTROLLER_QTY(typeInfo.MaxSameModel));
                return(false);
            }

            //4 - check quantity of this type
            if (typeInfo.MaxSameType > 0 && GetControllerQty(typeInfo.Type) + addNumber > typeInfo.MaxSameType)
            {
                JCMsg.ShowWarningOK(Msg.CONTROLLER_HLINK_CONTROLLER_QTY(typeInfo.MaxSameType));
                return(false);
            }

            //5 - BACNet Interface Can be connected upto 4 Central Controllers
            if (typeInfo.Type == ControllerType.BACNetInterface && ccControllerQty > ControllerConstValue.BACNET_MAX_CC_QTY)
            {
                JCMsg.ShowWarningOK(Msg.CONTROLLER_BACNET_CC_QTY(ControllerConstValue.BACNET_MAX_CC_QTY));
            }

            //6 - For Web based Cotnrol, max 176 units (ODU + IDU) can be connected.
            if (typeInfo.MaxUnitNumber > 0 && unitQty > typeInfo.MaxUnitNumber)
            {
                //TODO: 此处需要翻译
                JCMsg.ShowWarningOK(Msg.CONTROLLER_UNIT_QTY(typeInfo.Model, typeInfo.MaxUnitNumber));
            }


            return(true);
        }