Commit 7cd96e6d LN

分流bug修改。httpPost方法修改。

1 个父辈 c55429b2
...@@ -53,8 +53,8 @@ namespace OnlineStore.AssemblyLine ...@@ -53,8 +53,8 @@ namespace OnlineStore.AssemblyLine
/// </summary> /// </summary>
[STAThread] [STAThread]
static void Main(string[] Args) static void Main(string[] Args)
{ {
//string code = " (X: 380,Y: 148) L00000000000WG9D19055;E20191230 0180;B7H.10618.5B1008082019123004000;R0080820191230E9600"; //string code = " (X: 380,Y: 148) L00000000000WG9D19055;E20191230 0180;B7H.10618.5B1008082019123004000;R0080820191230E9600";
//string r = CodeManager.ReplaceCode(code); //string r = CodeManager.ReplaceCode(code);
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
...@@ -129,5 +129,24 @@ namespace OnlineStore.AssemblyLine ...@@ -129,5 +129,24 @@ namespace OnlineStore.AssemblyLine
LogUtil.error("【" + type + "】" + exceptionobj); LogUtil.error("【" + type + "】" + exceptionobj);
} }
static void Test()
{
string s = "http://192.168.101.11/myproject/rest/api/qisda/device/getSize?robotIndex=2&barcode=L165K001877%3bE20200329+0730%3bBQT001200218504192020032915000%3bR04192020042451762%23%230201X104K100CT%2f15000%2f165K001877%2f20200329%23%23";
string param = "robotIndex=2&barcode=L165K001877";
System.Collections.Specialized.NameValueCollection data = new System.Collections.Specialized.NameValueCollection();
Dictionary<string, object> value = new Dictionary<string, object>();
data.Add("robotIndex", 2.ToString());
data.Add("barcode", "L165K001877%3bE20200329+0730%3bBQT001200218504192020032915000%3bR04192020042451762%23%230201X104K100CT%2f15000%2f165K001877%2f20200329%23%23");
value.Add("robotIndex", 2);
value.Add("barcode", "L165K001877%3bE20200329+0730%3bBQT001200218504192020032915000%3bR04192020042451762%23%230201X104K100CT%2f15000%2f165K001877%2f20200329%23%23");
// string param = JsonHelper.SerializeObject(value);
s = "http://192.168.101.11/myproject/service/store/emptyPosForPutin?cids=line-ac-01%2cline-ac-02%2cline-ac-03%2cline-ac-04%2cline-ac-05%2cline-ac-06%2cline-ac-07%2cline-ac-08%2cline-ac-09%2cline-ac-10%2cline-ac-11%2cline-ac-12%2cline-ac-13%2cline-ac-14%2cline-ac-15%2cline-ac-16%2cline-ac-17%2cline-ac-18&code=%3d7x8%3dL0000000IA0106D25D015%3bE20200106+0730%3bB7H.10524.5C1035042020010604000+%3bR035042020010600208%23%23&rfid=B16";
string result = HttpHelper.Post(s, "");
s = "http://192.168.101.11/myproject/rest/api/qisda/device/getSize?robotIndex=2&barcode=L165K001877%3bE20200329+0730%3bBQT001200218504192020032915000%3bR04192020042451762%23%230201X104K100CT%2f15000%2f165K001877%2f20200329%23%23";
result = HttpHelper.Post(s, "");
return;
}
} }
} }
20200805 
20200812
分流bug修改。
httpPost方法修改。
20200805
横移3和横移1顶升下降之后需要等待1秒再检测托盘检测信号是否消失。 横移3和横移1顶升下降之后需要等待1秒再检测托盘检测信号是否消失。
出料4紧急出料最多等待20-30秒,如果料架已离开或者当前无料架直接放行托盘。 出料4紧急出料最多等待20-30秒,如果料架已离开或者当前无料架直接放行托盘。
上升端不到位就横移。 上升端不到位就横移。
......
...@@ -123,7 +123,7 @@ namespace OnlineStore.Common ...@@ -123,7 +123,7 @@ namespace OnlineStore.Common
} }
else else
{ {
LOGGER.Error ("ShowLogPro【" + msg + "】失败,未得到锁"); LOGGER.Debug ("ShowLogPro【" + msg + "】失败,未得到锁");
} }
} }
private static List<string> logList = new List<string>(); private static List<string> logList = new List<string>();
......
using log4net; using log4net;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
...@@ -82,17 +83,24 @@ namespace OnlineStore.Common ...@@ -82,17 +83,24 @@ namespace OnlineStore.Common
} }
private static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open); private static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open);
public static string Post(string url, string paramData, Encoding encoding, int timeOut ,out bool IsTimeOut) public static string Post(string url, string paramData, Encoding encoding, int timeOut, out bool IsTimeOut)
{ {
if (paramData.Equals(""))
{
int index = url.IndexOf("?");
if (index > 0)
{
paramData = url.Substring(index + 1, url.Length - index - 1);
url = url.Substring(0, index);
}
}
IsTimeOut = false; IsTimeOut = false;
if (isLog == 1) if (isLog == 1)
{ {
LOGGER.Info("给服务器发送数据【" + paramData + "】 "); LOGGER.Info("给服务器发送数据【"+url+"】【" + 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)
...@@ -105,16 +113,16 @@ namespace OnlineStore.Common ...@@ -105,16 +113,16 @@ namespace OnlineStore.Common
{ {
var wc = new MyWebClient(timeOut); var wc = new MyWebClient(timeOut);
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/x-www-form-urlencoded;charset=UTF-8");
wc.Encoding = encoding; wc.Encoding = encoding;
result = wc.UploadString(url, "POST", paramData); result = wc.UploadString(url, "POST", paramData);
//LogUtil.info(result); //LogUtil.info(result);
} }
catch(WebException ex) catch (WebException ex)
{ {
IsTimeOut = true; IsTimeOut = true;
LogUtil.error("POST ["+ url + "] WebException :" + ex .ToString(), 101); LogUtil.error("POST [" + url + "] WebException :" + ex.ToString(), 101);
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -130,7 +138,7 @@ namespace OnlineStore.Common ...@@ -130,7 +138,7 @@ namespace OnlineStore.Common
} }
return result; return result;
} }
public static string Get(string url) public static string Get(string url)
{ {
return Get(url, Encoding.UTF8); return Get(url, Encoding.UTF8);
......
...@@ -99,7 +99,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -99,7 +99,7 @@ namespace OnlineStore.DeviceLibrary
wait.IsEnd = IOValue(wait.IoType).Equals(wait.IoValue); wait.IsEnd = IOValue(wait.IoType).Equals(wait.IoValue);
if (!wait.IsEnd) if (!wait.IsEnd)
{ {
TimeSpan rwSpan = DateTime.Now - preRWTime; TimeSpan rwSpan = DateTime.Now - preRWTime;
//一分钟还未检测到 //一分钟还未检测到
if (span.TotalSeconds > LineManager.Config.IOSingle_TimerOut && NoAlarm()) if (span.TotalSeconds > LineManager.Config.IOSingle_TimerOut && NoAlarm())
...@@ -113,7 +113,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -113,7 +113,7 @@ namespace OnlineStore.DeviceLibrary
else if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalSeconds < LineManager.Config.IOSingle_TimerOut * 2) else if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalSeconds < LineManager.Config.IOSingle_TimerOut * 2)
{ {
preRWTime = DateTime.Now; preRWTime = DateTime.Now;
string msg = checkWaitInfo.Name + " " + NotOkMsg + "已等待 " + Math.Round(span.TotalSeconds,1) + "秒,重写DO:"; string msg = checkWaitInfo.Name + " " + NotOkMsg + "已等待 " + Math.Round(span.TotalSeconds, 1) + "秒,重写DO:";
bool isLog = false; bool isLog = false;
foreach (WaitResultInfo ww in list) foreach (WaitResultInfo ww in list)
{ {
...@@ -191,6 +191,20 @@ namespace OnlineStore.DeviceLibrary ...@@ -191,6 +191,20 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(checkWaitInfo.Name + " [" + checkWaitInfo.MoveStep + "] CheckWait 出错:", ex); LogUtil.error(checkWaitInfo.Name + " [" + checkWaitInfo.MoveStep + "] CheckWait 出错:", ex);
//如果是空指针异常,并且MoveStep=SW06_TopCylinderUp,单独处理 //如果是空指针异常,并且MoveStep=SW06_TopCylinderUp,单独处理
// [2020-08-10 13:32:45,352] [132] ERROR 横移轨道-41 [SW06_TopCylinderUp]
// CheckWait 出错:
//System.IndexOutOfRangeException: 索引超出了数组界限。
// 在 System.Collections.Generic.List`1.Enumerator.MoveNext()
// 在 OnlineStore.DeviceLibrary.LineBean.CheckWait(LineMoveInfo checkWaitInfo) 位置 E:\VSSource\RC1250_佳士达\RC1250-AssemblyLine\source\DeviceLibrary\assemblyLine\LineBean_Partial.cs:行号 89
if (ex is System.IndexOutOfRangeException)
{
if (checkWaitInfo.MoveStep.Equals(LineMoveStep.SW06_TopCylinderUp))
{
LogUtil.error(checkWaitInfo.Name + " 当前步骤:SW06_TopCylinderUp,IndexOutOfRangeException异常,自动回到上一个步骤 SW05_LocationDown,等待500 重新开始 ");
checkWaitInfo.NextMoveStep(LineMoveStep.SW05_LocationDown);
checkWaitInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
}
}
} }
} }
#endregion #endregion
......
...@@ -237,7 +237,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -237,7 +237,8 @@ namespace OnlineStore.DeviceLibrary
{ {
Shunt_MoveInfo.NextMoveStep(LineMoveStep.Shunt05_Top1Up); Shunt_MoveInfo.NextMoveStep(LineMoveStep.Shunt05_Top1Up);
LogUtil.info(Name + "[" + ShuntTrayNum + "]" + "分流横移:" + msg + " 需要分流,阻挡1上升,升降1上升 ,等待升降2是否可上升 "); LogUtil.info(Name + "[" + ShuntTrayNum + "]" + "分流横移:" + msg + " 需要分流,阻挡1上升,升降1上升 ,等待升降2是否可上升 ");
CheckAndMove(IO_Type.Shunt_MotorRun1, IO_VALUE.LOW);
CheckAndMove(IO_Type.Shunt_MotorRun2, IO_VALUE.LOW);
CylinderMove(Shunt_MoveInfo, IO_Type.Shunt_TopCylinder_Down1, IO_Type.Shunt_TopCylinder_Up1); CylinderMove(Shunt_MoveInfo, IO_Type.Shunt_TopCylinder_Down1, IO_Type.Shunt_TopCylinder_Up1);
if (Shunt_Updown2CanUp()) if (Shunt_Updown2CanUp())
{ {
...@@ -277,6 +278,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -277,6 +278,7 @@ namespace OnlineStore.DeviceLibrary
{ {
Shunt_MoveInfo.NextMoveStep(LineMoveStep.Shunt07_Top2Up); Shunt_MoveInfo.NextMoveStep(LineMoveStep.Shunt07_Top2Up);
ShuntLog("分流横移:升降2开始上升 "); ShuntLog("分流横移:升降2开始上升 ");
Shunt_MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(600));
CylinderMove(Shunt_MoveInfo, IO_Type.Shunt_TopCylinder_Down2, IO_Type.Shunt_TopCylinder_Up2); CylinderMove(Shunt_MoveInfo, IO_Type.Shunt_TopCylinder_Down2, IO_Type.Shunt_TopCylinder_Up2);
//Shunt_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Shunt_TopCylinder_Down2, IO_VALUE.LOW)); //Shunt_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Shunt_TopCylinder_Down2, IO_VALUE.LOW));
} }
...@@ -324,7 +326,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -324,7 +326,10 @@ namespace OnlineStore.DeviceLibrary
ShuntLog("分流横移:升降2下降 ,皮带线2停止 "); ShuntLog("分流横移:升降2下降 ,皮带线2停止 ");
CylinderMove(Shunt_MoveInfo, IO_Type.Shunt_TopCylinder_Up1, IO_Type.Shunt_TopCylinder_Down1); CylinderMove(Shunt_MoveInfo, IO_Type.Shunt_TopCylinder_Up1, IO_Type.Shunt_TopCylinder_Down1);
CylinderMove(Shunt_MoveInfo, IO_Type.Shunt_TopCylinder_Up2, IO_Type.Shunt_TopCylinder_Down2); CylinderMove(Shunt_MoveInfo, IO_Type.Shunt_TopCylinder_Up2, IO_Type.Shunt_TopCylinder_Down2);
IOMove(IO_Type.Shunt_MotorRun2, IO_VALUE.LOW); CheckAndMove(IO_Type.Shunt_MotorRun2, IO_VALUE.LOW);
CheckAndMove(IO_Type.Shunt_MotorRun1, IO_VALUE.LOW);
Shunt_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Shunt_MotorRun1, IO_VALUE.LOW));
Shunt_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Shunt_MotorRun2, IO_VALUE.LOW));
} }
} }
else if (Shunt_MoveInfo.MoveStep.Equals(LineMoveStep.Shunt11_TopDown)) else if (Shunt_MoveInfo.MoveStep.Equals(LineMoveStep.Shunt11_TopDown))
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!