Exemplo n.º 1
0
        void PollImport(object target)
        {
            DataBaseManage db = new DataBaseManage();

            switch (OperIndex)
            {
            //导出
            case 1:
            {
                TxtData.PublicData.ErrorCode = (db.SaveProduct(FileName, CBE_RecipeName.EditValue.ToString())) ? 40 : 34;

                break;
            }

            //删除产品
            case 2:
            {
                TxtData.PublicData.ErrorCode = (db.DeleteRecipe(CBE_RecipeName.EditValue.ToString())) ? 40 : 32;
                break;
            }

            //导入
            case 3:
            {
                if (PublicFunc.SaveNCFile(Application.StartupPath + "\\Txt\\NCFile.txt", PublicFunc.ReadNCFile(FileName), TxtData.CS8CConfigure.Tool))
                {
                    FileName = Application.StartupPath + "\\Txt\\NCFile.txt";
                }


                TxtData.PublicData.ErrorCode = PublicFunc.IsTool(FileName)? 0 : 41;
                if (TxtData.PublicData.ErrorCode != 0)
                {
                    return;
                }
                TxtData.PublicData.ErrorLine = db.ImportProduct(FileName, CBE_RecipeName.EditValue.ToString());
                TxtData.PublicData.ErrorCode = (TxtData.PublicData.ErrorLine == 0) ? 40 : 20;
                // return;
                break;
            }

            //删除路径
            case 4:
            {
                //2013.11.19
                //TxtData.PublicData.ErrorCode = (db.DeleteTraj(TrajName,true)) ? 40 : 32;
                TxtData.PublicData.ErrorCode = (db.DeleteTraj(CBE_RecipeName.EditValue.ToString(), TxtData.PublicData.DeleteTrajIndex)) ? 40 : 32;
                break;
            }
            }
        }
Exemplo n.º 2
0
        void PollImport(object target)
        {
            DataBaseManage db = new DataBaseManage();
            switch (OperIndex)
            {
                //导出
                case 1:
                    {

                        TxtData.PublicData.ErrorCode = (db.SaveProduct(FileName, CBE_RecipeName.EditValue.ToString())) ? 40 : 34;

                        break;
                    }
                //删除产品
                case 2:
                    {
                        TxtData.PublicData.ErrorCode = (db.DeleteRecipe(CBE_RecipeName.EditValue.ToString())) ? 40 : 32;
                        break;
                    }
                //导入
                case 3:
                    {
                        if (PublicFunc.SaveNCFile(Application.StartupPath + "\\Txt\\NCFile.txt", PublicFunc.ReadNCFile(FileName),TxtData.CS8CConfigure.Tool))
                        {

                            FileName = Application.StartupPath + "\\Txt\\NCFile.txt";

                        }

                        TxtData.PublicData.ErrorCode = PublicFunc.IsTool(FileName)? 0 : 41;
                        if (TxtData.PublicData.ErrorCode != 0)
                        {
                            return;
                        }
                        TxtData.PublicData.ErrorLine=db.ImportProduct(FileName, CBE_RecipeName.EditValue.ToString());
                        TxtData.PublicData.ErrorCode = (TxtData.PublicData.ErrorLine== 0) ? 40 : 20;
                       // return;
                        break;
                    }
                //删除路径
                case 4:
                    {
                        //2013.11.19
                        //TxtData.PublicData.ErrorCode = (db.DeleteTraj(TrajName,true)) ? 40 : 32;
                        TxtData.PublicData.ErrorCode = (db.DeleteTraj(CBE_RecipeName.EditValue.ToString(),TxtData.PublicData.DeleteTrajIndex)) ? 40 : 32;
                        break;
                    }

            }
        }
