Commit 98b24367 LN

bug修改

1 个父辈 7e0a1634
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<add key="App_AutoRun" value="1" /> <add key="App_AutoRun" value="1" />
<add key="App_Title" value="自动点料机" /> <add key="App_Title" value="自动点料机" />
<!--<add key="ServerAddr" value="http://10.85.17.233"/>--> <add key="ServerAddr" value="http://10.85.17.233"/>
<add key="ConfigPath_Robot" value="\RobotConfig\Config_Robot.csv" /> <add key="ConfigPath_Robot" value="\RobotConfig\Config_Robot.csv" />
<add key="ConfigPath_XRay" value="\RobotConfig\Config_XRay.csv" /> <add key="ConfigPath_XRay" value="\RobotConfig\Config_XRay.csv" />
......
...@@ -748,6 +748,23 @@ namespace OnlineStore.AutoCountClient ...@@ -748,6 +748,23 @@ namespace OnlineStore.AutoCountClient
{ {
equipBean.DefautTargetP = comTP.SelectedIndex + 1; equipBean.DefautTargetP = comTP.SelectedIndex + 1;
} }
private void btnCheck_Click(object sender, EventArgs e)
{
string reelId = txtReelId.Text;
string pn = txtPN.Text;
int p = 0;
SServerManager.Get_VMICheckRLC("测试按钮", pn + ";" + reelId, out p);
}
private void btnReturn_Click(object sender, EventArgs e)
{
int qty = FormUtil.GetIntValue(txtQty ) ;
string reelId = txtReelId.Text;
string pn = txtPN.Text;
int p = 0;
SServerManager.Return_Material ("测试按钮", pn + ";" + reelId, qty);
}
} }
} }
......
...@@ -42,7 +42,7 @@ namespace OnlineStore.Common ...@@ -42,7 +42,7 @@ namespace OnlineStore.Common
protected override WebRequest GetWebRequest(Uri address) protected override WebRequest GetWebRequest(Uri address)
{ {
var result = base.GetWebRequest(address); HttpWebRequest result = (HttpWebRequest)base.GetWebRequest(address);
result.Timeout = this._timeout; result.Timeout = this._timeout;
return result; return result;
} }
...@@ -71,22 +71,15 @@ namespace OnlineStore.Common ...@@ -71,22 +71,15 @@ namespace OnlineStore.Common
} }
} }
return true; return true;
} }
public static string Post(string url, string paramData, int timeOut = 10000) public static string Post(string url, string paramData, int timeOut = 10000)
{ {
return Post(url, paramData, Encoding.UTF8, timeOut); return Post(url, paramData, Encoding.UTF8, timeOut);
} }
private static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open);
public static string Post(string url, string paramData, Encoding encoding, int timeOut = 10000) public static string Post(string url, string paramData, Encoding encoding, int timeOut = 10000)
{ {
if (isLog == 1)
{
LogUtil.info("给服务器发送数据【" + paramData + "】 ");
}
if (paramData != "null" && paramData != null)
{
// LogUtil.debug(LOGGER, "HTTP POST to " + url + " \n\t >> " + paramData);
}
string result = ""; string result = "";
if (url.ToLower().IndexOf("https", System.StringComparison.Ordinal) > -1) if (url.ToLower().IndexOf("https", System.StringComparison.Ordinal) > -1)
...@@ -99,7 +92,10 @@ namespace OnlineStore.Common ...@@ -99,7 +92,10 @@ namespace OnlineStore.Common
{ {
var wc = new MyWebClient(10000); var wc = new MyWebClient(10000);
if (string.IsNullOrEmpty(wc.Headers["Content-Type"])) if (string.IsNullOrEmpty(wc.Headers["Content-Type"]))
{
wc.Headers.Add("Content-Type", "application/json;charset=UTF-8"); wc.Headers.Add("Content-Type", "application/json;charset=UTF-8");
}
wc.Headers.Add("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
wc.Encoding = encoding; wc.Encoding = encoding;
result = wc.UploadString(url, "POST", paramData); result = wc.UploadString(url, "POST", paramData);
...@@ -109,14 +105,7 @@ namespace OnlineStore.Common ...@@ -109,14 +105,7 @@ namespace OnlineStore.Common
{ {
LogUtil.error("POST ERROR:" + e.ToString(), 101); LogUtil.error("POST ERROR:" + e.ToString(), 101);
} }
if (!result.Contains("null") && result.Length != 0)
{
//LogUtil.debug(LOGGER,"receive << " + result);
}
if (isLog == 1)
{
LogUtil.info("收到服务器数据【" + result + "】");
}
return result; return result;
} }
...@@ -124,18 +113,17 @@ namespace OnlineStore.Common ...@@ -124,18 +113,17 @@ namespace OnlineStore.Common
{ {
return Get(url, Encoding.UTF8); return Get(url, Encoding.UTF8);
} }
public static string Get(string url, Encoding encoding, int timeOut = 10000)
public static string Get(string url, Encoding encoding)
{ {
try try
{ {
LogUtil.info( "HTTP GET FROM: " + url); LogUtil.debug("HTTP GET FROM: " + url);
var wc = new WebClient { Encoding = encoding }; var wc = new WebClient { Encoding = encoding };
var readStream = wc.OpenRead(url); var readStream = wc.OpenRead(url);
using (var sr = new StreamReader(readStream, encoding)) using (var sr = new StreamReader(readStream, encoding))
{ {
var result = sr.ReadToEnd(); var result = sr.ReadToEnd();
LogUtil.info( "receive << " + result); LogUtil.debug("receive << " + result);
return result; return result;
} }
} }
......
...@@ -55,8 +55,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -55,8 +55,12 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(MoveInfo.Name + "StartWorking 失败 , MoveInfo 忙碌中=" + MoveInfo.MoveType); LogUtil.error(MoveInfo.Name + "StartWorking 失败 , MoveInfo 忙碌中=" + MoveInfo.MoveType);
return false; return false;
} }
//如果料架在准备状态或送出过程中,不能开始取料 if(ShelfMoveInfo.MoveType.Equals(RobotMoveType.ShelfPro)&&ShelfMoveInfo.MoveStep>= StepEnum.OS_31_ShendShelfOut)
{
LogUtil.error(MoveInfo.Name + "StartWorking 失败 , ShelfMoveInfo 正在送出料架 " + ShelfMoveInfo.MoveType+"_"+ ShelfMoveInfo.MoveStep);
return false;
}
if (IOValue(IO_Type.Out_TrayCheck).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.X_OLine_Run).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.Out_TrayCheck).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.X_OLine_Run).Equals(IO_VALUE.LOW))
{ {
......
...@@ -16,16 +16,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -16,16 +16,16 @@ namespace OnlineStore.DeviceLibrary
//结果上传: //结果上传:
//http://10.85.17.233/ReturnOne/WebServiceF.asmx?op=Return_Material //http://10.85.17.233/ReturnOne/WebServiceF.asmx?op=Return_Material
// http://10.85.17.233/ESMTCommonInterface/CommonService.asmx/VMICheckRLC?reelID=R014212020051100876&partNum=6C.R0034.1D1
private static string Addr_VMICheckRLC = "/ESMTCommonInterface/CommonService.asmx/VMICheckRLC";
private static string Addr_Return_Material = "/ReturnOne/WebServiceF.asmx/Return_Material";
private static string Addr_VMICheckRLC = "/ESMTCommonInterface/CommonService.asmx?op=VMICheckRLC"; public static string Get_VMICheckRLC(string deviceName, string codeStr, out int targetP)
private static string Addr_Return_Material = "/ReturnOne/WebServiceF.asmx?op=Return_Material";
public static string Get_VMICheckRLC(string deviceName, string codeStr, out int targetP)
{ {
//reelID: //reelID:
//partNum: //partNum:
//{"data":{"IFneed":"不需要","iftest":"","component":"","msg":"不需要测量RLC","status":1}} //{"data":{"IFneed":"不需要","iftest":"","component":"","msg":"不需要测量RLC","status":1}}
targetP=0; targetP = 0;
string msg = ""; string msg = "";
try try
{ {
...@@ -44,37 +44,34 @@ namespace OnlineStore.DeviceLibrary ...@@ -44,37 +44,34 @@ namespace OnlineStore.DeviceLibrary
return "获取是否测值失败"; return "获取是否测值失败";
} }
DateTime startTime = DateTime.Now; DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, ""); string resultStr = HttpHelper.Get(server);
LogUtil.info("Get_VMICheckRLC " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】"); LogUtil.info(deviceName + "Get_VMICheckRLC " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
//{"data":{"IFneed":"不需要","iftest":"","component":"","msg":"不需要测量RLC","status":1}} //{"data":{"IFneed":"不需要","iftest":"","component":"","msg":"不需要测量RLC","status":1}}
CheckData dataResult = JsonHelper.DeserializeJsonToObject<CheckData>(resultStr); ResultData strData = JsonHelper.DeserializeJsonToObject<ResultData>(resultStr);
if (strData != null && strData.data != null)
if (dataResult == null) {
{ if (strData.data.status.Equals(1) && strData.data.IFneed.Equals("不需要"))
return "获取是否测值失败"; {
} targetP = 1;
else if (dataResult.status.Equals(1) && dataResult.IFneed.Equals("不需要")) return "";
{ }
targetP=1; else if (strData.data.status.Equals(1) && strData.data.IFneed.Equals("需要"))
return ""; {
} //需要时,component是电容 或者电阻
else if (dataResult.status.Equals(1) && dataResult.IFneed.Equals("需要")) if (strData.data.component.Equals("电容"))
{ {
//需要时,component是电容 或者电阻 targetP = 2;
if (dataResult.component.Equals("电容")) }
{ else
targetP = 2; {
targetP = 3;
}
return "";
} }
else
{
targetP = 3;
}
return "";
} }
else else
{ {
targetP = 0; return "获取是否测值失败";
return msg;
} }
} }
catch (Exception ex) catch (Exception ex)
...@@ -82,6 +79,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -82,6 +79,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(deviceName + " ", ex); LogUtil.error(deviceName + " ", ex);
return ex.ToString(); return ex.ToString();
} }
return msg;
} }
...@@ -108,8 +106,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -108,8 +106,8 @@ namespace OnlineStore.DeviceLibrary
return ""; return "";
} }
DateTime startTime = DateTime.Now; DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, ""); string resultStr = HttpHelper.Get(server);
LogUtil.info("Return_Material " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】"); LogUtil.info(deviceName+ "Return_Material " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -145,11 +143,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -145,11 +143,16 @@ namespace OnlineStore.DeviceLibrary
return !String.IsNullOrEmpty(server); return !String.IsNullOrEmpty(server);
} }
} }
// http://10.85.17.233/ESMTCommonInterface/CommonService.asmx/VMICheckRLC?reelID=R014212020051100876&partNum=6C.R0034.1D1
// {"data":{"IFneed":"需要","iftest":"未测值","component":"","msg":"未获取到测量RLC时间","status":1}}
public class ResultData
{
public CheckData data { get; set; }
}
public class CheckData public class CheckData
{ {
//{"data":{"IFneed":"不需要","iftest":"","component":"","msg":"不需要测量RLC","status":1}} //{"data":{"IFneed":"不需要","iftest":"","component":"","msg":"不需要测量RLC","status":1}}
public int IFneed { get; set; } public string IFneed { get; set; }
public string iftest { get; set; } public string iftest { get; set; }
public string component { get; set; } public string component { get; set; }
public string msg { get; set; } public string msg { get; set; }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!