/// 检查控制器和室外机系统的ProductType是否匹配 /// <summary> /// 检查控制器和室外机系统的ProductType是否匹配 /// </summary> /// <returns></returns> private bool CheckSystemAndExchanger(DataTable exchanger, string controllerProductType) { // DataTable dt = ucDropOutdoor1.GetOutdoorAndExchanger(); if (exchanger != null && exchanger.Rows.Count > 0) { int systemCount = 0; int exchangerCount = 0; DataRow dr = exchanger.Rows[0]; systemCount = Convert.ToInt32(dr[0].ToString()); exchangerCount = Convert.ToInt32(dr[1].ToString()); if (systemCount == 0 && exchangerCount > 0) { if (!controllerProductType.Contains("Heat Exchanger")) { JCMsg.ShowWarningOK(Msg.CONTROLLER_PRODUCTTYPE_NOT_MATCH); return(false); } } else if (systemCount > 0 && exchangerCount == 0) { if (controllerProductType.Contains("Heat Exchanger")) { JCMsg.ShowWarningOK(Msg.CONTROLLER_PRODUCTTYPE_NOT_MATCH); return(false); } } } return(true); }
/// <summary> /// 增加新城市 /// </summary> private bool DoAddCity() { frmLoadIndexAddCity f = new frmLoadIndexAddCity(); if (f.ShowDialog() == DialogResult.OK) { string city = f.CityName; int ret = bll.AddCity(city, out errMsg); if (ret == 1) { this.jccmbLocation.Text = city; JCMsg.ShowInfoOK(JCMsg.INFO_SUCCESS); return(true); } else if (ret == 0) { JCMsg.ShowWarningOK(errMsg); } else { JCMsg.ShowErrorOK(errMsg); } } return(false); }
/// 检查控制器和室外机系统的ProductType是否匹配 /// <summary> /// 检查控制器和室外机系统的ProductType是否匹配 /// </summary> /// <returns></returns> private bool CheckProductType(List <string> outdoorProductTypes, string controllerProductType) { if (outdoorProductTypes.Count > 0 && !outdoorProductTypes.Contains(controllerProductType)) { JCMsg.ShowWarningOK(Msg.CONTROLLER_PRODUCTTYPE_NOT_MATCH); return(false); } return(true); }
/// <summary> /// 检测当前 Load Index 选中项目是否不为空 /// </summary> /// <returns></returns> private bool CheckIndexSelect() { if (this.dgvLoadIndex.SelectedRows.Count == 0) { JCMsg.ShowWarningOK(JCMsg.WARN_SELECTONE); return(false); } return(true); }
/// <summary> /// 检测指定选项内容是否不为空 /// </summary> /// <returns></returns> private bool CheckCitySelect() { if (string.IsNullOrEmpty(this.jccmbLocation.Text)) { JCMsg.ShowWarningOK(JCMsg.WARN_SELECTONE); return(false); } return(true); }
public void CheckAccessryCount() { if (MaxNumber < _count && MaxNumber != 0) { JCMsg.ShowWarningOK("Count can not be greater then maxnumber "); _count = MaxNumber; } else if (_count < 0) { JCMsg.ShowWarningOK("Count can not be below zero!"); _count = 0; } else if (accType.ContainsKey(Type)) { if ((!flag && Type == "Wireless Remote Control Switch") || (!flag && Type == "Receiver Kit for Wireless Control") || (Type == "Wireless Remote Control Switch" && Count == 0 && flag) || (Type == "Receiver Kit for Wireless Control" && Count == 0 && flag)) { accType["Wireless Remote Control Switch"] = Count; accType["Receiver Kit for Wireless Control"] = Count; if (Count == 0) { flag = false; } else { flag = true; } } else { accType[Type] = Count; //flag = false; } if (accType["Half-size Remote Control Switch"] + accType["Remote Control Switch"] + accType["Wireless Remote Control Switch"] + accType["Receiver Kit for Wireless Control"] > 2) { JCMsg.ShowWarningOK("Number exceeds limitation"); _count = Count - 1; if (Type == "Wireless Remote Control Switch" || Type == "Receiver Kit for Wireless Control") { accType["Wireless Remote Control Switch"] = 0; accType["Receiver Kit for Wireless Control"] = 0; flag = false; } else { accType[Type] = Count - 1; } } } }
/// <summary> /// 获取不再指定范围里的型号,如果都在范围里面则返回null /// </summary> /// <param name="type1"></param> /// <param name="type2"></param> /// <param name="number">比较的次数,1是A和B比较,2是B和A比较。</param> /// <returns></returns> private bool CheckControllerCompatible(CentralController type1, CentralController type2, int number) { if (string.IsNullOrEmpty(type1.CompatibleModel)) { if (number == 1) { //type1没有明确兼容的控制器,需要第二次比较,如果type2不兼容type1,则最后结果是不兼容 return(CheckControllerCompatible(type2, type1, 2)); } else { return(true); } } else if (type1.CompatibleModel == "none") { //2.1 - Not compatible with other central controler JCMsg.ShowWarningOK(Msg.CONTROLLER_NOT_COMPATIBLE); return(false); } else { //2.2 - is combinable List <string> compatibleModels = new List <string>(); compatibleModels.AddRange(type1.CompatibleModel.Split(',')); //兼容性逻辑应该是所有类型适用的,所以下面的判断可以去掉 20160901 by Yunxiao Lin //if (type2.Type == ControllerType.CentralController || type2.Type == ControllerType.ONOFF) //{ if (!compatibleModels.Contains(type2.BrandCode == "H" ? type2.Model_Hitachi : type2.Model_York)) { //type1不兼容type2, 有3种情况 //1. 如果是第二次比较还是不兼容的话,则肯定是不兼容 //2. 如果是第一次比较,type1不兼容typ2,而type2没有指定兼容的型号,则判断为不兼容。 if (number == 2 || string.IsNullOrEmpty(type2.CompatibleModel)) { JCMsg.ShowWarningOK(Msg.CONTROLLER_NOT_COMPATIBLE_WITH(number == 1 ? type2.Model : type1.Model)); return(false); } //3.如果第一次比较下来type1不兼容typ2, 并且type2有明确兼容的型号,则要看type2是不是兼容type1。 else { return(CheckControllerCompatible(type2, type1, 2)); } } //} } return(true); }
/// 检查控制器和exchanger系统的ProductType是否匹配 on 20170904 by xyj /// <summary> /// 检查控制器和exchanger系统的ProductType是否匹配 /// </summary> /// <returns></returns> private bool CheckExchangerIsMatch(DataTable exchanger, string controllerProductType) { if (exchanger != null && exchanger.Rows.Count > 0) { //判断当前节点里面是否包含System DataRow[] rows = null; rows = exchanger.Select("ProductType='System'"); if (rows.Length > 0) { //如果包含直接返回不需验证 return(true); } DataRow[] rowexchanger = exchanger.Select("ProductType='Exchanger'"); if (rowexchanger.Length == 1) { if (!rowexchanger[0]["ExchangerType"].ToString().Contains(controllerProductType)) { JCMsg.ShowWarningOK(Msg.CONTROLLER_PRODUCTTYPE_NOT_MATCH); return(false); } } else if (rowexchanger.Length > 1) { //判断是否存在包含Exchanger 的类型 bool isTrue = false; foreach (DataRow r in rowexchanger) { if (r["ExchangerType"].ToString().Contains(controllerProductType)) { isTrue = true; break; } } if (!isTrue) { JCMsg.ShowWarningOK(Msg.CONTROLLER_PRODUCTTYPE_NOT_MATCH); return(false); } } } return(true); }
/// <summary> /// 检查H-Link/H-Link II的限制,H-Link与H-Link II并存时,使用H-Link的限制 /// </summary> /// <param name="isHLinkII"></param> /// <param name="indoorQty"></param> /// <param name="outdoorQty"></param> /// <param name="deviceQty"></param> /// <returns></returns> private bool CheckHLinkLimiation(bool isHLinkII, int indoorQty, int outdoorQty, int deviceQty) { if (isHLinkII) { if (indoorQty > ControllerConstValue.HLINKII_MAX_IDU_QTY) { JCMsg.ShowWarningOK(Msg.CONTROLLER_HLINK_INDOOR_QTY("H-Link II", ControllerConstValue.HLINKII_MAX_IDU_QTY)); return(false); } if (outdoorQty > ControllerConstValue.HLINKII_MAX_ODU_QTY) { JCMsg.ShowWarningOK(Msg.CONTROLLER_HLINK_OUTDOOR_QTY("H-Link II", ControllerConstValue.HLINKII_MAX_ODU_QTY)); return(false); } if (deviceQty > ControllerConstValue.HLINKII_MAX_DEVICE_QTY) { JCMsg.ShowWarningOK(Msg.CONTROLLER_HLINK_DEVICE_QTY("H-Link II", ControllerConstValue.HLINKII_MAX_DEVICE_QTY)); return(false); } } else { if (indoorQty > ControllerConstValue.HLINK_MAX_IDU_QTY) { JCMsg.ShowWarningOK(Msg.CONTROLLER_HLINK_INDOOR_QTY("H-Link", ControllerConstValue.HLINKII_MAX_IDU_QTY)); return(false); } if (outdoorQty > ControllerConstValue.HLINK_MAX_ODU_QTY) { JCMsg.ShowWarningOK(Msg.CONTROLLER_HLINK_OUTDOOR_QTY("H-Link", ControllerConstValue.HLINKII_MAX_ODU_QTY)); return(false); } if (deviceQty > ControllerConstValue.HLINK_MAX_DEVICE_QTY) { // JCMsg.ShowWarningOK(Msg.CONTROLLER_HLINK_DEVICE_QTY("H-Link", Model.ConstValue.HLINKII_MAX_DEVICE_QTY));//HLINKII_MAX_DEVICE_QTY 限制200 JCMsg.ShowWarningOK(Msg.CONTROLLER_HLINK_DEVICE_QTY("H-Link", ControllerConstValue.HLINK_MAX_DEVICE_QTY));// HLINK_MAX_DEVICE_QTY 限制145 on 20180306 by xyj return(false); } } return(true); }
/// <summary> /// 检查室内机、室外机和设备总数的限制 /// </summary> /// <param name="typeInfo"></param> /// <param name="indoorQty"></param> /// <param name="outdoorQty"></param> /// <param name="deviceQty"></param> /// <returns></returns> private bool CheckSystemQtyLimitation(CentralController typeInfo, int indoorQty, int outdoorQty, int deviceQty) { //1 - 200 devices (incl. ODU, IDU, remote controller, central controller) can be connected in 1 H-Link if (typeInfo.MaxDeviceNumber > 0 && deviceQty > typeInfo.MaxDeviceNumber) { JCMsg.ShowWarningOK(Msg.CONTROLLER_TOTAL_DEVICE_QTY(typeInfo.MaxDeviceNumber)); return(false); } //2 - Indoor quantity limitation if (typeInfo.MaxIndoorUnitNumber > 0 && indoorQty > typeInfo.MaxIndoorUnitNumber) { JCMsg.ShowWarningOK(Msg.CONTROLLER_MAX_INDOOR_QTY(typeInfo.Model, typeInfo.MaxIndoorUnitNumber)); return(false); } //3 - Outdoor quantity limitation if (typeInfo.MaxSystemNumber > 0 && outdoorQty > typeInfo.MaxSystemNumber) { JCMsg.ShowWarningOK(Msg.CONTROLLER_MAX_OUTDOOR_QTY(typeInfo.Model, typeInfo.MaxSystemNumber)); return(false); } return(true); }
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(); }
private void jcbtnSetLengthOK_Click(object sender, EventArgs e) { if (!this.JCValidateForm()) { return; } //DialogResult = DialogResult.OK; bool errFlag = false; //if (this.rbtnHigher.Checked) //{ // //this.jctxtHighDifference.JCMaxValue = float.Parse(Unit.ConvertToControl(50, UnitType.LENGTH_M, ut_length).ToString("n0")); // //FSNS与FSNP机型高度能超过50,最大110m // if (sysItemCopy.SelOutdoorType.Contains("FSNS") || sysItemCopy.SelOutdoorType.Contains("FSNP") || sysItemCopy.SelOutdoorType.Contains("FSXNS") || sysItemCopy.SelOutdoorType.Contains("FSXNP") || sysItemCopy.SelOutdoorType.Contains("JTOH-BS1") || sysItemCopy.SelOutdoorType.Contains("JTOR-BS1")) // { // //高度超过50.提示信息 // if (Convert.ToDecimal(jctxtHighDifference.Text) > 50) // msgFlag = true; // else // msgFlag = false; // this.jctxtHighDifference.JCMaxValue = float.Parse(Unit.ConvertToControl(110, UnitType.LENGTH_M, ut_length).ToString("n0")); // } // else // this.jctxtHighDifference.JCMaxValue = float.Parse(Unit.ConvertToControl(50, UnitType.LENGTH_M, ut_length).ToString("n0")); //} //else //{ // this.jctxtHighDifference.JCMaxValue = float.Parse(Unit.ConvertToControl(40, UnitType.LENGTH_M, ut_length).ToString("n0")); //} //if (!JCValidateSingle(jctxtHighDifference)) // return; try { this.Cursor = Cursors.WaitCursor; BindPipeLength(); // 修改了Pipe Length之后要重新执行自动选型(注:若用户手动输入的pipe长度值则无效) //SelectOutdoorResult result = DoSelectOutdoor(out ERRList); //如果最长等效管长小于设置高度则加入错误列表 if (sysItemSource.PipeEquivalentLength < sysItemSource.HeightDiff) { double len = Unit.ConvertToControl(double.Parse(jctxtEqPipeLength.Text), UnitType.LENGTH_M, ut_length); double diff = Unit.ConvertToControl(0, UnitType.LENGTH_M, ut_length); JCMsg.ShowWarningOK(Msg.PIPING_LENGTHFACTOR(sysItemSource.Name, len.ToString("n2") + ut_length, Math.Abs(diff).ToString("n2") + ut_length)); errFlag = true; return; } //是否自动模式的判断 add by Shen Junjie on 20170619 if (sysItemSource != null && sysItemSource.IsAuto) { //室外机选型统一改用新逻辑 Global.DoSelectOutdoorODUFirst 20161112 by Yunxiao Lin //result = Global.DoSelectOutdoorODUFirst(sysItemCopy, listRISelected, thisProject, out ERRList, out MSGList); result = Global.DoSelectOutdoorODUFirst(sysItemSource, listRISelected, thisProject, out ERRList, out MSGList); if (result == SelectOutdoorResult.Null) { errFlag = true; return; } } //if (!SaveToSourceSystem()) //{ // errFlag = true; //} } catch (Exception exc) { JCMsg.ShowWarningOK(exc.Message); } finally { this.Cursor = Cursors.Default; if (!errFlag) { DialogResult = DialogResult.OK; } } }
void ucOutdoor_Warning(object sender, EventArgs e) { JCMsg.ShowWarningOK(ucDropOutdoor1.ErrMsg); }
/// <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); }