Example #1
0
        public static SystemHeatExchanger Duplicate(this SystemHeatExchanger systemToDuplicate)
        {
            if (systemToDuplicate == null)
            {
                throw new ArgumentNullException("Input Exchanger system was empty");
            }
            var currentProject = Project.GetProjectInstance;
            var newSystem      = ((SystemHeatExchanger)systemToDuplicate).DeepClone <SystemHeatExchanger>();

            // system id
            var count      = (currentProject.HeatExchangerSystems.Count + 1);
            var systemName = SystemSetting.UserSetting.defaultSetting.ExchangerName + " " + count;

            while (currentProject.HeatExchangerSystems.Any(i => i.Name.ToLower() == systemName.ToLower()))
            {
                count++;
                systemName = SystemSetting.UserSetting.defaultSetting.ExchangerName + " " + count;
            }


            newSystem.Name = systemName;
            newSystem.RegenerateId();

            var roomIndoor = new RoomIndoor();

            roomIndoor = Project.CurrentProject.ExchangerList[Project.CurrentProject.ExchangerList.FindIndex(x => x.SystemID == systemToDuplicate.Id)].DeepClone();
            // roomIndoor = Project.CurrentProject.ExchangerList[Project.CurrentProject.ExchangerList.FindIndex(x => x.SystemID == systemToDuplicate.Id)];
            roomIndoor.SystemID       = newSystem.Id;
            roomIndoor.ControlGroupID = new List <string>();
            Project.CurrentProject.ExchangerList.Add(roomIndoor);

            currentProject.HeatExchangerSystems.Add((SystemHeatExchanger)newSystem);

            return(newSystem);
        }
Example #2
0
        private void DeleteShareRelationShip(RoomIndoor ri)
        {
            string groupIndoorName = "";

            if (ri.IndoorItemGroup == null || ri.IndoorItemGroup.Count == 0)
            {
                return;
            }

            foreach (RoomIndoor rind in ri.IndoorItemGroup)
            {
                groupIndoorName = groupIndoorName += rind.IndoorName + ",";
            }

            groupIndoorName = groupIndoorName.Substring(0, groupIndoorName.Length - 1);

            foreach (string indNo in groupIndoorName.Split(','))
            {
                RoomIndoor riItem = _bllProject.GetIndoor(int.Parse(indNo.Substring(indNo.Length - 1)));
                riItem.IndoorItemGroup = null;
                if (riItem.IsMainIndoor)
                {
                    riItem.IsMainIndoor = false;
                }
            }

            return;
        }
Example #3
0
        /// <summary>
        /// 获得指定的一个或多个室外机的ProductType
        /// </summary>
        /// <param name="items"></param>
        /// <returns></returns>
        public List <string> GetProductTypes(ICollection items)
        {
            List <string> types = new List <string>();

            foreach (ListViewItem item in items)
            {
                if (item.Tag is Object[])
                {
                    Object[] values = item.Tag as Object[];
                    if (values != null && values.Length > 0)
                    {
                        if (!item.Name.Contains("Heat Exchanger"))
                        {
                            SystemVRF system = values[0] as SystemVRF;
                            if (system.OutdoorItem != null)
                            {
                                types.Add(system.OutdoorItem.ProductType);
                            }
                        }
                        else
                        {
                            RoomIndoor ri = values[0] as RoomIndoor;
                            if (ri.IndoorItem.Series != null)
                            {
                                types.Add(ri.IndoorItem.Series);
                            }
                        }
                    }
                }
            }
            return(types);
        }
Example #4
0
        //public frmSystemUnit()
        //{
        //    InitializeComponent();
        //}

        public frmSystemUnit(Project thisProj, RoomIndoor ri)
        {
            InitializeComponent();
            thisProject = thisProj;
            indoor      = ri;
            BindUnit();
        }
Example #5
0
 /// <summary>
 /// 更新室内机高度差
 /// </summary>
 /// <param name="ri"></param>
 private void UpdateHeightDiff(RoomIndoor ri, RoomIndoor emptyIndoor)
 {
     if (ri != null && ri.IndoorNO > 0)
     {
         ri.PositionType = emptyIndoor.PositionType;
         ri.HeightDiff   = emptyIndoor.HeightDiff;
     }
 }
Example #6
0
        /// <summary>
        /// 兼容旧数据 axj 20160707
        /// </summary>
        /// <param name="inItem"></param>
        public static void CompatType(RoomIndoor ri)
        {
            if (ri.ListAccessory == null)
            {
                return;
            }
            Indoor inItem = ri.IndoorItem;

            if (inItem == null)
            {
                return;
            }
            var list = ri.ListAccessory;

            for (int i = 0; i < list.Count; i++)
            {
                var ent = list[i];
                if (ent == null)
                {
                    continue;
                }
                //修正产品类型
                if (ent.UnitType != inItem.Type)
                {
                    ent.UnitType = inItem.Type;
                }
                //修正工厂代码
                //string modelfull = inItem.ModelFull;
                //string fCode = modelfull.Substring(modelfull.Length - 1, 1);
                // 室内机工厂代码改为类函数获取,用于处理Wuxi design特殊逻辑 20180627 by Yunxiao Lin
                string fCode = inItem.GetFactoryCodeForAccess();
                if (ent.FactoryCode != fCode)
                {
                    ent.FactoryCode = fCode;
                }
                //旧数据Type修正
                switch (ent.Type)
                {
                case "Drainage Pump": ent.Type = "Drain Pump"; break;

                case "Half size remote control switch": ent.Type = "Half-size Remote Control Switch"; break;

                case "Liquid Crystal Remote Control Switch": ent.Type = "Remote Control Switch"; break;

                case "Panel": ent.Type = "Air panel"; break;

                case "Remote Controler": ent.Type = "Remote Control Switch"; break;

                case "Wireless Receiver Kit": ent.Type = "Receiver Kit for Wireless Control"; break;

                default: break;
                }
            }
        }
Example #7
0
        /// <summary>
        /// 计算HeightDifference 的最大高度差
        /// </summary>
        private bool CalculateMaxHeightDifference(RoomIndoor ri)
        {
            bool          isReturn   = true;
            List <double> diffList   = new List <double>(); //高度差集合
            double        maxValue   = 0;                   //最大高度差
            double        minValue   = 0;                   //最小高度差
            double        indDiff    = 0;                   //室内机高度差
            double        inputValue = ri.HeightDiff;       //输入值

            if (listRISelected.Count > 0)
            {
                foreach (RoomIndoor ind in listRISelected)
                {
                    double val = Convert.ToDouble(ind.HeightDiff);
                    if (ind.PositionType == PipingPositionType.Lower.ToString())
                    {
                        double m = 0 - val;
                        diffList.Add(m);
                    }
                    else
                    {
                        diffList.Add(val);
                    }
                }
                maxValue = Convert.ToDouble(diffList.Max().ToString("n1"));
                minValue = Convert.ToDouble(diffList.Min().ToString("n1"));

                if (ri.PositionType == PipingPositionType.Lower.ToString())
                {
                    inputValue = 0 - ri.HeightDiff;
                }
                if (inputValue > maxValue)
                {
                    maxValue = inputValue;
                }
                if (inputValue < minValue)
                {
                    minValue = inputValue;
                }
                if (maxValue > minValue)
                {
                    indDiff = maxValue - minValue;
                }
            }

            if (indDiff > sysItemSource.MaxDiffIndoorHeight)
            {
                isReturn = false;
            }
            return(isReturn);
        }
Example #8
0
 /// 获取楼层房间名
 /// <summary>
 /// 获取楼层房间名   add on 20180608 by Vince
 /// </summary>
 /// <param name="ri"></param>
 /// /// <param name="thisPro"></param>
 public string getFloorRoomName(RoomIndoor ri, Project thisPro)
 {
     foreach (Floor f in thisPro.FloorList)
     {
         foreach (Room rm in f.RoomList)
         {
             if (rm.Id == ri.RoomID)
             {
                 return(f.Name + ":" + ri.RoomName);
             }
         }
     }
     return(null);
 }
