Example #1
0
        //修改,基本信息
        public int ModifyStdHullShell(StdHullShellCls StdShell)
        {
            using (HullShellContainer hs = new HullShellContainer())
            {
                StdHullShell shs = hs.StdHullShellSet.Where(s => s.PlateModel == StdShell.PlateModel).FirstOrDefault();

                shs.PlateModel            = StdShell.PlateModel;
                shs.Thickness             = StdShell.Thickness;
                shs.Width1                = StdShell.Width1;
                shs.Length1               = StdShell.Length1;
                shs.TransverseCurvate     = StdShell.TransverseCurvate;
                shs.RiblineAmount         = StdShell.RiblineCount;
                shs.LongitudinalCurvature = StdShell.LongitudinalCurvature;
                shs.CurvePlateKind        = StdShell.CurvePlateKind;
                shs.Width2                = StdShell.Width2;
                shs.Length2               = StdShell.Length2;
                shs.ShipName              = StdShell.ShipName;

                shs.BoundingBox.x_Dir = StdShell.Dir.x;
                shs.BoundingBox.y_Dir = StdShell.Dir.y;
                shs.BoundingBox.z_Dir = StdShell.Dir.z;

                shs.BoundingBox.x_Min = StdShell.Pt_Min.x;
                shs.BoundingBox.y_Min = StdShell.Pt_Min.y;
                shs.BoundingBox.z_Min = StdShell.Pt_Min.z;

                shs.BoundingBox.x_Max = StdShell.Pt_Max.x;
                shs.BoundingBox.y_Max = StdShell.Pt_Max.y;
                shs.BoundingBox.z_Max = StdShell.Pt_Max.z;

                return(hs.SaveChanges());
            }
        }