Exemplo n.º 3
0
        void PollImport(object target)
        {
            DataBaseManage db = new DataBaseManage();

            switch (OperIndex)
            {
            //导出
            case 1:
            {
                //2015.02.05
                if (db.IsMatlabFile(CBE_RecipeName.EditValue.ToString()) == 0)
                {
                    TxtData.PublicData.ErrorCode = 34;
                    return;
                }
                PolishTxt.MatlabFile = (db.IsMatlabFile(CBE_RecipeName.EditValue.ToString()) == 2);
                //



                TxtData.PublicData.ErrorCode = (db.SaveProduct(Application.StartupPath + "\\buff.txt", CBE_RecipeName.EditValue.ToString())) ? 0 : 34;
                if (TxtData.PublicData.ErrorCode != 0)
                {
                    return;
                }
                PolishTxt.Home = db.GetHome();



                TxtData.PublicData.ErrorCode = (PolishTxt.Standard2Polish(Application.StartupPath + "\\buff.txt", FileName)) ? 40 : 49;
                break;
            }
            //删除产品

            case 2:
            {
                TxtData.PublicData.ErrorCode = (db.DeleteRecipe(CBE_RecipeName.EditValue.ToString())) ? 40 : 32;
                break;
            }
            //导入

            case 3:
            {
                //TxtData.PublicData.ErrorCode = PublicFunc.IsTool(FileName)? 0 : 41;
                //if (TxtData.PublicData.ErrorCode != 0)
                //{
                //    return;
                //}

                //PolishTxt t = new PolishTxt();
                //  PolishTxt.Home = db.GetHome();

                PolishTxt.Home = db.GetHome();
                string BuffFileName = "";
                if (PolishTxt.IsMatlabFile(FileName))
                {
                    //把matlab文件转换为一般的文件
                    //2015.02.05

                    BuffFileName = Application.StartupPath + "\\Txt\\buffRecipe.txt";
                    // PolishTxt.MatlabFile = true;

                    TxtData.PublicData.ErrorCode = PolishTxt.ReadMatlabFile(FileName, true) ? 0 : 71;
                    if (TxtData.PublicData.ErrorCode != 0)
                    {
                        return;
                    }


                    TxtData.PublicData.ErrorCode = db.GetRecipe(CBE_RecipeName.EditValue.ToString(), ref PolishTxt.MatlabTool, ref PolishTxt.MatlabFrame) ? 0 : 72;
                    if (TxtData.PublicData.ErrorCode != 0)
                    {
                        return;
                    }


                    //2015.02.05
                    //重点函数在这里
                    TxtData.PublicData.ErrorCode = PublicFunc.MatalData() ? 0 : 73;
                    if (TxtData.PublicData.ErrorCode != 0)
                    {
                        return;
                    }



                    TxtData.PublicData.ErrorCode = PolishTxt.Matlab2Recipe(BuffFileName) ? 0 : 74;
                    if (TxtData.PublicData.ErrorCode != 0)
                    {
                        return;
                    }
                }
                else
                {
                    BuffFileName = FileName;
                }



                TxtData.PublicData.ErrorCode = PolishTxt.Polish2Standard(BuffFileName, Application.StartupPath + "\\Txt\\buff.txt") ? 0 : 49;
                if (TxtData.PublicData.ErrorCode != 0)
                {
                    return;
                }
                TxtData.PublicData.ErrorLine = db.ImportProduct(Application.StartupPath + "\\Txt\\buff.txt", CBE_RecipeName.EditValue.ToString());
                TxtData.PublicData.ErrorCode = (TxtData.PublicData.ErrorLine == 0) ? 0 : 20;
                if (TxtData.PublicData.ErrorCode != 0)
                {
                    return;
                }
                TxtData.PublicData.ErrorCode = (db.EditRecipeOffline(CBE_RecipeName.EditValue.ToString(), PolishTxt.MatlabFile)) ? 40 : 20;



                // return;
                break;
            }

            //删除路径
            case 4:
            {
                //2013.11.19
                //TxtData.PublicData.ErrorCode = (db.DeleteTraj(TrajName,true)) ? 40 : 32;
                TxtData.PublicData.ErrorCode = (db.DeleteTraj(CBE_RecipeName.EditValue.ToString(), TxtData.PublicData.DeleteTrajIndex)) ? 40 : 32;
                break;
            }

            //导入速度
            case 5:
            {
                TxtData.PublicData.ErrorCode = (PolishTxt.ReadMatlabFileCount(FileName) == GV_Cut.RowCount)? 0 : 46;
                if (TxtData.PublicData.ErrorCode != 0)
                {
                    return;
                }

                double[,] da = PolishTxt.ReadMatlabFile(FileName);
                TxtData.PublicData.ErrorCode = (da != null) ? 0 : 47;
                if (TxtData.PublicData.ErrorCode != 0)
                {
                    return;
                }
                //TxtData.PublicData.ErrorLine = db.ImportProduct(FileName, CBE_RecipeName.EditValue.ToString());
                //TxtData.PublicData.ErrorCode = (TxtData.PublicData.ErrorLine == 0) ? 40 : 20;
                // return;

                TxtData.PublicData.ErrorCode = db.BatchPointSpeed(TrajName, da) ? 40 : 48;

                break;
            }


            case 6:
            {
                TxtData.PublicData.ErrorCode = (db.SaveProduct(Application.StartupPath + "\\buff.txt", CBE_RecipeName.EditValue.ToString())) ? 0 : 34;
                if (TxtData.PublicData.ErrorCode != 0)
                {
                    return;
                }

                TxtData.PublicData.ErrorCode = (PolishTxt.Part2Standard(TxtData.PolishData.PartMatlabFile, Application.StartupPath + "\\buff.txt", Application.StartupPath + "\\partbuff.txt")) ? 0 : 62;

                if (TxtData.PublicData.ErrorCode != 0)
                {
                    return;
                }

                TxtData.PublicData.ErrorCode = (db.AddRecipe(TxtData.PolishData.PartRecipeName, 1, new double[] { 0, 0, 0, 0, 0, 0 }, new double[] { 0, 0, 0, 0, 0, 0 }, TxtData.PolishData.PartRecipeRemark)) ? 0 : 63;
                if (TxtData.PublicData.ErrorCode != 0)
                {
                    return;
                }

                TxtData.PublicData.ErrorCode = (db.ImportProduct(Application.StartupPath + "\\partbuff.txt", TxtData.PolishData.PartRecipeName) == 0) ? 40 : 64;

                break;
            }
            }
        }