Example #9
0
        private RoomIndoor GetNewRoomIndoor(DataRow stdRow, RoomIndoor ri)
        {
            RoomIndoor door   = new RoomIndoor();
            Indoor     inItem = bll.GetItem(stdRow["ModelFull"].ToString(), _unitType, _productType, _series); // 新室内机对象

            door.SetIndoorItemWithAccessory(inItem);
            door.RoomID          = "";
            door.RoomName        = "";
            door.IsFreshAirArea  = ri.IsFreshAirArea;
            door.CoolingCapacity = Convert.ToDouble(inItem.CoolingCapacity);
            door.SensibleHeat    = Convert.ToDouble(inItem.SensibleHeat);
            door.RqAirflow       = door.AirFlow;//Convert.ToDouble(inItem.AirFlow);
            door.HeatingCapacity = Convert.ToDouble(inItem.HeatingCapacity);
            //door.AirFlow = Convert.ToDouble(inItem.AirFlow);
            door.IndoorItem.Series = ri.IndoorItem.Series;
            door.IsDelete          = false;

            return(door);
        }
Example #10
0
        /// 计算指定室内机的实际Capacity值(经过Piping校验计算之后的最终值,已改为实际值) 20161116 by Yunxiao Lin
        /// <summary>
        /// 计算指定室内机的实际Capacity值(经过Piping校验计算之后的最终值,已改为实际值)
        /// </summary>
        /// <param name="ri">RoomIndoor对象</param>
        /// <returns></returns>
        public static double GetIndoorActCapacityCool(RoomIndoor ri, out double actHeat)
        {
            //actHeat = 0;
            //double actCool = 0;

            //SystemVRF sysItem = GetSystem(ri.SystemName);
            //if (sysItem != null)
            //{
            //    double inRatCap = GetInRatCapacity(ri);

            //    double totInRating = GetTotalInRatCapacity(sysItem.Name);
            //    double outActCap = GetOutActCapacity(sysItem);

            //    double ret = inRatCap * outActCap / (totInRating * sysItem.DiversityFactor);
            //    return ret;
            //}
            //return actCool;
            //actHeat = ri.HeatingCapacity;
            //return ri.CoolingCapacity;
            actHeat = ri.ActualHeatingCapacity;
            return(ri.ActualCoolingCapacity);
        }
Example #11
0
 public IDU()
 {
     _roomIndoor = new RoomIndoor();
 }
Example #12
0
 public DataTable GetInDoorAccessoryItemList(string BrandCode, string FactoryCode, string UnitType, double Capacity, string RegionCode, RoomIndoor ri, string SubRegionCode)
 {
     return(_dal.GetInDoorAccessoryItemList(BrandCode, FactoryCode, UnitType, Capacity, RegionCode, ri, SubRegionCode));
 }
Example #13
0
 public DataTable GetAvailableListType(string BrandCode, string FactoryCode, string ItemType, string RegionCode, RoomIndoor ri, string SubRegionCode)
 {
     return(_dal.GetAvailableListType(BrandCode, FactoryCode, ItemType, RegionCode, ri, SubRegionCode));
 }
        private ObservableCollection <AccessoryModel> GetAllAccessoriesCompatibleForHeatExchanger(RoomIndoor roomIndoor)
        {
            List <AccessoryModel> objListAccessory = new List <AccessoryModel>();
            AccessoryBLL          accessoryBLL     = new AccessoryBLL();
            var       ri          = roomIndoor;
            DataTable dtAccessory = null;

            if (ri != null && ri.IndoorItem != null)
            {
                string factoryCode = ri.IndoorItem.GetFactoryCode();

                dtAccessory = accessoryBLL.GetInDoorAccessoryItemList(Project.CurrentProject.BrandCode,
                                                                      factoryCode, ri.IndoorItem.Type, ri.IndoorItem.CoolingCapacity,
                                                                      Project.CurrentProject.RegionCode, ri, Project.CurrentProject.SubRegionCode);
            }

            //Display Name
            DataTable dtDisplayName = accessoryBLL.GetUniversal_ByAccessory(Project.CurrentProject.SubRegionCode, Project.CurrentProject.BrandCode);

            //Filling Accessory List
            if (dtAccessory != null)
            {
                if (dtAccessory.Rows.Count != 0)
                {
                    if (Project.CurrentProject.BrandCode == "H")
                    {
                        objListAccessory = (from DataRow row in dtAccessory.Rows
                                            select new AccessoryModel
                        {
                            Type = row["Type"].ToString(),
                            Model = row["Model_Hitachi"].ToString(),
                            Description = row["Type"].ToString(),
                            Count = Convert.ToInt32(row["IsDefault"]),
                            MaxCount = Convert.ToInt32(row["MaxNumber"]),
                            IsSelect = false,
                            IsApplyToSimilarUnit = false
                        }).ToList();
                    }
                    else
                    {
                        objListAccessory = (from DataRow row in dtAccessory.Rows
                                            select new AccessoryModel
                        {
                            Type = row["Type"].ToString(),
                            Model = row["Model_York"].ToString(),
                            Description = row["Type"].ToString(),
                            Count = Convert.ToInt32(row["IsDefault"]),
                            MaxCount = Convert.ToInt32(row["MaxNumber"]),
                            IsSelect = false,
                            IsApplyToSimilarUnit = false
                        }).ToList();
                    }
                }
            }

            //Final Accessory List
            List <AccessoryModel> finalListAccessory = new List <AccessoryModel>();
            List <string>         distictType        = new List <string>();

            var result = objListAccessory.Select(x => x.Model).Distinct();

            foreach (var type in result)
            {
                distictType.Add(type);
            }
            foreach (var item in distictType)
            {
                finalListAccessory.Add(new AccessoryModel
                {
                    Type                 = objListAccessory.Where(x => x.Model.Equals(item)).Select(y => y.Type).FirstOrDefault(),
                    ModelName            = objListAccessory.Where(x => x.Model.Equals(item)).Select(y => y.Model).ToList(),
                    Model                = objListAccessory.Where(x => x.Model.Equals(item)).Select(y => y.Model).FirstOrDefault(),
                    IsSelect             = false,
                    IsApplyToSimilarUnit = false,
                    Count                = objListAccessory.Where(x => x.Model.Equals(item)).Select(y => y.Count).FirstOrDefault(),
                    MaxCount             = Convert.ToInt32(objListAccessory.Where(x => x.Model.Equals(item)).Select(y => y.MaxCount).FirstOrDefault()),
                    Description          = objListAccessory.Where(x => x.Model.Equals(item)).Select(y => y.Type).FirstOrDefault()
                });
            }

            return(new ObservableCollection <AccessoryModel>(finalListAccessory));
        }
