예제 #1
0
        private void jcbtnSetting_Click(object sender, EventArgs e)
        {
            SelIDUList.Clear();
            RefreshPanel();
            foreach (DataGridViewRow r in this.dgvIndoorDiff.SelectedRows)
            {
                SelectedIDUList sel = new SelectedIDUList();
                sel.IndoorNo = Convert.ToInt32(r.Cells[0].Value.ToString());

                sel.IndoorTag = r.Cells[0].Tag as MyNode;
                if (!string.IsNullOrEmpty(r.Cells[3].Value.ToString()))
                {
                    sel.IndoorModel = r.Cells[3].Value.ToString();
                }
                SelIDUList.Add(sel);
            }

            if (SelIDUList.Count > 0)
            {
                //foreach (SelectedIDUList ind in SelIDUList)
                //{
                //    cklistIndoor.Items.Add(new CheckBoxItem(ind.IndoorName + " [" + ind.IndoorModel + "] ", ind.IndoorNo.ToString()), true);
                //}

                //CHbox
                if (SelIDUList[0].IndoorTag is MyNodeCH)
                {
                    MyNodeCH nodeCh = SelIDUList[0].IndoorTag as MyNodeCH;
                    if (nodeCh.HeightDiff < 0)
                    {
                        this.jccmbPosition.SelectedIndex   = 2;
                        this.jctxtIndoorDifference.Enabled = true;
                        nodeCh.HeightDiff = -nodeCh.HeightDiff;
                        this.jctxtIndoorDifference.Text = nodeCh.HeightDiff.ToString("n1");
                    }
                    else if (nodeCh.HeightDiff == 0)
                    {
                        this.jccmbPosition.SelectedIndex   = 1;
                        this.jctxtIndoorDifference.Enabled = false;
                        this.jctxtIndoorDifference.Text    = nodeCh.HeightDiff.ToString("n1");
                    }
                    else
                    {
                        this.jccmbPosition.SelectedIndex   = 0;
                        this.jctxtIndoorDifference.Enabled = true;
                        this.jctxtIndoorDifference.Text    = nodeCh.HeightDiff.ToString("n1");
                    }
                }
                //MultiCHbox
                else if (SelIDUList[0].IndoorTag is MyNodeMultiCH)
                {
                    MyNodeMultiCH nodeCh = SelIDUList[0].IndoorTag as MyNodeMultiCH;
                    if (nodeCh.HeightDiff < 0)
                    {
                        this.jccmbPosition.SelectedIndex   = 2;
                        this.jctxtIndoorDifference.Enabled = true;
                        nodeCh.HeightDiff = -nodeCh.HeightDiff;
                        this.jctxtIndoorDifference.Text = nodeCh.HeightDiff.ToString("n1");
                    }
                    else if (nodeCh.HeightDiff == 0)
                    {
                        this.jccmbPosition.SelectedIndex   = 1;
                        this.jctxtIndoorDifference.Enabled = false;
                        this.jctxtIndoorDifference.Text    = nodeCh.HeightDiff.ToString("n1");
                    }
                    else
                    {
                        this.jccmbPosition.SelectedIndex   = 0;
                        this.jctxtIndoorDifference.Enabled = true;
                        this.jctxtIndoorDifference.Text    = nodeCh.HeightDiff.ToString("n1");
                    }
                }
                //RoomIndoor
                else
                {
                    MyNodeIn nodeCh = SelIDUList[0].IndoorTag as MyNodeIn;
                    if (nodeCh.RoomIndooItem.PositionType == PipingPositionType.Lower.ToString())
                    {
                        this.jccmbPosition.SelectedIndex   = 2;
                        this.jctxtIndoorDifference.Enabled = true;
                        this.jctxtIndoorDifference.Text    = nodeCh.RoomIndooItem.HeightDiff.ToString("n1");
                    }
                    else if (nodeCh.RoomIndooItem.PositionType == PipingPositionType.SameLevel.ToString())
                    {
                        this.jccmbPosition.SelectedIndex   = 1;
                        this.jctxtIndoorDifference.Enabled = false;
                        this.jctxtIndoorDifference.Text    = nodeCh.RoomIndooItem.HeightDiff.ToString("n1");
                    }
                    else
                    {
                        this.jccmbPosition.SelectedIndex   = 0;
                        this.jctxtIndoorDifference.Enabled = true;
                        this.jctxtIndoorDifference.Text    = nodeCh.RoomIndooItem.HeightDiff.ToString("n1");
                    }
                }
            }
            panelHighDifference.Location = new Point(303, 164);
            panelHighDifference.Visible  = true;
        }
