Exemplo n.º 1
0
 /// <summary>
 /// 对七轴参数进行修改
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BT_E1_Click(object sender, EventArgs e)
 {
     //  TxtData.CS8CConfigure.EnableItem[5] = RB_C1.Checked;
     TxtData.CS8CConfigure.Axis[0] = double.Parse(TE_S1.EditValue.ToString());
     TxtData.CS8CConfigure.Axis[1] = double.Parse(TE_S2.EditValue.ToString());
     //  TxtData.CS8CConfigure.Axis[2] =double.Parse( TE_S3.EditValue.ToString());
     if (!db.EditConfigure(TxtData.CS8CConfigure.EnableItem) || !db.EditConfigure(TxtData.CS8CConfigure.Axis, "AXIS7HOME"))
     {
         MessageBox.Show("数据库操作异常");
     }
     else
     {
         MessageBox.Show("成功");
     }
 }
Exemplo n.º 2
0
        void Poll(object target)
        {
            TxtData.MdbData.PresetData[4]  = (double)SE_Pan.Value;
            TxtData.MdbData.IODelay[3]     = (double)SE_Wait.Value;
            TxtData.MdbData.HomeSpeed      = (double)SE_Home.Value;
            TxtData.PublicData.CycleCount  = (int)SE_Cycle.Value;
            TxtData.PublicData.TriggleMode = CBE_Triggle.SelectedIndex;
            if (!db.EditProductPara(CBE_Triggle.SelectedIndex, (int)SE_Cycle.Value, TxtData.PublicData.WorkPlaceCount) ||
                !db.EditConfigure(TxtData.MdbData.PresetData, "PRESETDATA") ||
                !db.EditConfigure(TxtData.MdbData.IODelay, "IODELAY") ||
                !db.EditConfigure(TxtData.MdbData.StepLength, TxtData.MdbData.HomeSpeed))
            {
                TxtData.PublicData.ErrorCode = 37;
                return;
            }

            if (!db.SavePreset())
            {
                TxtData.PublicData.ErrorCode = 1;
                return;
            }

            if (!db.SaveAction())
            {
                TxtData.PublicData.ErrorCode = 2;
                return;
            }


            RobotKit.FtpClient ftp = new FtpClient(TxtData.XMLConfigure.IpAddress);



            double[] tool = db.GetTool();
            if (tool == null || tool.Length != 6 || TxtData.MdbData.Tool == null || TxtData.MdbData.Tool.Length != 6)
            {
                TxtData.PublicData.ErrorCode = 42;
                return;
            }
            for (int i = 0; i < 6; i++)
            {
                if (tool[i] != TxtData.MdbData.Tool[i])
                {
                    TxtData.PublicData.ErrorCode = 42;
                    return;
                }
            }
            double[] home = db.GetHome();
            if (home == null || home.Length != 6 || TxtData.MdbData.Home == null || TxtData.MdbData.Home.Length != 6)
            {
                TxtData.PublicData.ErrorCode = 44;
                return;
            }
            for (int i = 0; i < 6; i++)
            {
                if (home[i] != TxtData.MdbData.Home[i])
                {
                    TxtData.PublicData.ErrorCode = 44;
                    return;
                }
            }
            //**************************************

            if (!db.SaveCs8cConfigure())
            {
                TxtData.PublicData.ErrorCode = 3;
                return;
            }



            if (!ftp.UpLoadPreset())
            {
                TxtData.PublicData.ErrorCode = 21;
                return;
            }
            if (!ftp.UploadAction())
            {
                TxtData.PublicData.ErrorCode = 22;
                return;
            }
            if (!ftp.UploadConfigure())
            {
                TxtData.PublicData.ErrorCode = 23;
                return;
            }

            //****************************************************************************************************************
            //2013.10.31
            for (int i = 0; i < TxtData.PublicData.WorkPlaceCount; i++)
            {
                for (int j = 0; j < TxtData.PublicData.ProductCount[i]; j++)
                {
                    if (!db.SaveProduct(i + 1, TxtData.PublicData.ProductName[i][j], TxtData.PublicData.MatchPresetName[i][j], TxtData.PublicData.TrajByPass[i][j]))
                    {
                        TxtData.PublicData.ErrorCode = 3 + i + 1;
                        return;
                    }
                    if (TxtData.PublicData.MatchPresetName[i][j] != "StaubliPreset" && !db.SavePreset(i + 1, TxtData.PublicData.MatchPresetName[i][j]))
                    {
                        TxtData.PublicData.ErrorCode = 7 + i + 1;
                        return;
                    }
                    if (TxtData.MdbData.EnableItem[4])
                    {
                        string FileName = (i + 1).ToString() + "Product" + (j + 1).ToString() + ".txt";
                        File.Copy(Application.StartupPath + "\\Txt\\" + "product" + (i + 1).ToString() + ".txt", Application.StartupPath + "\\Txt\\" + FileName, true);
                        if (!ftp.UpLoadProduct(FileName))
                        {
                            TxtData.PublicData.ErrorCode = 23 + i;
                            return;
                        }
                    }
                    else
                    {
                        if (!ftp.UpLoadProduct(i + 1))
                        {
                            TxtData.PublicData.ErrorCode = 23 + i;
                            return;
                        }
                    }

                    //设置需要生产的产品的名称
                    if (!SoapInstance.SoapRead.SetAppdata("sProductName[" + (i + 1).ToString() + "]", TxtData.PublicData.ProductName[i][j]))
                    {
                        TxtData.PublicData.ErrorCode = 12;
                        return;
                    }
                    //if (!SoapInstance.SoapRead.SetAppdata(@"sProductName[1]", TxtData.PublicData.ProductName[i][j]))
                    //{
                    //    TxtData.PublicData.ErrorCode = 12;
                    //    return;
                    //}
                    if (TxtData.PublicData.MatchPresetName[i][j] != "StaubliPreset" && !ftp.UpLoadPreset(i + 1))
                    {
                        TxtData.PublicData.ErrorCode = 27 + i;
                        return;
                    }
                }
            }
            //****************************************************************************************************************
            //同工位多产品
            //2014.05.30
            if (TxtData.MdbData.EnableItem[4])
            {
                for (int i = 1; i <= TxtData.PublicData.WorkPlaceCount; i++)
                {
                    if (!SoapInstance.SoapRead.SetAppdata("nWpMutiCount[" + i.ToString() + "]", TxtData.PublicData.ProductCount[i - 1]))
                    {
                        TxtData.PublicData.ErrorCode = 12;
                        return;
                    }
                }
            }

            //if (!SoapInstance.SoapRead.SetAppdata("sCustom", (CBE_Custom.Text==null)?"  ":CBE_Custom.Text))
            if (!SoapInstance.SoapRead.SetAppdata("sCustom", CBE_Custom.Text))
            {
                TxtData.PublicData.ErrorCode = 12;
                return;
            }

            if (!SoapInstance.SoapRead.SetAppdata("nCycleMode", CBE_Triggle.SelectedIndex))
            {
                TxtData.PublicData.ErrorCode = 12;
                return;
            }
            if (!SoapInstance.SoapRead.SetAppdata("nCycleCount", (int)SE_Cycle.Value))
            {
                TxtData.PublicData.ErrorCode = 12;
                return;
            }
            if (!SoapInstance.SoapRead.SetAppdata("nWorkPlaceCount", TxtData.PublicData.WorkPlaceCount))
            {
                TxtData.PublicData.ErrorCode = 12;
                return;
            }

            if (!SoapInstance.SoapRead.SetAppdata("nInterfaceType", 13))
            {
                TxtData.PublicData.ErrorCode = 12;
                return;
            }
            db.AddLog("下载生产信息");
            TxtData.PublicData.ErrorCode = 40;
        }