Exemplo n.º 1
0
        /// <summary>
        /// 把生产个数给保存下来
        ///  </summary>
        public static void ReadProductCount()
        {
            if (TxtData.DataBase.ProductName != null && TxtData.DataBase.InterfaceType == 9 && TxtData.DataBase.WorkPlaceProductCount != null)
            {
                int len = 0;
                for (int j = 0; j < TxtData.DataBase.WorkPlaceProductCount.Length; j++)
                {
                    len = len + TxtData.DataBase.WorkPlaceProductCount[j];

                }
                if (len == 0)
                {
                    return;
                }
                try
                {

                    DataBaseManage db = new DataBaseManage();
                    for (int i = 1; i <= 4; i++)
                    {
                        if (TxtData.DataBase.ProductName.Length >i && TxtData.DataBase.WorkPlaceProductCount.Length > i && TxtData.DataBase.WorkPlaceProductCount[i] > 0)
                        {
                            db.AddProductCount(i, TxtData.DataBase.Custom, TxtData.DataBase.ProductName[i], TxtData.DataBase.WorkPlaceProductCount[i]);
                            SoapInstance.SoapRead.SetAppdata("nWpProduct[" + i.ToString() + "]", 0);

                        }

                    }

                }
                catch (System.Exception ex)
                {

                }

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

            double[] tool = db.GetTool();
            if (tool == null || tool.Length != 6 || TxtData.SoapData.Tool == null || TxtData.SoapData.Tool.Length != 6)
            {
                TxtData.PublicData.ErrorCode = 42;
                return;
            }

            TxtData.MdbData.Tool = tool;
            //for (int i = 0; i < 6; i++)
            //{
            //    if (tool[i] != TxtData.MdbData.Tool[i])
            //    {
            //        TxtData.PublicData.ErrorCode = 42;
            //        return;
            //    }
            //}

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



            //**************************************

            if (db.IsMatlabFile(CBE_RecipeName.EditValue.ToString()) == 0)
            {
                TxtData.PublicData.ErrorCode = 34;
                return;
            }
            PolishTxt.MatlabFile = (db.IsMatlabFile(CBE_RecipeName.EditValue.ToString()) == 2);

            //

            PolishTxt.Home = home;
            if (!db.SaveProduct(CBE_RecipeName.EditValue.ToString()))
            {
                TxtData.PublicData.ErrorCode = 34;
                return;
            }

            if (!System.IO.Directory.Exists(Application.StartupPath + "\\txt\\"))
            {
                System.IO.Directory.CreateDirectory(Application.StartupPath + "\\txt\\");
            }


            if (!PolishTxt.Standard2Polish(Application.StartupPath + "\\txt\\Recipe.txt", Application.StartupPath + "\\txt\\" + CBE_RecipeName.EditValue.ToString() + ".txt"))
            {
                TxtData.PublicData.ErrorCode = 49;
                return;
            }



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

            //*******************************************



            if (!ftp.UpLoad(Application.StartupPath + "\\txt\\" + CBE_RecipeName.EditValue.ToString().Trim() + @".txt", @"/usr/usrapp/txt"))
            // if (!ftp.UpLoadPolishTxt(CBE_RecipeName.EditValue.ToString().Trim()))

            {
                TxtData.PublicData.ErrorCode = 24;
                return;
            }

            SoapInstance.SoapRead.SoapSetAppname = @"Disk://RobotPolish/RobotPolish.pjx";
            if (!SoapInstance.SoapRead.SetAppdata("sTxtSelected", CBE_RecipeName.EditValue.ToString() + ".txt"))
            {
                TxtData.PublicData.ErrorCode = 70;
                return;
            }


            //
            if (!SoapInstance.SoapRead.SetLibdata("read", "nZshift", -(int)ND_Z.Value))
            {
                TxtData.PublicData.ErrorCode = 70;
                return;
            }



            //2015.01.20
            if (!SoapInstance.SoapRead.SetAppAIO("io:aPressSet", (double)NUD_Press.Value))
            {
                TxtData.PublicData.ErrorCode = 70;
                return;
            }

            if (!SoapInstance.SoapRead.SetAppAIO("io:aRevolu", (double)NUD_Speed.Value))
            {
                TxtData.PublicData.ErrorCode = 70;
                return;
            }
            if (!SoapInstance.SoapRead.SetAppAIO("io:aRotation", (double)NUD_Rot.Value))
            {
                TxtData.PublicData.ErrorCode = 70;
                return;
            }
            if (!SoapInstance.SoapRead.SetAppAIO("io:aTableSpeed", (double)NUD_Speed.Value))
            {
                TxtData.PublicData.ErrorCode = 70;
                return;
            }

            if (!SoapInstance.SoapRead.SetAppdata("nVirtualKey", 272))
            {
                TxtData.PublicData.ErrorCode = 70;
                return;
            }
            db.AddLog("下载产品" + CBE_RecipeName.Text);
            db.AddProductCount(CBE_Custom.Text, CBE_RecipeName.Text, 1);//while (TxtData.SoapData.InterfaceType == 9)
            //{//    System.Threading.Thread.Sleep(10);
            //}
            TxtData.PublicData.ErrorCode = 40;
        }