예제 #2
0
        private void BindHighDifference()
        {
            dgvIndoorDiff.Rows.Clear();
            List <MyNode> nodes = new List <MyNode>();

            pbll.GetHeightDifferenceNodes(sysItemSource.MyPipingNodeOut, null, sysItemSource, nodes);
            int i = -1;

            foreach (MyNode node in nodes)
            {
                string modelName = "";
                if (node is MyNodeCH)
                {
                    MyNodeCH nodeCH       = node as MyNodeCH;
                    string   PositionType = PipingPositionType.Upper.ToString();
                    if (!string.IsNullOrEmpty(nodeCH.Model))
                    {
                        modelName = "CHBox [" + nodeCH.Model + "]";
                    }
                    else
                    {
                        modelName = "CHBox";
                    }
                    double HeightDiff = nodeCH.HeightDiff;
                    if (HeightDiff < 0)
                    {
                        PositionType = PipingPositionType.Lower.ToString();
                        HeightDiff   = -HeightDiff;
                    }
                    else if (HeightDiff == 0)
                    {
                        PositionType = PipingPositionType.SameLevel.ToString();
                    }
                    i = dgvIndoorDiff.Rows.Add(0, true, modelName, PositionType, Unit.ConvertToControl(HeightDiff, UnitType.LENGTH_M, ut_length).ToString("n1"));
                    dgvIndoorDiff.Rows[i].Cells[0].Tag = nodeCH;
                }
                if (node is MyNodeMultiCH)
                {
                    MyNodeMultiCH nodeCH       = node as MyNodeMultiCH;
                    string        PositionType = PipingPositionType.Upper.ToString();
                    if (!string.IsNullOrEmpty(nodeCH.Model))
                    {
                        modelName = "MultiCHBox [" + nodeCH.Model + "]";
                    }
                    else
                    {
                        modelName = "MultiCHBox";
                    }
                    double HeightDiff = nodeCH.HeightDiff;
                    if (HeightDiff < 0)
                    {
                        PositionType = PipingPositionType.Lower.ToString();
                        HeightDiff   = -HeightDiff;
                    }
                    else if (HeightDiff == 0)
                    {
                        PositionType = PipingPositionType.SameLevel.ToString();
                    }
                    i = dgvIndoorDiff.Rows.Add(0, true, modelName, PositionType, Unit.ConvertToControl(HeightDiff, UnitType.LENGTH_M, ut_length).ToString("n1"));
                    dgvIndoorDiff.Rows[i].Cells[0].Tag = nodeCH;
                }
                if (node is MyNodeIn)
                {
                    MyNodeIn nodeIn = node as MyNodeIn;
                    string   Room   = "";
                    if (!string.IsNullOrEmpty((new ProjectBLL(thisProject)).GetFloorAndRoom(nodeIn.RoomIndooItem.RoomID)))
                    {
                        Room = (new ProjectBLL(thisProject)).GetFloorAndRoom(nodeIn.RoomIndooItem.RoomID) + " : ";
                    }
                    Room = Room + nodeIn.RoomIndooItem.IndoorName + " [" + (thisProject.BrandCode == "Y" ? nodeIn.RoomIndooItem.IndoorItem.Model_York : nodeIn.RoomIndooItem.IndoorItem.Model_Hitachi) + "]";
                    i    = dgvIndoorDiff.Rows.Add(nodeIn.RoomIndooItem.IndoorNO, false, Room, nodeIn.RoomIndooItem.PositionType, Unit.ConvertToControl(nodeIn.RoomIndooItem.HeightDiff, UnitType.LENGTH_M, ut_length).ToString("n1"));
                    dgvIndoorDiff.Rows[i].Cells[0].Tag = nodeIn;
                }
            }
            BindGridAlignment();
            RecalculateMaxHeightDifference(nodes);
        }
예제 #3
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();
        }