Example #15
0
        public static string GetAccessoryDisplayTypeByModel(string SubRegionCode, DataTable dtUniversal, string type, string Model, RoomIndoor ri, bool isTrans)
        {
            string result = type;

            if (dtUniversal == null || Model == null || ri == null)
            {
                return(result);
            }
            string factoryCode = ri.IndoorItem.ModelFull.Substring(ri.IndoorItem.ModelFull.Length - 1, 1);

            if (type == "Remote Control Cable")
            {
                switch (Model)
                {
                case "PRC-10E1":
                    result = "2P-Extension cord (10 metres)";
                    break;

                case "PRC-15E1":
                    result = "2P-Extension cord (15 metres)";
                    break;

                case "PRC-20E1":
                    result = "2P-Extension cord (20 metres)";
                    break;

                case "PRC-30E1":
                    result = "2P-Extension cord (30 metres)";
                    break;

                default:
                    result = "Remote Control Cable";
                    break;
                }
                return(result);
            }
            if (type == "Share Remote Control")
            {
                switch (Model)
                {
                case "PC-ARH":
                    result = "Simplified remote control";
                    break;

                default:
                    result = "Remote control with timer";
                    break;
                }
                return(result);
            }

            if (type == "Receiver Kit for Wireless Control")
            {
                if (SubRegionCode == "TW")  //如果当前区域是台湾 直接获取其Display Name 返回 on 20180801 by xyj
                {
                    return(GetDisplayName(SubRegionCode, factoryCode, type, Model, dtUniversal, ri.IndoorItem.Type));
                }
                if (ri.IndoorItem.Model_Hitachi.StartsWith("RPC-") && ri.IndoorItem.Model_Hitachi.EndsWith("FSN3E") && Model == "PC-ALHZ1")
                {
                    result = "Receiver kit for wireless remote control";
                }
                else if (Model == "PC-ALH3" || Model == "PC-ALHP1" || Model == "PC-ALH3" || Model == "PC-ALHC1" || Model == "PC-ALHD1")
                {
                    result = "Receiver kit for wireless remote control(On the panel)";
                }
                else
                {
                    result = "Receiver kit for wireless remote control(On the wall)";
                }
                return(result);
            }

            if (isTrans)
            {
                //翻译
                Trans trans = new Trans();
                result = trans.getTypeTransStr(TransType.IDU_Accessory.ToString(), GetDisplayName(SubRegionCode, factoryCode, type, Model, dtUniversal, ri.IndoorItem.Type));
            }
            else
            {
                result = GetDisplayName(SubRegionCode, factoryCode, type, Model, dtUniversal, ri.IndoorItem.Type);
            }

            return(result);
        }
        private RoomIndoor GetRoomIndoorDetial(RoomIndoor IndoorNo)
        {
            RoomIndoor ind = new RoomIndoor();

            return(ind);
        }
        public void GetHeatExchangerSystemProperties()
        {
            try
            {
                proj = Project.CurrentProject.ExchangerList.Find(x => x.SystemID.Equals(HvacSystem.Id));
                if (proj == null)
                {
                    return;
                }
                this.DefaultFanSpeed  = (string)Enum.GetName(typeof(JCHVRF_New.Model.FanSpeed), proj.FanSpeedLevel);
                this.NoOfPeople       = proj.NumberOfPeople;
                this.outdoorCoolingDB = proj.DBCooling;
                this.outdoorCoolingWB = proj.WBCooling;
                this.outdoorHeatingDB = proj.DBHeating;
                this.outdoorHeatingRH = proj.RHCooling;
                this.FreshAir         = proj.RqFreshAir;
                this.Area             = proj.Area;
                this.ESPVal           = proj.RqStaticPressure;
                if (proj.RoomName != null)
                {
                    this.DefaultRoom = proj.RoomName;
                }
                if (proj.SelectedFloor != null)
                {
                    this.DefaultFloor = proj.SelectedFloor.Name;
                }
                if (proj.IndoorItem != null)
                {
                    this.DefaultSeries = proj.IndoorItem.Series;
                }
                this.DefaultPower = proj.Power;
                this.UnitName     = proj.IndoorName;


                this.SFanSpeed = (FanSpeed)proj.FanSpeedLevel;

                foreach (var room in Project.CurrentProject.RoomList)
                {
                    if (room.Id.Equals(proj.RoomID))
                    {
                        SelectedRoom = room;
                        break;
                    }
                }

                if (proj.SelectedFloor != null)
                {
                    foreach (var floor in Project.CurrentProject.FloorList)
                    {
                        if (floor.Name.Equals(proj.SelectedFloor.Name))
                        {
                            SelectedFloor = floor;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                int?id = Project.GetProjectInstance?.projectID;
                Logger.LogProjectError(id, ex);
            }
        }
Example #18
0
 public IDU(RoomIndoor obj)
 {
     this._roomIndoor = obj;
     this._isChecked  = _roomIndoor.IsDelete;
 }
        private void OnSettingsOk()
        {
            RoomIndoor emptyIndoor = new RoomIndoor();

            if (this.SelectedIndex == 0)
            {
                emptyIndoor.PositionType = PipingPositionType.Upper.ToString();
            }
            else if (this.SelectedIndex == 1)
            {
                emptyIndoor.PositionType = PipingPositionType.SameLevel.ToString();
            }
            else
            {
                emptyIndoor.PositionType = PipingPositionType.Lower.ToString();
            }
            if (TxtIndoorHighDifference == "")
            {
                TxtIndoorHighDifference = "0";
            }
            emptyIndoor.HeightDiff = Unit.ConvertToSource(Convert.ToDouble(TxtIndoorHighDifference), UnitType.LENGTH_M, ut_length);

            if (emptyIndoor.PositionType != PipingPositionType.SameLevel.ToString())
            {
                if (emptyIndoor.HeightDiff <= 0)
                {
                    lblPipingLegthError = Msg.GetResourceString("INDOOR_HIGHERDIFFERENCE_LENGTH");
                    return;
                }
            }

            if (emptyIndoor.PositionType == PipingPositionType.Upper.ToString() && emptyIndoor.HeightDiff > sysItemSource.MaxOutdoorAboveHeight)
            {
                double len = Unit.ConvertToControl(sysItemSource.MaxOutdoorAboveHeight, UnitType.LENGTH_M, ut_length);

                IsPipingPopupOpened = false;
                JCHMessageBox.Show(Language.Current.GetMessage("HEIGHT_UPPER_MSG") + len.ToString("n0") + ut_length);
                return;
            }
            if (emptyIndoor.PositionType == PipingPositionType.Lower.ToString() && emptyIndoor.HeightDiff > sysItemSource.MaxOutdoorBelowHeight)
            {
                double len = Unit.ConvertToControl(sysItemSource.MaxOutdoorBelowHeight, UnitType.LENGTH_M, ut_length);
                IsPipingPopupOpened = false;
                JCHMessageBox.Show(Language.Current.GetMessage("HEIGHT_UPPER_MSG") + len.ToString("n0") + ut_length);

                return;
            }
            foreach (SelectedIDUList ind in SelIDUList)
            {
                int    IDU_ID     = ind.IndoorNo;
                double HeightDiff = emptyIndoor.HeightDiff;
                if (ind.IndoorTag is JCHVRF.Model.NextGen.MyNodeCH)
                {
                    //MyNodeCH nodech = ind.IndoorTag as MyNodeCH;
                    JCHVRF.Model.NextGen.MyNodeCH nodech = ind.IndoorTag as JCHVRF.Model.NextGen.MyNodeCH;
                    if (emptyIndoor.PositionType == PipingPositionType.Lower.ToString())
                    {
                        HeightDiff = -HeightDiff;
                    }
                    nodech.HeightDiff = HeightDiff;
                }
                else if (ind.IndoorTag is JCHVRF.Model.NextGen.MyNodeMultiCH)
                {
                    JCHVRF.Model.NextGen.MyNodeMultiCH nodech = ind.IndoorTag as JCHVRF.Model.NextGen.MyNodeMultiCH;
                    if (emptyIndoor.PositionType == PipingPositionType.Lower.ToString())
                    {
                        HeightDiff = -HeightDiff;
                    }
                    nodech.HeightDiff = HeightDiff;
                }
                else if (ind.IndoorTag is JCHVRF.Model.NextGen.MyNodeIn)
                {
                    JCHVRF.Model.NextGen.MyNodeIn node = ind.IndoorTag as JCHVRF.Model.NextGen.MyNodeIn;
                    node.RoomIndooItem.PositionType = emptyIndoor.PositionType.ToString();
                    node.RoomIndooItem.HeightDiff   = HeightDiff;
                }
            }
            RefreshPanel();

            BindHighDifference();
            VerificationHighDiff();


            PopupSettings       = Visibility.Hidden;
            IsPipingPopupOpened = false;
        }
Example #20
0
        /// <summary>
        /// 重新选型室内机
        /// </summary>
        /// <param name="roomIndoorList"></param>
        /// <param name="Project"></param>
        /// <param name="outDBCool"></param>
        /// <param name="outWBHeat"></param>
        /// <param name="stateList"></param>
        /// <returns></returns>
        public List <RoomIndoor> DoRoomIndoorReselection(List <RoomIndoor> roomIndoorList, Project Project, double outDBCool, double outWBHeat, out List <string> stateList)
        {
            List <RoomIndoor> newRoomindoorList = new List <RoomIndoor>();

            stateList     = new List <string>();
            thisProject   = Project;
            BrandCode     = thisProject.BrandCode;
            IsCoolingMode = thisProject.IsCoolingModeEffective;
            IsHeatingMode = thisProject.IsHeatingModeEffective;
            var floorlist = thisProject.FloorList;

            bll = new IndoorBLL(thisProject.SubRegionCode, thisProject.BrandCode);
            //var dicSeries = CommonOperation.GetProductSeriesKeyValue();
            //List<RoomIndoor> list = new List<RoomIndoor>();
            //var unitlist = CommonOperation.GetUnitTypeList();
            for (int i = 0; i < roomIndoorList.Count; i++)
            {
                var roomIndoor = roomIndoorList[i];
                if (roomIndoor.IsFreshAirArea == true)
                {
                    newRoomindoorList.Add(roomIndoor);
                    //stateList.Add(roomIndoor.IndoorNO + ":Indoor_NoChange");
                    stateList.Add(roomIndoor.IndoorNO + "::Indoor_NoChange"); // 解决纯新风机 选型更改温度,选型报错 on 20180903 by xyj
                    continue;
                }
                if (roomIndoor.IsAuto == true)
                {
                    //重新选型并计算估算容量
                    string region          = roomIndoor.IndoorItem.RegionCode;
                    string unitType        = roomIndoor.IndoorItem.Type;
                    string productType     = roomIndoor.IndoorItem.ProductType;
                    double CoolCapacity    = roomIndoor.RqCoolingCapacity;
                    double CoolSensible    = roomIndoor.RqSensibleHeat;
                    double CoolAirFlow     = roomIndoor.RqAirflow;
                    double HeatCapacity    = roomIndoor.RqHeatingCapacity;
                    double FreshAir        = roomIndoor.RqFreshAir;
                    double indoorCoolingWB = roomIndoor.WBCooling;
                    double indoorHeatingDB = roomIndoor.DBHeating;
                    string Series          = roomIndoor.IndoorItem.Series;

                    if (!string.IsNullOrEmpty(roomIndoor.RoomID))
                    {
                        CoolCapacity = 0;
                        CoolSensible = 0;
                        CoolAirFlow  = 0;
                        HeatCapacity = 0;
                        FreshAir     = 0;
                        for (int j = 0; j < floorlist.Count; j++)
                        {
                            var roomlist = floorlist[j].RoomList;
                            var room     = roomlist.Find(p => p.Id == roomIndoor.RoomID);
                            if (room != null)
                            {
                                CoolCapacity = room.RqCapacityCool;
                                HeatCapacity = room.RqCapacityHeat;
                                CoolAirFlow  = room.AirFlow;
                                CoolSensible = room.SensibleHeat;
                                FreshAir     = room.FreshAir;
                                break;
                            }
                        }
                    }

                    rq_cool      = CoolCapacity;
                    rq_airflow   = CoolAirFlow;
                    rq_heat      = HeatCapacity;
                    rq_sensiable = CoolSensible;
                    rq_fa        = FreshAir;
                    RegCode      = region;
                    rq_wb_c      = indoorCoolingWB;
                    rq_db_h      = indoorHeatingDB;
                    rq_wb_h      = outWBHeat;
                    rq_db_c      = outDBCool;
                    _productType = roomIndoor.IndoorItem.ProductType;
                    _series      = roomIndoor.IndoorItem.Series;
                    //_shf_mode = roomIndoor.SHF_Mode;
                    _fanSpeedLevel = roomIndoor.FanSpeedLevel;
                    _unitType      = roomIndoor.IndoorItem.Type;
                    //var redata = CommonOperation.GetIndoorOrOutdoorList(dic);
                    //需要将type进行处理,获取厂名 20161118 by Yunxiao Lin
                    string type        = roomIndoor.IndoorItem.Type;
                    int    m           = type.IndexOf("-");
                    string factoryName = "";
                    if (m > 0)
                    {
                        if (thisProject.RegionCode != "EU_W" && thisProject.RegionCode != "EU_S" && thisProject.RegionCode != "EU_E")//EU区域的 暂时不取厂名 20180302 by xyj
                        {
                            factoryName = type.Substring(m + 1, type.Length - m - 1);
                            type        = type.Substring(0, m);
                        }
                    }
                    DataTable dtIndoorList = bll.GetIndoorListStd(type, roomIndoor.IndoorItem.ProductType, factoryName);
                    dtIndoorList.DefaultView.Sort = "CoolCapacity";
                    //List<IndoorTable> listIndoor = Common.Constant.JSON2Object<List<IndoorTable>>(redata["Data"]);
                    if (dtIndoorList.Rows.Count == 0)
                    {
                        stateList.Add(roomIndoor.IndoorNO + "::IND_NOTMATCH");
                        continue;
                    }
                    DataRow drMax = dtIndoorList.Rows[dtIndoorList.Rows.Count - 1];
                    if (IsCoolingMode && Convert.ToDecimal(drMax["CoolCapacity"]) < Convert.ToDecimal(CoolCapacity))
                    {
                        stateList.Add(roomIndoor.IndoorNO + "::IND_NOTMATCH");
                        continue;
                    }
                    if (IsHeatingMode && !roomIndoor.IndoorItem.ProductType.Contains(", CO") && Convert.ToDecimal(drMax["HeatCapacity"]) < Convert.ToDecimal(HeatCapacity))
                    {
                        stateList.Add(roomIndoor.IndoorNO + "::IND_NOTMATCH");
                        continue;
                    }
                    RoomIndoor newRoomIndoor = null;
                    for (int j = 0; j < dtIndoorList.Rows.Count; j++)
                    {
                        bool    isPass = true;
                        DataRow dr     = dtIndoorList.Rows[j];
                        if (IsCoolingMode && Convert.ToDecimal(dr["CoolCapacity"]) < Convert.ToDecimal(CoolCapacity) || Convert.ToDecimal(dr["SensibleHeat"]) < Convert.ToDecimal(CoolSensible) || Convert.ToDecimal(dr["AirFlow"]) < Convert.ToDecimal(CoolAirFlow))
                        {
                            isPass = false;
                        }

                        if (IsHeatingMode & !roomIndoor.IndoorItem.ProductType.Contains(", CO") && Convert.ToDecimal(dr["HeatCapacity"]) < Convert.ToDecimal(HeatCapacity))
                        {
                            isPass = false;
                        }
                        //ent.indoor = listIndoor[j];

                        if (!isPass || !autoCompare(_unitType, dr))
                        {
                            continue;
                        }

                        if (dr["ModelFull"].ToString() == roomIndoor.IndoorItem.ModelFull)
                        {
                            newRoomIndoor = roomIndoor;
                            stateList.Add(roomIndoor.IndoorNO + "::Indoor_NoChange");
                        }
                        else
                        {
                            //室内机型号变更,去除所有共享绑定关系 add by axj 20180503
                            bool isBinding = false;
                            thisProject.RoomIndoorList.ForEach((ind) =>
                            {
                                if (ind.IndoorNO != roomIndoor.IndoorNO)
                                {
                                    var grp = ind.IndoorItemGroup;
                                    if (grp != null)
                                    {
                                        var item = grp.Find((p) => p.IndoorNO == roomIndoor.IndoorNO);
                                        if (item != null)
                                        {
                                            isBinding = true;
                                            grp.Remove(item);
                                        }
                                    }
                                }
                            });
                            newRoomIndoor = GetNewRoomIndoor(dr, roomIndoor);
                            string sUnbinding = "";
                            if (roomIndoor.IsMainIndoor)
                            {
                                sUnbinding = "Indoor_Unbinding";
                            }
                            else
                            {
                                if (isBinding)
                                {
                                    sUnbinding = "Indoor_ResetAccessories";
                                }
                            }
                            stateList.Add(roomIndoor.IndoorNO + "::Indoor_ChangeModel::" + sUnbinding);
                        }

                        newRoomIndoor.IndoorNO        = roomIndoor.IndoorNO;
                        newRoomIndoor.SystemID        = roomIndoor.SystemID;
                        newRoomIndoor.IndoorName      = roomIndoor.IndoorName;
                        newRoomIndoor.CoolingCapacity = est_cool;
                        newRoomIndoor.HeatingCapacity = est_heat;
                        newRoomIndoor.SensibleHeat    = est_sh;
                        //newRoomIndoor.AirFlow = airflow;
                        newRoomIndoor.DBCooling         = roomIndoor.DBCooling;
                        newRoomIndoor.DBHeating         = roomIndoor.DBHeating;
                        newRoomIndoor.WBCooling         = roomIndoor.WBCooling;
                        newRoomIndoor.RqCoolingCapacity = rq_cool;
                        newRoomIndoor.RqHeatingCapacity = rq_heat;
                        newRoomIndoor.RqSensibleHeat    = rq_sensiable;
                        newRoomIndoor.RqAirflow         = rq_airflow;
                        newRoomIndoor.RqFreshAir        = rq_fa;

                        if (!string.IsNullOrEmpty(roomIndoor.RoomID))
                        {
                            newRoomIndoor.RoomID = roomIndoor.RoomID;
                        }
                        newRoomindoorList.Add(newRoomIndoor);

                        break;
                    }
                    if (newRoomIndoor == null)
                    {
                        stateList.Add(roomIndoor.IndoorNO + "::IND_NOTMATCH");
                        newRoomindoorList.Add(roomIndoor);
                    }
                }
                else
                {
                    string type        = roomIndoor.IndoorItem.Type;
                    int    m           = type.IndexOf("-");
                    string factoryName = "";
                    if (m > 0)
                    {
                        if (thisProject.RegionCode != "EU_W" && thisProject.RegionCode != "EU_S" && thisProject.RegionCode != "EU_E") //EU区域的 暂时不取厂名 20180302 by xyj
                        {
                            factoryName = type.Substring(m + 1, type.Length - m - 1);
                            type        = type.Substring(0, m);
                        }
                    }
                    DataTable dtIndoorList = bll.GetIndoorListStd(type, roomIndoor.IndoorItem.ProductType, factoryName);
                    dtIndoorList.DefaultView.Sort = "CoolCapacity";
                    DataRow stdRow = null;
                    foreach (DataRow dr in dtIndoorList.Rows)
                    {
                        if (roomIndoor.IndoorItem.ModelFull == dr["ModelFull"].ToString())
                        {
                            stdRow = dr;
                            break;
                        }
                    }
                    //重新计算估算容量
                    rq_wb_c      = roomIndoor.WBCooling;
                    rq_db_h      = roomIndoor.DBHeating;
                    rq_wb_h      = outWBHeat;
                    rq_db_c      = outDBCool;
                    RegCode      = roomIndoor.IndoorItem.RegionCode;
                    _productType = roomIndoor.IndoorItem.ProductType;
                    _series      = roomIndoor.IndoorItem.Series;
                    //_shf_mode = roomIndoor.SHF_Mode;
                    _fanSpeedLevel = roomIndoor.FanSpeedLevel;
                    _unitType      = roomIndoor.IndoorItem.Type;
                    DoCalculateEstValue(stdRow);

                    if (est_cool <= 0 || est_heat <= 0)
                    {
                        bool isContinue = true;
                        //过滤 _productType 为,CO 类型的数据 不需要制热 on 20181016 by xyj
                        if (!string.IsNullOrEmpty(_productType))
                        {
                            if (_productType.Contains(", CO") && est_heat == 0)
                            {
                                isContinue = false;
                            }
                        }
                        if (isContinue)
                        {
                            stateList.Add(roomIndoor.IndoorNO + "::DATA_EXCEED");
                            newRoomindoorList.Add(roomIndoor);
                            continue;
                        }
                    }
                    roomIndoor.CoolingCapacity = est_cool;
                    roomIndoor.HeatingCapacity = est_heat;
                    roomIndoor.SensibleHeat    = est_sh;
                    //roomIndoor.AirFlow = airflow;
                    newRoomindoorList.Add(roomIndoor);
                    stateList.Add(roomIndoor.IndoorNO + "::Indoor_NoChange");
                }
            }
            //重新计算房间需求是否满足
            var       rmlist = newRoomindoorList.FindAll(p => !string.IsNullOrEmpty(p.RoomID));
            Hashtable htChk  = new Hashtable();

            for (int i = 0; i < rmlist.Count; i++)
            {
                string roomId = rmlist[i].RoomID;
                if (htChk[roomId] != null)
                {
                    continue;
                }
                else
                {
                    htChk[roomId] = "";
                }
                bool isFreshAir = rmlist[i].IsFreshAirArea;
                var  tplist     = newRoomindoorList.FindAll(p => p.RoomID == roomId);
                Room curRoom    = null;
                //获取房间容量需求
                for (int j = 0; j < floorlist.Count; j++)
                {
                    var roomlist = floorlist[j].RoomList;
                    var room     = roomlist.Find(p => p.Id == roomId);
                    if (room != null)
                    {
                        curRoom = room;
                        break;
                    }
                }
                if (tplist.Count > 0)
                {
                    double total_cool_Capacity = 0;
                    double total_heat_Capacity = 0;
                    double total_sensible_Heat = 0;
                    double total_air_Flow      = 0;
                    double total_fresh_Air     = 0;
                    DoCalculateSelectedSumCapacity(tplist, isFreshAir, ref total_cool_Capacity, ref total_heat_Capacity, ref total_sensible_Heat, ref total_air_Flow, ref total_fresh_Air);
                    if (curRoom != null)
                    {
                        if (!isFreshAir)
                        {
                            if (IsCoolingMode)
                            {
                                if (total_cool_Capacity < curRoom.RqCapacityCool || total_sensible_Heat < curRoom.SensibleHeat || total_air_Flow < curRoom.AirFlow)
                                {
                                    if (total_cool_Capacity <= curRoom.RqCapacityCool)
                                    {
                                        foreach (var ent in tplist)
                                        {
                                            stateList.Add(ent.IndoorNO + "::IND_NOTMEET_COOLING");
                                        }
                                    }
                                }
                            }
                            if (IsHeatingMode && !_productType.Contains(", CO"))//tplist[0].IndoorItem.ProductType.Contains(", CO")
                            {
                                if (total_heat_Capacity < curRoom.RqCapacityHeat)
                                {
                                    if (total_heat_Capacity <= curRoom.RqCapacityHeat)
                                    {
                                        foreach (var ent in tplist)
                                        {
                                            stateList.Add(ent.IndoorNO + "::IND_NOTMEET_HEATING");
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (total_fresh_Air < curRoom.FreshAir)
                            {
                                foreach (var ent in tplist)
                                {
                                    stateList.Add(ent.IndoorNO + "::IND_NOTMEET_FA");
                                }
                            }
                        }
                    }
                }
            }
            return(newRoomindoorList);
        }
Example #21
0
        public IDUEquipmentPropertiesViewModel(JCHVRF.Model.Project projectLegacy, RoomIndoor roomIndoor)
        {
            try
            {
                this.ProjectLegacy = projectLegacy;
                pbll = new ProjectBLL(this.ProjectLegacy);

                this.indoorBLL = new IndoorBLL(ProjectLegacy.SubRegionCode, ProjectLegacy.RegionCode, ProjectLegacy.BrandCode);
                // Bind Equipment Pre Selected Data To View Model
                if (roomIndoor != null)
                {
                    this.EquipmentName = roomIndoor.IndoorName;
                    this.SelectedFloor = roomIndoor.RoomName;
                }
                // End Bind Equipment Pre Selected Data To View Model
                GetFloorList();


                BindFanSpeed();
                BindToControl();


                // Bind Equipment Pre Selected Data To View Model
                //if (this.SelectedFanSpeed != null)
                //{
                if (roomIndoor != null)
                {
                    this.SelectedFanSpeed = roomIndoor.FanSpeedLevel;
                    if (ProjectBLL.IsSupportedUniversalSelection(JCHVRF.Model.Project.GetProjectInstance))
                    {
                        GetTypeLookUpData(roomIndoor.DisplayImageName);
                    }
                    else
                    {
                        GetTypeLookUpDataRegionWise(roomIndoor.DisplayImageName);
                    }
                }// roomIndoor.FanSpeedLevel == 1 ? "Max" : roomIndoor.FanSpeedLevel == 0 ? "High2" : roomIndoor.FanSpeedLevel == 1 ? "High" : roomIndoor.FanSpeedLevel == 2 ? "Medium" : roomIndoor.FanSpeedLevel == 3 ? "Low" : "";
                 // }
                 // End Bind Equipment Pre Selected Data To View Model



                // Bind Equipment Pre Selected Data To View Model
                if (roomIndoor != null)
                {
                    if (roomIndoor.IndoorItem.DisplayName != null)
                    {
                        this.SelectedType = roomIndoor.IndoorItem.DisplayName;
                    }
                    // End Bind Equipment Pre Selected Data To View Model
                    // GetSelectedIDUAccessories();


                    //this.AddAccessoryViewModel = new AddAccessoriesTemplateViewModel(this.ProjectLegacy, roomIndoor);
                    OnPropertyChanged(AddAccessoryViewModel.Accessories.ToString());
                }


                //SetEquipmentProperties();
                //To Select

                if (roomIndoor != null && roomIndoor.IndoorItem != null)
                {
                    // this.SelectedType = roomIndoor.IndoorItem.Type;
                }

                // Bind Equipment for Pre Selected Data
                if (roomIndoor != null)
                {
                    if (roomIndoor.IndoorItem != null && roomIndoor.IndoorItem.Model != null)
                    {
                        this.SelectedModel = roomIndoor.IndoorItem.Model;
                        //this.SelectedIndexModel = this.ListModel.FindIndex(a => a.Value == roomIndoor.IndoorItem.Model);
                    }
                    else
                    {
                        if (ListModel != null && ListModel.Count > 0)
                        {
                            this.SelectedModel = ListModel.FirstOrDefault().Value;
                        }
                    }
                }

                if (roomIndoor != null && roomIndoor.IndoorItem != null && roomIndoor.IndoorItem.ListAccessory != null)
                {
                    var itemIndex = this.ProjectLegacy.RoomIndoorList.FindIndex(x => x.IndoorNO == roomIndoor.IndoorNO);
                    var item      = this.ProjectLegacy.RoomIndoorList.ElementAt(itemIndex);
                    this.ProjectLegacy.RoomIndoorList.RemoveAt(itemIndex);
                    item.ListAccessory = roomIndoor.IndoorItem.ListAccessory;
                    this.ProjectLegacy.RoomIndoorList.Insert(itemIndex, item);
                }
                // this.SelectedFanSpeed = 0;
                // End Bind Equipment Pre Selected Data To View Model
            }
            catch (Exception ex)
            {
                int?id = JCHVRF.Model.Project.GetProjectInstance?.projectID;
                Logger.LogProjectError(id, ex);
            }
        }
Example #22
0
        /// 绑定系统信息表   --add on 20170610 by Lingjia Qiu
        /// <summary>
        /// 绑定系统信息表
        /// </summary>
        /// <param name="riItem"></param>
        private void BindSysTableInfo(RoomIndoor r)
        {
            if (thisProject.SystemList.Count == 0)
            {
                return;
            }

            dgvSystemInfo.Rows.Clear();  //清空数据
            ProjectBLL bll = new ProjectBLL(thisProject);

            foreach (SystemVRF sysItem in thisProject.SystemList)
            {
                if (sysItem.OutdoorItem == null)
                {
                    this.dgvSystemInfo.Visible = false;
                    return;
                }
                if (sysItem.Id.Equals(r.SystemID))
                {
                    //this.jclblUnitInfo.Text = sysItem.Name + ShowText.SystemInfo;
                    double totestIndCap_h = 0;
                    double totestIndCap_c = getTotestIndCap_c(sysItem, bll, out totestIndCap_h);
                    string coolingReqd    = "";
                    if (totestIndCap_c != 0d)
                    {
                        coolingReqd = Unit.ConvertToControl(totestIndCap_c, UnitType.POWER, ut_power).ToString("n1");
                    }
                    else
                    {
                        coolingReqd = "-";
                    }

                    double sysRH = bll.CalculateRH(sysItem.DBHeating, sysItem.WBHeating, thisProject.Altitude);
                    //this.dgvSystemInfo.Rows[0].Height = 30;
                    //先添加一条系统室外机记录
                    this.dgvSystemInfo.Rows.Add(
                        "",
                        coolingReqd,                                                                                                 // cooling Req'd
                        totestIndCap_h != 0d ? Unit.ConvertToControl(totestIndCap_h, UnitType.POWER, ut_power).ToString("n1") : "-", //Heating Req'd
                        "-",                                                                                                         //Sensible Req'd
                        sysItem.Name,                                                                                                //系统名字
                        sysItem.OutdoorItem.AuxModelName,                                                                            //室外机型号
                        Unit.ConvertToControl(sysItem.CoolingCapacity, UnitType.POWER, ut_power).ToString("n1"),                     //Cooling Actual
                        Unit.ConvertToControl(sysItem.HeatingCapacity, UnitType.POWER, ut_power).ToString("n1"),                     //Heating Actual
                        "-",
                        Unit.ConvertToControl(sysItem.DBCooling, UnitType.TEMPERATURE, ut_temperature).ToString("n1"),               //CoolingDB
                        "-",                                                                                                         //CoolingWB
                        Unit.ConvertToControl(sysItem.DBHeating, UnitType.TEMPERATURE, ut_temperature).ToString("n1"),               //HeatingDB
                        Unit.ConvertToControl(sysItem.WBHeating, UnitType.TEMPERATURE, ut_temperature).ToString("n1"),               //HeatingWB
                        (sysRH * 100).ToString("n0")                                                                                 //RH
                        );


                    //添加系统室内机记录
                    List <RoomIndoor> riItemList = bll.GetSelectedIndoorBySystem(sysItem.Id);
                    int    colorIndex            = 0;
                    string RoomId       = "";
                    string SensibleHeat = "";
                    foreach (RoomIndoor riItem in riItemList)
                    {
                        double riRH = (new ProjectBLL(thisProject)).CalculateRH(riItem.DBCooling, riItem.WBCooling, thisProject.Altitude);
                        //添加不基于房间的室内机riItem.IndoorName 改为 DisplayRoom
                        string DisplayRoom       = string.IsNullOrEmpty(riItem.DisplayRoom) ? riItem.IndoorName : riItem.DisplayRoom + ":" + riItem.IndoorName;
                        string RqCoolingCapacity = riItem.RqCoolingCapacity != 0d ? Unit.ConvertToControl(riItem.RqCoolingCapacity, UnitType.POWER, ut_power).ToString("n1") : "-";
                        string RqHeatingCapacity = riItem.RqHeatingCapacity != 0d ? Unit.ConvertToControl(riItem.RqHeatingCapacity, UnitType.POWER, ut_power).ToString("n1") : "-";
                        string RqSensibleHeat    = riItem.RqSensibleHeat != 0d ? Unit.ConvertToControl(riItem.RqSensibleHeat, UnitType.POWER, ut_power).ToString("n1") : "-";
                        string RoomName          = "-";
                        if (!string.IsNullOrEmpty(riItem.RoomName) && !string.IsNullOrEmpty(riItem.RoomID))
                        {
                            if (RoomId != riItem.RoomID)
                            {
                                RoomName = riItem.RoomName;
                                Room ri = bll.GetRoom(riItem.RoomID);
                                RqCoolingCapacity = ri.RqCapacityCool != 0d ? Unit.ConvertToControl(ri.RqCapacityCool, UnitType.POWER, ut_power).ToString("n1") : " ";
                                RqHeatingCapacity = ri.RqCapacityHeat != 0d ? Unit.ConvertToControl(ri.RqCapacityHeat, UnitType.POWER, ut_power).ToString("n1") : " ";
                                RqSensibleHeat    = ri.SensibleHeat != 0d ? Unit.ConvertToControl(ri.SensibleHeat, UnitType.POWER, ut_power).ToString("n1") : "-";
                                RoomId            = riItem.RoomID;
                                SensibleHeat      = RqSensibleHeat;
                            }
                            else
                            {
                                RoomName          = "";
                                RqCoolingCapacity = "";
                                RqHeatingCapacity = "";
                                RqSensibleHeat    = "";
                                //if (!string.IsNullOrEmpty(SensibleHeat) && SensibleHeat == "-")
                                //    RqSensibleHeat = "-";
                            }
                        }

                        this.dgvSystemInfo.Rows.Add(
                            RoomName,
                            //riItem.IsAuto ? Unit.ConvertToControl(riItem.RqCoolingCapacity, UnitType.POWER, ut_power).ToString("n1") + ut_power : "-",   // cooling Req'd
                            RqCoolingCapacity,                       // cooling Req'd
                            RqHeatingCapacity,                       //Heating Req'd
                            RqSensibleHeat,
                            //riItem.IsAuto ? Unit.ConvertToControl(riItem.RqSensibleHeat, UnitType.POWER, ut_power).ToString("n1") + ut_power : "-",   //Sensible Req'd
                            riItem.IndoorName,                                                                                                           //室内机名字
                            thisProject.BrandCode == "Y" ? riItem.IndoorItem.Model_York : riItem.IndoorItem.Model_Hitachi,                               //室内机型号
                            Unit.ConvertToControl(riItem.ActualCoolingCapacity, UnitType.POWER, ut_power).ToString("n1"),                                //Cooling Actual
                            //riItem.IsAuto ?Unit.ConvertToControl(riItem.RqHeatingCapacity, UnitType.POWER, ut_power).ToString("n1") + ut_power : "-",   //Heating Req'd
                            Unit.ConvertToControl(riItem.ActualHeatingCapacity, UnitType.POWER, ut_power).ToString("n1"),                                //Heating Actual
                            Unit.ConvertToControl(riItem.ActualSensibleHeat, UnitType.POWER, ut_power).ToString("n1"),                                   //Sensible Actual
                            Unit.ConvertToControl(riItem.DBCooling, UnitType.TEMPERATURE, ut_temperature).ToString("n1"),                                //CoolingDB
                            Unit.ConvertToControl(riItem.WBCooling, UnitType.TEMPERATURE, ut_temperature).ToString("n1"),                                //CoolingWB
                            Unit.ConvertToControl(riItem.DBHeating, UnitType.TEMPERATURE, ut_temperature).ToString("n1"),                                //HeatingDB
                            riItem.WBHeating != 0d ? Unit.ConvertToControl(riItem.WBHeating, UnitType.TEMPERATURE, ut_temperature).ToString("n1") : "-", //HeatingWB
                            (riRH * 100).ToString("n0")                                                                                                  //RH
                            );
                        colorIndex++;
                        string wType;
                        if (!CommonBLL.MeetRoomRequired(riItem, thisProject, 0, thisProject.RoomIndoorList, out wType))
                        {
                            dgvSystemInfo.Rows[colorIndex].Cells[1].Style.ForeColor = Color.Chocolate;
                            switch (wType)
                            {
                            case "reqCool":
                                dgvSystemInfo.Rows[colorIndex].Cells[4].Style.ForeColor = Color.Chocolate;
                                dgvSystemInfo.Rows[colorIndex].Cells[5].Style.ForeColor = Color.Chocolate;
                                break;

                            case "reqHeat":
                                dgvSystemInfo.Rows[colorIndex].Cells[10].Style.ForeColor = Color.Chocolate;
                                dgvSystemInfo.Rows[colorIndex].Cells[11].Style.ForeColor = Color.Chocolate;
                                break;

                            case "sensible":
                                dgvSystemInfo.Rows[colorIndex].Cells[6].Style.ForeColor = Color.Chocolate;
                                dgvSystemInfo.Rows[colorIndex].Cells[7].Style.ForeColor = Color.Chocolate;
                                break;
                            }
                        }
                    }

                    break;
                }
            }
            dgvSystemInfo.ClearSelection();   //取消默认选中
            this.dgvSystemInfo.Visible = true;
        }
Example #23
0
        private void btnControlOK_Click(object sender, EventArgs e)
        {
            if (!JCValidateSingle(jctxtIndoorDifference))
            {
                JCMsg.ShowWarningOK(Msg.WARNING_PAYATTENTION);
                return;
            }
            RoomIndoor emptyIndoor = new RoomIndoor();

            if (this.jccmbPosition.SelectedIndex == 0)
            {
                emptyIndoor.PositionType = PipingPositionType.Upper.ToString();
            }
            else if (this.jccmbPosition.SelectedIndex == 1)
            {
                emptyIndoor.PositionType = PipingPositionType.SameLevel.ToString();
            }
            else
            {
                emptyIndoor.PositionType = PipingPositionType.Lower.ToString();
            }
            emptyIndoor.HeightDiff = Unit.ConvertToSource(Convert.ToDouble(this.jctxtIndoorDifference.Text == "" ? "0" : this.jctxtIndoorDifference.Text), UnitType.LENGTH_M, ut_length);

            if (emptyIndoor.PositionType != PipingPositionType.SameLevel.ToString())
            {
                if (emptyIndoor.HeightDiff <= 0)
                {
                    JCMsg.ShowErrorOK(Msg.GetResourceString("INDOOR_HIGHERDIFFERENCE_LENGTH"));
                    return;
                }
            }
            //判断当前室外机高度差
            if (emptyIndoor.PositionType == PipingPositionType.Upper.ToString() && emptyIndoor.HeightDiff > sysItemSource.MaxOutdoorAboveHeight)
            {
                double len = Unit.ConvertToControl(sysItemSource.MaxOutdoorAboveHeight, UnitType.LENGTH_M, ut_length);
                JCMsg.ShowErrorOK(Msg.Piping_HeightDiffH(len.ToString("n0") + ut_length));
                return;
            }
            if (emptyIndoor.PositionType == PipingPositionType.Lower.ToString() && emptyIndoor.HeightDiff > sysItemSource.MaxOutdoorBelowHeight)
            {
                double len = Unit.ConvertToControl(sysItemSource.MaxOutdoorBelowHeight, UnitType.LENGTH_M, ut_length);
                JCMsg.ShowErrorOK(Msg.Piping_HeightDiffH(len.ToString("n0") + ut_length));
                return;
            }
            foreach (SelectedIDUList ind in SelIDUList)
            {
                int    IDU_ID     = ind.IndoorNo;
                double HeightDiff = emptyIndoor.HeightDiff;
                if (ind.IndoorTag is MyNodeCH)
                {
                    MyNodeCH nodech = ind.IndoorTag as MyNodeCH;
                    if (emptyIndoor.PositionType == PipingPositionType.Lower.ToString())
                    {
                        HeightDiff = -HeightDiff;
                    }
                    nodech.HeightDiff = HeightDiff;
                }
                else if (ind.IndoorTag is MyNodeMultiCH)
                {
                    MyNodeMultiCH nodech = ind.IndoorTag as MyNodeMultiCH;
                    if (emptyIndoor.PositionType == PipingPositionType.Lower.ToString())
                    {
                        HeightDiff = -HeightDiff;
                    }
                    nodech.HeightDiff = HeightDiff;
                }
                else if (ind.IndoorTag is MyNodeIn)
                {
                    MyNodeIn node = ind.IndoorTag as MyNodeIn;
                    node.RoomIndooItem.PositionType = emptyIndoor.PositionType.ToString();
                    node.RoomIndooItem.HeightDiff   = HeightDiff;
                    //RoomIndoor ri = listRISelected.Find(p => p.IndoorNO == IDU_ID);
                    // UpdateHeightDiff(ri, emptyIndoor);
                    //RoomIndoor inds = thisProject.RoomIndoorList.Find(p => p.IndoorNO == IDU_ID);
                    //UpdateHeightDiff(inds, emptyIndoor);
                }
            }
            RefreshPanel();
            BindHighDifference();
            //验证当前输入的高度差 是否大于系统
            VerificationHighDiff();
        }
Example #24
0
        /// <summary>
        /// 重新选型事件
        /// </summary>
        private void DoMatchIndoor()
        {
            List <string> stateList = new List <string>();
            MatchIndoor   MatInd    = new MatchIndoor();

            try
            {
                ReselectedIndoorList = MatInd.DoRoomIndoorReselection(roomIndoorList, thisProject, outDBCool, outWBHeat, out stateList);
            }
            catch (Exception ex)
            {
                DoEvent BtnEnableFun1 = delegate()
                {
                    jclblError.Text    = ex.Message;
                    jclblError.Visible = true;
                    jcbtnClose.Enabled = true;
                };
                this.BeginInvoke(BtnEnableFun1);
                return;
            }
            //选型结果呈现,由主线程委托执行
            DoEvent BtnEnableFun = null;

            BtnEnableFun += delegate()
            {
                dtResult.Rows.Clear();
                foreach (string stateMsg in stateList)
                {
                    string[] arr      = stateMsg.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries);
                    string   indoorNo = arr[0];
                    var      ent      = ReselectionResultList.Find(p => p.IndoorNo == indoorNo);
                    switch (arr[1])
                    {
                    case "Indoor_NoChange":
                        ent.Seccessful = true;
                        ent.Message    = Msg.MatchIndoor_OK;
                        break;

                    case "Indoor_ChangeModel":
                        ent.Seccessful = true;
                        RoomIndoor newRI = ReselectedIndoorList.Find(p => p.IndoorNO.ToString() == indoorNo);
                        string     msg   = "";
                        if (newRI != null)
                        {
                            msg = "=>" + newRI.IndoorFullName;
                        }
                        if (arr.Length > 2)
                        {
                            switch (arr[2])
                            {
                            case "Indoor_Unbinding":
                                msg += "; " + Msg.Indoor_Unbinding;
                                break;

                            case "Indoor_ResetAccessories":
                                msg += "; " + Msg.Indoor_ResetAccessories;
                                break;
                            }
                        }
                        ent.Message = msg;
                        break;

                    default:
                        if (ent.Seccessful)
                        {
                            ent.Message    = "";
                            ent.Seccessful = false;
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(ent.Message))
                            {
                                ent.Message += ";";
                            }
                        }
                        switch (arr[1])
                        {
                        case "IND_NOTMATCH":
                            ent.Message += Msg.IND_NOTMATCH;
                            break;

                        case "DATA_EXCEED":
                            ent.Message += Msg.WARNING_DATA_EXCEED;
                            break;

                        case "IND_NOTMEET_COOLING":
                            ent.Message += Msg.IND_NOTMEET_COOLING;
                            break;

                        case "IND_NOTMEET_HEATING":
                            ent.Message += Msg.IND_NOTMEET_HEATING;
                            break;

                        case "IND_NOTMEET_FA":
                            ent.Message += Msg.IND_NOTMEET_FA;
                            break;
                        }
                        break;
                    }
                }

                foreach (var ent in ReselectionResultList)
                {
                    dtResult.Rows.Add(new object[] { ent.Name, ent.Message });
                }
                jcbtnClose.Enabled = true;
                jcbtnOK.Enabled    = true;
            };
            this.BeginInvoke(BtnEnableFun);
        }
Example #25
0
        public static string GetAccessoryDisplayTypeReport(string SubRegionCode, string BrandCode, Accessory item, RoomIndoor ri)
        {
            string result = item.Type;

            if (item == null || ri == null)
            {
                return(result);
            }
            DataTable dtUniversal = new AccessoryBLL().GetUniversal_ByAccessory(SubRegionCode, BrandCode);

            if (dtUniversal == null || dtUniversal.Rows.Count == 0)
            {
                return(result);
            }

            return(GetAccessoryDisplayTypeByModel(SubRegionCode, dtUniversal, item.Type, item.Model_Hitachi, ri, false));
        }
        ////ToDo: Used to Initialize Hvacsystem in a better way
        //internal void UpdateHvacSystem(SystemBase newSystem)
        //{
        //    CurrentSystem = newSystem;
        //}

        private void OnSelectedItemChanged(Item selectedItem)
        {
            try
            {
                GetCurrentVRFSystem();
                // TODO: handle in case of manual piping
                //if (currentSystemVRF != null && selectedItem!=null && !(selectedItem is NextGenModel.MyLink) && !(selectedItem is NextGenModel.MyNodeCH))
                //{
                //    //currentSystemVRF.IsManualPiping = true;
                //}
                //Start bug 2959
                //var views = regionManager.Regions["MasterDesignerRightTopArea"].Views.OfType<UIElement>().ToList();
                //views[1].Visibility = Visibility.Visible;
                //End bug 2959
                JCHNode item = selectedItem as JCHNode;
                if (item == null)
                {
                    return;
                }

                if (!item.IsSelected)
                {
                    regionManager.RequestNavigate(RegionNames.MasterDesignerPropertiesRegion, ViewKeys.CanvasProperties);
                    return;
                }
                NavigationParameters param = new NavigationParameters();
                if (item is MyNodeCHBase)
                {
                    int itemIndex = selectedItem.AddFlow.Items.IndexOf(selectedItem);
                    param.Add("AddFlow", item.AddFlow);
                    param.Add("Index", itemIndex);
                    regionManager.RequestNavigate(RegionNames.MasterDesignerPropertiesRegion, ViewKeys.CHBoxProperties, param);
                }
                else if (item.ImageData != null)
                {
                    ImageData data = item.ImageData;

                    if (item is MyNodeCHBase)
                    {
                        int itemIndex = selectedItem.AddFlow.Items.IndexOf(selectedItem.AddFlow.Items.OfType <JCHNode>().FirstOrDefault(a => a.ImageData.NodeNo == item.ImageData.NodeNo));
                        param.Add("AddFlow", item.AddFlow);
                        param.Add("Index", itemIndex);
                        regionManager.RequestNavigate(RegionNames.MasterDesignerPropertiesRegion, ViewKeys.CHBoxProperties, param);
                    }
                    else
                    {
                        switch (data.equipmentType)
                        {
                        case "Indoor":
                            if (CurrentSystem != null)
                            {
                                RoomIndoor roomIndoor = JCHVRF.Model.Project.CurrentProject.RoomIndoorList.FirstOrDefault(mm => mm.SystemID.Equals(CurrentSystem.Id) && mm.IndoorNO == data.NodeNo);
                                param.Add("IndoorItem", roomIndoor);
                                param.Add("CurrentSystem", CurrentSystem);
                                regionManager.RequestNavigate(RegionNames.MasterDesignerPropertiesRegion, ViewKeys.IDUProperties, param);
                            }
                            break;

                        case "Outdoor":
                            var tempSystem = JCHVRF.Model.Project.CurrentProject.SystemListNextGen.FirstOrDefault(sys => sys.Id == CurrentSystem.Id);
                            if (tempSystem != null)
                            {
                                param.Add("OduImageData", data);
                                param.Add("CurrentSystem", tempSystem);
                                regionManager.RequestNavigate(RegionNames.MasterDesignerPropertiesRegion, ViewKeys.ODUProperties, param);
                            }
                            break;

                        case "Pipe":
                            int itemIndex = selectedItem.AddFlow.Items.IndexOf(selectedItem.AddFlow.Items.OfType <JCHNode>().FirstOrDefault(a => a.ImageData.NodeNo == item.ImageData.NodeNo));
                            param.Add("AddFlow", item.AddFlow);
                            param.Add("Index", itemIndex);
                            regionManager.RequestNavigate(RegionNames.MasterDesignerPropertiesRegion, ViewKeys.CHBoxProperties, param);
                            break;

                        case "HeatExchanger":
                            RoomIndoor roomHeatExchanger = JCHVRF.Model.Project.CurrentProject.ExchangerList.FirstOrDefault(mm => mm.SystemID.Equals(CurrentSystem.Id));
                            param.Add("IndoorItem", roomHeatExchanger);
                            regionManager.RequestNavigate(RegionNames.MasterDesignerPropertiesRegion, "HeatExchangerCanvasProperties", param);     //sss
                            break;

                        //Start bug 2959
                        //case "HeaderBranch":
                        //    views[1].Visibility = Visibility.Collapsed;
                        //    break;
                        //End bug 2959
                        default:
                            regionManager.RequestNavigate(RegionNames.MasterDesignerPropertiesRegion, ViewKeys.CanvasProperties);
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                int?id = Project.GetProjectInstance?.projectID;
                Logger.LogProjectError(id, ex);
            }
        }