Ejemplo n.º 1
0
 private void Get_ATE_Script(string woId)
 {
     this.Invoke(new EventHandler(delegate
     {
         try
         {
             (mFrm as WorkOrderCreate).listbScript.Items.Clear();
             string IniFileName   = System.AppDomain.CurrentDomain.BaseDirectory + "Updatecfg.ini";
             string FtpHost       = FrmBLL.ReadIniFile.IniReadValue("ATESCRIPT", "Host", IniFileName);
             string User          = FrmBLL.ReadIniFile.IniReadValue("ATESCRIPT", "User", IniFileName);
             string UsePwd        = FrmBLL.ReadIniFile.IniReadValue("ATESCRIPT", "Password", IniFileName);
             FrmBLL.Ftp_Socket fm = new FrmBLL.Ftp_Socket(FtpHost, woId, User, UsePwd, 21);
             this.lbMsg.Text      = "正在获取脚本....";
             List <string> ss     = fm.FileList("*.ts");
             foreach (string item in ss)
             {
                 (mFrm as WorkOrderCreate).listbScript.Items.Add(item);
             }
             this.lbMsg.Text   = "获取脚本完成,正在获取条码档....";
             List <string> Lab = fm.FileList("*.Lab");
             foreach (string item in Lab)
             {
                 (mFrm as WorkOrderCreate).listbScript.Items.Add(item);
             }
             this.lbMsg.Text   = "获取完成...";
             this.DialogResult = DialogResult.OK;
         }
         catch (Exception ex)
         {
             this.lbMsg.Text = ex.Message;
             System.Threading.Thread.Sleep(3000);
             this.DialogResult = DialogResult.No;
         }
     }));
 }
Ejemplo n.º 2
0
 private void Get_ATE_Script()
 {
     this.Invoke(new EventHandler(delegate
     {
         try
         {
             listbScript.Items.Clear();
             string IniFileName   = System.AppDomain.CurrentDomain.BaseDirectory + "Updatecfg.ini";
             string FtpHost       = FrmBLL.ReadIniFile.IniReadValue("ATESCRIPT", "Host", IniFileName);
             string User          = FrmBLL.ReadIniFile.IniReadValue("ATESCRIPT", "User", IniFileName);
             string UsePwd        = FrmBLL.ReadIniFile.IniReadValue("ATESCRIPT", "Password", IniFileName);
             FrmBLL.Ftp_Socket fm = new FrmBLL.Ftp_Socket(FtpHost, woId, User, UsePwd, 21);
             this.lbMsg.Text      = "正在获取脚本....";
             lbMsg.Update();
             (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Incoming, "正在获取脚本....");
             try
             {
                 List <string> ss = fm.FileList("*.ts");
                 foreach (string item in ss)
                 {
                     listbScript.Items.Add(item);
                 }
             }
             catch (Exception ex)
             {
                 lbMsg.Text      = "获取脚本异常:" + ex.Message;
                 lbMsg.ForeColor = Color.Red;
                 lbMsg.Update();
                 (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Error, lbMsg.Text);
             }
             this.lbMsg.Text = "获取脚本完成,正在获取条码档....";
             lbMsg.Update();
             (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Incoming, lbMsg.Text);
             try
             {
                 List <string> Lab = fm.FileList("*.Lab");
                 foreach (string item in Lab)
                 {
                     listbScript.Items.Add(item);
                 }
             }
             catch (Exception ex)
             {
                 lbMsg.Text      = "获取条码档异常:" + ex.Message;
                 lbMsg.ForeColor = Color.Red;
                 lbMsg.Update();
                 (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Error, lbMsg.Text);
             }
             this.lbMsg.Text = "读取ftp完成...";
             (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Incoming, lbMsg.Text);
             lbMsg.Update();
             lbMsg.ForeColor = Color.Green;
         }
         catch (Exception ex)
         {
             this.lbMsg.Text = ex.Message;
             lbMsg.ForeColor = Color.Red;
             (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Error, lbMsg.Text);
         }
     }));
 }
Ejemplo n.º 3
0
        private void Get_ATE_Script(string woId)
        {
            try
            {
                string            IniFileName = System.AppDomain.CurrentDomain.BaseDirectory + "Updatecfg.ini";
                string            FtpHost     = FrmBLL.ReadIniFile.IniReadValue("ATESCRIPT", "Host", IniFileName);
                string            User        = FrmBLL.ReadIniFile.IniReadValue("ATESCRIPT", "User", IniFileName);
                string            UsePwd      = FrmBLL.ReadIniFile.IniReadValue("ATESCRIPT", "Password", IniFileName);
                FrmBLL.Ftp_Socket fm          = new FrmBLL.Ftp_Socket(FtpHost, woId, User, UsePwd, 21);
                (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Incoming, "正在获取脚本....");
                string StrScript = string.Empty;
                try
                {
                    List <string> ss = fm.FileList("*.ts");
                    foreach (string item in ss)
                    {
                        StrScript += item + ",";
                        (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Normal, item);
                    }
                }
                catch (Exception ex)
                {
                    (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Error, "获取脚本异常:" + ex.Message);
                }

                (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Incoming, "获取脚本完成,正在获取条码档....");
                try
                {
                    List <string> Lab = fm.FileList("*.Lab");
                    foreach (string item in Lab)
                    {
                        StrScript += item + ",";
                        (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Normal, item);
                    }
                }
                catch (Exception ex)
                {
                    (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Error, "获取条码档异常:" + ex.Message);
                }

                (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Incoming, "读取ftp完成...");
                if (!string.IsNullOrEmpty(StrScript))
                {
                    (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Incoming, "开始保存脚本...");
                    StrScript = StrScript.Substring(0, StrScript.Length - 1);
                    IDictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("WOID", woId);
                    dic.Add("SCRIPT", StrScript);
                    string JsonStr = FrmBLL.ReleaseData.DictionaryToJson(dic);
                    string _StrErr = refWebtWoInfo.Instance.Insert_Wo_Info(null, JsonStr, null, null);
                    if (_StrErr == "OK")
                    {
                        FrmBLL.publicfuntion.InserSystemLog((mFrm as Frm_MO_Manage).UserId, "工单信息", "AteScript", JsonStr);
                        (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Incoming, "保存脚本完成...");
                    }
                    else
                    {
                        (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Error, "保存脚本失败:" + _StrErr);
                    }
                }
            }
            catch (Exception ex)
            {
                (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Error, ex.Message);
            }
        }