Example #2
0
        //删除
        public override bool DeleteData()
        {
            try
            {
                if (XtraMessageBox.Show("是否删除选中的数据?", "友情提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    pecls = new ProcessEquipmentCls();

                    int[] rows = gridView1.GetSelectedRows();

                    for (int i = 0; i < rows.Length; i++)
                    {
                        pecls = (ProcessEquipmentCls)gridView1.GetRow(rows[i]);
                        ProcessEquipmentDAL.DeleteProcessEquipmentById(pecls.Id);
                    }
                }

                //QueryAll();

                init_cmbBox();

                return(true);
            }
            catch (System.Exception ex)
            {
                return(false);
            }


            //return base.DeleteData();
        }
Example #3
0
        //选择记录
        public override bool SelectRecord()
        {
            try
            {
                pecls = new ProcessEquipmentCls();

                int[] rows = gridView1.GetSelectedRows();
                pecls = (ProcessEquipmentCls)gridView1.GetRow(rows[0]);

                textEquipmentName.Text = pecls.ProcessEquipmentName;
                txtDriveMode.Text      = pecls.DirverMode;
                txtPressureSize.Text   = pecls.PressureHeadLength.ToString();
                txtDownCount.Text      = pecls.DownDieHeadNumber.ToString();
                txtUpCount.Text        = pecls.UpDieHeadNumber.ToString();

                return(true);
            }
            catch (System.Exception ex)
            {
                return(false);
            }
        }
Example #4
0
        //查询
        public StdHullShellCls QueryStdHullShell(string _name)
        {
            using (HullShellContainer hs = new HullShellContainer())
            {
                StdHullShellCls shscls = new StdHullShellCls();
                StdHullShell    shs    = hs.StdHullShellSet.Where(s => s.PlateModel == _name).FirstOrDefault();

                shscls.PlateModel            = shs.PlateModel;
                shscls.Thickness             = shs.Thickness;
                shscls.Width1                = shs.Width1;
                shscls.Length1               = shs.Length1;
                shscls.TransverseCurvate     = shs.TransverseCurvate;
                shscls.RiblineCount          = shs.RiblineAmount;
                shscls.LongitudinalCurvature = shs.LongitudinalCurvature;
                shscls.CurvePlateKind        = shs.CurvePlateKind;
                shscls.Width2                = shs.Width2;
                shscls.Length2               = shs.Length2;
                shscls.ShipName              = shs.ShipName;

                List <Point> tpsList = shs.TheoryPoints.Point.ToList();
                for (int i = 0; i < tpsList.Count; i++)
                {
                    shscls.tpc.PointsCloudList.Add(new PointCls {
                        x = tpsList[i].X, y = tpsList[i].Y, z = tpsList[i].Z
                    });
                }

                List <Point> rpsList = shs.RiblinePoints.Point.ToList();
                for (int i = 0; i < rpsList.Count; i++)
                {
                    shscls.tpc.RiblinePointsList.Add(new PointCls {
                        x = tpsList[i].X, y = tpsList[i].Y, z = tpsList[i].Z
                    });
                }

                List <Point> eepList = shs.EdgeEdgePoints.Point.ToList();
                for (int i = 0; i < eepList.Count; i++)
                {
                    shscls.tpc.EdgeEdgePointsList.Add(new PointCls {
                        x = tpsList[i].X, y = tpsList[i].Y, z = tpsList[i].Z
                    });
                }

                List <Point> expList = shs.ExcessPoints.Point.ToList();
                for (int i = 0; i < expList.Count; i++)
                {
                    shscls.tpc.ExcessPointsList.Add(new PointCls {
                        x = tpsList[i].X, y = tpsList[i].Y, z = tpsList[i].Z
                    });
                }

                shscls.Dir.x = shs.BoundingBox.x_Dir;
                shscls.Dir.y = shs.BoundingBox.y_Dir;
                shscls.Dir.z = shs.BoundingBox.z_Dir;

                shscls.Pt_Min.x = shs.BoundingBox.x_Min;
                shscls.Pt_Min.y = shs.BoundingBox.y_Min;
                shscls.Pt_Min.z = shs.BoundingBox.z_Min;

                shscls.Pt_Max.x = shs.BoundingBox.y_Max;
                shscls.Pt_Max.y = shs.BoundingBox.y_Max;
                shscls.Pt_Max.z = shs.BoundingBox.z_Max;

                return(shscls);
            }
        }
Example #5
0
        //增加
        public static int AddStdHullShell(StdHullShellCls StdShell)
        {
            using (HullShellContainer hs = new HullShellContainer())
            {
                //包围盒
                BoundingBox boundbox = new BoundingBox
                {
                    x_Dir = StdShell.Dir.x,
                    y_Dir = StdShell.Dir.y,
                    z_Dir = StdShell.Dir.z,

                    x_Min = StdShell.Pt_Min.x,
                    y_Min = StdShell.Pt_Min.y,
                    z_Min = StdShell.Pt_Min.z,

                    x_Max = StdShell.Pt_Max.x,
                    y_Max = StdShell.Pt_Max.y,
                    z_Max = StdShell.Pt_Max.z,
                };


                //理论点
                TheoryPoints tps = new TheoryPoints
                {
                    RowNumber    = StdShell.tpc.RowNumberow,
                    ColumnNumber = StdShell.tpc.ColnumNumber
                };

                for (int i = 0; i < StdShell.tpc.PointsCloudList.Count; i++)
                {
                    Point pt = new Point
                    {
                        X = StdShell.tpc.PointsCloudList[i].x,
                        Y = StdShell.tpc.PointsCloudList[i].y,
                        Z = StdShell.tpc.PointsCloudList[i].z,
                    };

                    tps.Point.Add(pt);
                }


                //增加肋位线点
                RiblinePoints rps = new RiblinePoints();

                for (int i = 0; i < StdShell.tpc.RiblinePointsList.Count; i++)
                {
                    Point pt = new Point
                    {
                        X = StdShell.tpc.RiblinePointsList[i].x,
                        Y = StdShell.tpc.RiblinePointsList[i].y,
                        Z = StdShell.tpc.RiblinePointsList[i].z,
                    };

                    rps.Point.Add(pt);
                }

                //增加边缘点
                EdgeEdgePoints eeps = new EdgeEdgePoints();
                for (int i = 0; i < StdShell.tpc.EdgeEdgePointsList.Count; i++)
                {
                    Point pt = new Point
                    {
                        X = StdShell.tpc.EdgeEdgePointsList[i].x,
                        Y = StdShell.tpc.EdgeEdgePointsList[i].y,
                        Z = StdShell.tpc.EdgeEdgePointsList[i].z,
                    };

                    eeps.Point.Add(pt);
                }

                //增加余量点
                ExcessPoints expts = new ExcessPoints();
                for (int i = 0; i < StdShell.tpc.ExcessPointsList.Count; i++)
                {
                    Point pt = new Point
                    {
                        X = StdShell.tpc.ExcessPointsList[i].x,
                        Y = StdShell.tpc.ExcessPointsList[i].y,
                        Z = StdShell.tpc.ExcessPointsList[i].z,
                    };

                    expts.Point.Add(pt);
                }

                //添加
                StdHullShell shs = new StdHullShell
                {
                    PlateModel            = StdShell.PlateModel,
                    Thickness             = StdShell.Thickness,
                    Width1                = StdShell.Width1,
                    Length1               = StdShell.Length1,
                    TransverseCurvate     = StdShell.TransverseCurvate,
                    RiblineAmount         = StdShell.RiblineCount,
                    LongitudinalCurvature = StdShell.LongitudinalCurvature,
                    CurvePlateKind        = StdShell.CurvePlateKind,
                    Width2                = StdShell.Width2,
                    Length2               = StdShell.Length2,
                    ShipName              = StdShell.ShipName,

                    TheoryPoints   = tps,
                    RiblinePoints  = rps,
                    EdgeEdgePoints = eeps,
                    ExcessPoints   = expts,
                    BoundingBox    = boundbox
                };


                hs.AddToStdHullShellSet(shs);

                return(hs.SaveChanges());
            }
        }
Example #6
0
        //保存
        public override bool SaveDataA()
        {
            try
            {
                if (AddorModify == AddOrModifyEnum.Add)
                {
                    pecls = new ProcessEquipmentCls();

                    pecls.ProcessEquipmentName = this.textEquipmentName.Text.ToString();
                    pecls.DirverMode           = this.txtDriveMode.Text.ToString();
                    pecls.PressureHeadLength   = Convert.ToInt32(this.txtPressureSize.Text.ToString());
                    pecls.UpDieHeadNumber      = Convert.ToInt32(this.txtUpCount.Text.ToString());
                    pecls.DownDieHeadNumber    = Convert.ToInt32(this.txtDownCount.Text.ToString());

                    int re = ProcessEquipmentDAL.AddProcessEquipment(pecls);

                    if (re > 0)
                    {
                        ProcessEquipmentBindingSource.DataSource = pecls;
                        this.gridControl1.DataSource             = ProcessEquipmentBindingSource;

                        this.layoutControlGroup1.Enabled = false;

                        this.textEquipmentName.Text = "";
                        this.txtDriveMode.Text      = "";
                        this.txtPressureSize.Text   = "";
                        this.txtUpCount.Text        = "";
                        this.txtDownCount.Text      = "";

                        init_cmbBox();

                        MessageBox.Show("加工设备信息增加成功!");

                        return(true);
                    }
                    else
                    {
                        MessageBox.Show("加工设备增加失败!");

                        return(false);
                    }
                }
                else if (AddorModify == AddOrModifyEnum.Modify)
                {
                    pecls.ProcessEquipmentName = this.textEquipmentName.Text.ToString();
                    pecls.DirverMode           = this.txtDriveMode.Text.ToString();
                    pecls.PressureHeadLength   = Convert.ToInt32(this.txtPressureSize.Text.ToString());
                    pecls.UpDieHeadNumber      = Convert.ToInt32(this.txtUpCount.Text.ToString());
                    pecls.DownDieHeadNumber    = Convert.ToInt32(this.txtDownCount.Text.ToString());

                    ProcessEquipmentDAL.ModifyProcessEquipmentById(pecls);

                    this.layoutControlGroup1.Enabled = false;

                    init_cmbBox();


                    return(true);
                }
                else
                {
                    MessageBox.Show("加工设备添加/修改失败!");
                    return(false);
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("加工设备添加失败:{0}!", ex.Message.ToString());
                return(false);
            }
        }