Commit 6cac440b authored by wangjunqiang's avatar wangjunqiang

修复远程更新固件99%卡住问题

parent bb1a29a3
This diff is collapsed.
...@@ -341,7 +341,6 @@ namespace GcDevicePc.ConfigDlg ...@@ -341,7 +341,6 @@ namespace GcDevicePc.ConfigDlg
string tmp = globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName; string tmp = globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName;
ret = mainclient.WtClientCopytoServer("SingleAnal.ini", globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName, globaldata.remoteFolder + "仪器方法\\"); ret = mainclient.WtClientCopytoServer("SingleAnal.ini", globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName, globaldata.remoteFolder + "仪器方法\\");
tmp = globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName.Substring(globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName.LastIndexOf("\\") + 1); tmp = globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName.Substring(globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName.LastIndexOf("\\") + 1);
Thread.Sleep(1000);
ret = mainclient.WtClientCopytoServer(tmp, globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName, globaldata.remoteFolder + "仪器方法\\"); ret = mainclient.WtClientCopytoServer(tmp, globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName, globaldata.remoteFolder + "仪器方法\\");
mainclient.WtClientClose(); mainclient.WtClientClose();
...@@ -355,8 +354,8 @@ namespace GcDevicePc.ConfigDlg ...@@ -355,8 +354,8 @@ namespace GcDevicePc.ConfigDlg
sendupdatecmd(true); sendupdatecmd(true);
} }
string message = "提交成功!"; //string message = "提交成功!";
MessageBox.Show(message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); //MessageBox.Show(message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
} }
...@@ -383,7 +382,7 @@ namespace GcDevicePc.ConfigDlg ...@@ -383,7 +382,7 @@ namespace GcDevicePc.ConfigDlg
MessageBox.Show(message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
} }
// this.Close(); this.Close();
} }
private void MethodBase_Activated(object sender, EventArgs e) private void MethodBase_Activated(object sender, EventArgs e)
......
...@@ -691,22 +691,20 @@ namespace GcDevicePc ...@@ -691,22 +691,20 @@ namespace GcDevicePc
switch (runtype) switch (runtype)
{ {
case 0: case 0:
DataControl_Status(dest[5], 0); DataControl_Status(dest[5], 0);
break; break;
case 2: case 2:
BAT_HeadInfo(dest[0], dest[1]); BAT_HeadInfo(dest[0], dest[1]);
DataControl_Status(dest[5], 2); DataControl_Status(dest[5], 2);
break; break;
case 3: case 3:
QuickRun_HeadInfo(); QuickRun_HeadInfo();
DataControl_Status(dest[5], 1); DataControl_Status(dest[5], 1);
break; break;
case 4: case 4:
SingleRun_HeadInfo(); SingleRun_HeadInfo();
DataControl_Status(dest[5], 1);
break; break;
default: default:
Common_HeadInfo(); Common_HeadInfo();
......
...@@ -172,7 +172,7 @@ namespace GcDevicePc.ProThread ...@@ -172,7 +172,7 @@ namespace GcDevicePc.ProThread
//m_DeviceInfo.Netmask = String.Format("{0}.{1}.{2}.{3}", pBuf[20], pBuf[21], pBuf[22], pBuf[23]); //m_DeviceInfo.Netmask = String.Format("{0}.{1}.{2}.{3}", pBuf[20], pBuf[21], pBuf[22], pBuf[23]);
//m_DeviceInfo.Gateway = String.Format("{0}.{1}.{2}.{3}", pBuf[24], pBuf[25], pBuf[26], pBuf[27]); //m_DeviceInfo.Gateway = String.Format("{0}.{1}.{2}.{3}", pBuf[24], pBuf[25], pBuf[26], pBuf[27]);
m_DeviceInfo.MacAddr = String.Format("{0}:{1}:{2}:{3}:{4}:{5}", pBuf[106], pBuf[107], pBuf[108], pBuf[109], pBuf[110], pBuf[111]); m_DeviceInfo.MacAddr = String.Format("{0:X2}:{1:X2}:{2:X2}:{3:X2}:{4:X2}:{5:X2}", pBuf[106], pBuf[107], pBuf[108], pBuf[109], pBuf[110], pBuf[111]);
m_DeviceInfo.IpAddr = String.Format("{0}.{1}.{2}.{3}", pBuf[112], pBuf[113], pBuf[114], pBuf[115]); m_DeviceInfo.IpAddr = String.Format("{0}.{1}.{2}.{3}", pBuf[112], pBuf[113], pBuf[114], pBuf[115]);
m_DeviceInfo.Netmask = String.Format("{0}.{1}.{2}.{3}", pBuf[116], pBuf[117], pBuf[118], pBuf[119]); m_DeviceInfo.Netmask = String.Format("{0}.{1}.{2}.{3}", pBuf[116], pBuf[117], pBuf[118], pBuf[119]);
m_DeviceInfo.Gateway = String.Format("{0}.{1}.{2}.{3}", pBuf[120], pBuf[121], pBuf[122], pBuf[123]); m_DeviceInfo.Gateway = String.Format("{0}.{1}.{2}.{3}", pBuf[120], pBuf[121], pBuf[122], pBuf[123]);
......
...@@ -443,19 +443,23 @@ namespace GcDevicePc ...@@ -443,19 +443,23 @@ namespace GcDevicePc
{ {
if ( !String.IsNullOrEmpty(globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.config_RunTab) && !String.IsNullOrEmpty(globaldata.connection_ip)) if ( !String.IsNullOrEmpty(globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.config_RunTab) && !String.IsNullOrEmpty(globaldata.connection_ip))
{ {
globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.RunType = 2; globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.RunType = 2;
globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.work_Statue = 0; globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.work_Statue = 0;
this.tabrun.Enabled = false; this.tabrun.Enabled = false;
FileServerClient bfclient = new FileServerClient(); if (File.Exists(globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.config_RunTab))
bfclient.WtClientInit(globaldata.connection_ip, globaldata.fileserverport); {
bfclient.WtClientCopytoServer("RunMethod.ini", globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.config_RunTab, globaldata.remoteFolder + "运行表\\"); FileServerClient bfclient = new FileServerClient();
bfclient.WtClientClose(); bfclient.WtClientInit(globaldata.connection_ip, globaldata.fileserverport);
globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_RunTab = bfclient.WtClientCopytoServer("RunMethod.ini", globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.config_RunTab, globaldata.remoteFolder + "运行表\\");
globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.config_RunTab; bfclient.WtClientClose();
globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_RunTab =
globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.config_RunTab;
}
sendupdatecmd(false); sendupdatecmd(false);
this.tabrun.Enabled = true; this.tabrun.Enabled = true;
} }
......
...@@ -152,7 +152,17 @@ namespace GcDevicePc ...@@ -152,7 +152,17 @@ namespace GcDevicePc
string opensys = test.INIGetStringValue("StartUp", "打开系统", null); string opensys = test.INIGetStringValue("StartUp", "打开系统", null);
string runtype = test.INIGetStringValue("StartUp", "运行类型", null); string runtype = test.INIGetStringValue("StartUp", "运行类型", null);
this.label3.Text = MAC;
if (String.IsNullOrEmpty(MAC))
{
this.label1.Text = "目前Mac(未绑定):";
this.label3.Text = ((globaldata.DeviceInfo) globaldata.DeviceList[0]).MacAddr;
}
else
{
this.label3.Text = MAC;
}
if (Convert.ToInt32(value) == 1) if (Convert.ToInt32(value) == 1)
{ {
......
...@@ -59,7 +59,7 @@ namespace GcDevicePc ...@@ -59,7 +59,7 @@ namespace GcDevicePc
this.label4.Text = ipos.ToString() + "/100"; this.label4.Text = ipos.ToString() + "/100";
this.progressBar1.Value = Convert.ToInt32(ipos); this.progressBar1.Value = Convert.ToInt32(ipos);
if(ipos == 100) if(ipos == 100 || send_ok)
{ {
this.label4.Text = "传输完成"; this.label4.Text = "传输完成";
this.runbtn.Enabled = true; this.runbtn.Enabled = true;
...@@ -180,7 +180,7 @@ namespace GcDevicePc ...@@ -180,7 +180,7 @@ namespace GcDevicePc
this.localpath = file; // Path.GetDirectoryName(file); this.localpath = file; // Path.GetDirectoryName(file);
//this.localstr.Text = this.localpath; //this.localstr.Text = this.localpath;
//this.ProName.Text = this.updateexe; //this.ProName.Text = this.updateexe;
this.ProName.Text = this.localpath + this.updateexe; this.ProName.Text = this.localpath;
this.updatebtn.Enabled = true; this.updatebtn.Enabled = true;
} }
...@@ -209,17 +209,17 @@ namespace GcDevicePc ...@@ -209,17 +209,17 @@ namespace GcDevicePc
send_Thread.IsBackground = true; send_Thread.IsBackground = true;
send_Thread.Start(); send_Thread.Start();
for (int i = 0; i < 200; i++) for (int i = 0; i < 100; i++)
{ {
if(send_ok) if(send_ok)
{ {
SetTextMesssage(100, i.ToString() + "\r\n"); SetTextMesssage(100, i.ToString() + "\r\n");
}else }else
{ {
System.Threading.Thread.Sleep(100); Thread.Sleep(200);
SetTextMesssage(100 * i / 200, i.ToString() + "\r\n"); SetTextMesssage(i, i.ToString() + "\r\n");
if(i == 199) if(i == 95)
{ {
i--; i--;
} }
...@@ -233,12 +233,11 @@ namespace GcDevicePc ...@@ -233,12 +233,11 @@ namespace GcDevicePc
int ret; int ret;
FileServerClient singlesend = new FileServerClient(); FileServerClient singlesend = new FileServerClient();
singlesend.WtClientInit(HmiIP, HmiPort); singlesend.WtClientInit(HmiIP, HmiPort);
ret = singlesend.WtClientCopytoServer(this.updateexe, this.localpath, globaldata.exeremoteFolder); ret = singlesend.WtClientCopytoServerNoDelay(this.updateexe, this.localpath, globaldata.exeremoteFolder);
if (ret == 1) if (ret == 1)
{ {
this.send_ok = true; this.send_ok = true;
//MessageBox.Show("更新成功");
} }
singlesend.WtClientClose(); singlesend.WtClientClose();
...@@ -379,11 +378,11 @@ namespace GcDevicePc ...@@ -379,11 +378,11 @@ namespace GcDevicePc
fullfilename = NextFile.FullName; fullfilename = NextFile.FullName;
singlesend.WtClientCopytoServer(NextFile.Name, fullfilename, globaldata.updateremoteFolder); singlesend.WtClientCopytoServerNoDelay(NextFile.Name, fullfilename, globaldata.updateremoteFolder);
Console.WriteLine(NextFile.Name); //Console.WriteLine(NextFile.Name);
Console.WriteLine(fullfilename); //Console.WriteLine(fullfilename);
Console.WriteLine( globaldata.updateremoteFolder); //Console.WriteLine( globaldata.updateremoteFolder);
Thread.Sleep(100); Thread.Sleep(100);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment