Commit 5351dd2b 张东亮

上报失败重发-一楼成品问题优化

1 个父辈 809db973
using log4net.Config; using Common;
using log4net.Util.TypeConverters;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Common;
using System.Windows.Forms;
using DeviceLibrary; using DeviceLibrary;
using DeviceLibrary.manager; using DeviceLibrary.manager;
using log4net.Config;
using System;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Windows.Forms;
using static System.Net.Mime.MediaTypeNames;
using Application = System.Windows.Forms.Application;
namespace AGVControl namespace AGVControl
{ {
......
using System; using System;
using System.IO; using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Collections;
using System.Net; using System.Net;
using System.Net.Security; using System.Net.Security;
using System.Security; using System.Text;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Reflection;
using System.Net.NetworkInformation;
namespace Common namespace Common
{ {
...@@ -193,7 +184,7 @@ namespace Common ...@@ -193,7 +184,7 @@ namespace Common
{ {
try try
{ {
var wc = new WebClient { Encoding = encoding }; var wc = new MyWebClient(10000) { 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))
{ {
......
...@@ -408,7 +408,7 @@ namespace DeviceLibrary.bean.job ...@@ -408,7 +408,7 @@ namespace DeviceLibrary.bean.job
JobRunStep.Msg = runInfo; JobRunStep.Msg = runInfo;
ToTakeShelfOff(agv, $"{JobParam.LiftStatus.destinationPoint}"); ToTakeShelfOff(agv, $"{JobParam.LiftStatus.destinationPoint}");
} }
else if (JobRunStep.IsTimeOut(0.5, out double val)) else if (JobRunStep.IsTimeOut(0.5, out _))
{ {
//AGV离开 //AGV离开
LiftContext.AGVLeave(JobParam.CurTargetNode.Name, agv, false); LiftContext.AGVLeave(JobParam.CurTargetNode.Name, agv, false);
...@@ -643,6 +643,8 @@ namespace DeviceLibrary.bean.job ...@@ -643,6 +643,8 @@ namespace DeviceLibrary.bean.job
//任务状态变更 //任务状态变更
MissionManager.SetMissionState(missionInfo.missionId, service.model.MissionState.返回电梯, out string msg); MissionManager.SetMissionState(missionInfo.missionId, service.model.MissionState.返回电梯, out string msg);
} }
//设置电梯占用
LiftContext.SetLiftNodeOccupied(agv, SettingString.LIFT_C1);
d2ToLiftC1Job.AllocateTask(agv, $"{SettingString.LIFT_C1}"); d2ToLiftC1Job.AllocateTask(agv, $"{SettingString.LIFT_C1}");
JobRunStep.EndJob(); JobRunStep.EndJob();
return d2ToLiftC1Job; return d2ToLiftC1Job;
......
...@@ -462,7 +462,7 @@ namespace DeviceLibrary.bean.job ...@@ -462,7 +462,7 @@ namespace DeviceLibrary.bean.job
ToTmp2PutOn(agv, JobParam.CurTargetNode.Name); ToTmp2PutOn(agv, JobParam.CurTargetNode.Name);
//AllocateTask(agv, $"{JobParam.CurTargetNode.Name}_{SettingString.Temp2}_{SettingString.PutShelfOn}"); //AllocateTask(agv, $"{JobParam.CurTargetNode.Name}_{SettingString.Temp2}_{SettingString.PutShelfOn}");
} }
else if (JobRunStep.IsTimeOut(0.5, out double val)) else if (JobRunStep.IsTimeOut(0.5, out _))
{ {
//AGV离开 //AGV离开
lift.LiftContext.AGVLeave(JobParam.CurTargetNode.Name, agv, true); lift.LiftContext.AGVLeave(JobParam.CurTargetNode.Name, agv, true);
...@@ -511,6 +511,8 @@ namespace DeviceLibrary.bean.job ...@@ -511,6 +511,8 @@ namespace DeviceLibrary.bean.job
//任务状态变更 //任务状态变更
MissionManager.SetMissionState(missionInfo.missionId, service.model.MissionState.送料, out string msg); MissionManager.SetMissionState(missionInfo.missionId, service.model.MissionState.送料, out string msg);
} }
//设置电梯占用
LiftContext.SetLiftNodeOccupied(agv, SettingString.LIFT_D2);
c1ToLiftD2Job.AllocateTask(agv, $"{SettingString.LIFT_D2}"); c1ToLiftD2Job.AllocateTask(agv, $"{SettingString.LIFT_D2}");
JobRunStep.EndJob(); JobRunStep.EndJob();
return c1ToLiftD2Job; return c1ToLiftD2Job;
......
...@@ -231,7 +231,7 @@ namespace DeviceLibrary ...@@ -231,7 +231,7 @@ namespace DeviceLibrary
//报警,$"等待{JobParam.CurTargetNode.AliceName}的人员确认超时{timeoutval}分" //报警,$"等待{JobParam.CurTargetNode.AliceName}的人员确认超时{timeoutval}分"
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId, manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.error, agv.Name, JobParam.CurTargetNode.Name, service.model.TransportStatus.ModeStr.agvButton, service.model.TransportStatus.TypeStr.error, agv.Name, JobParam.CurTargetNode.Name, service.model.TransportStatus.ModeStr.agvButton,
$"等待{JobParam.CurTargetNode.Name}确认超时{timeoutval}分")); $"等待{JobParam.CurTargetNode.Name}确认超时{timeoutval.ToString("f2")}分"),true);
} }
} }
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_10_CheckNextLine)) else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_10_CheckNextLine))
......
...@@ -117,7 +117,7 @@ namespace DeviceLibrary.bean.job ...@@ -117,7 +117,7 @@ namespace DeviceLibrary.bean.job
//报警,$"等待{JobParam.CurTargetNode.AliceName}的人员确认超时{timeoutval}分" //报警,$"等待{JobParam.CurTargetNode.AliceName}的人员确认超时{timeoutval}分"
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId, manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.error, agv.Name, agv.Place.Name, service.model.TransportStatus.ModeStr.agvButton, service.model.TransportStatus.TypeStr.error, agv.Name, agv.Place.Name, service.model.TransportStatus.ModeStr.agvButton,
$"等待{ JobParam.CurTargetNode.Name }确认超时{timeoutval}分")); $"等待{ JobParam.CurTargetNode.Name }确认超时{timeoutval.ToString("f2")}分"),true);
} }
} }
else if (JobRunStep.IsStep(RunStep.SD_Line_OneToMany_06_CheckNextLine)) else if (JobRunStep.IsStep(RunStep.SD_Line_OneToMany_06_CheckNextLine))
......
...@@ -111,7 +111,7 @@ namespace DeviceLibrary.bean.job ...@@ -111,7 +111,7 @@ namespace DeviceLibrary.bean.job
//报警,$"等待{JobParam.CurTargetNode.AliceName}的人员确认超时{timeoutval}分" //报警,$"等待{JobParam.CurTargetNode.AliceName}的人员确认超时{timeoutval}分"
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId, manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.error, agv.Name, agv.Place.Name, service.model.TransportStatus.ModeStr.agvButton, service.model.TransportStatus.TypeStr.error, agv.Name, agv.Place.Name, service.model.TransportStatus.ModeStr.agvButton,
$"等待{ JobParam.CurTargetNode.Name }确认超时{timeoutval}分")); $"等待{ JobParam.CurTargetNode.Name }确认超时{timeoutval.ToString("f2")}分"), true);
} }
} }
} }
......
...@@ -176,7 +176,7 @@ namespace DeviceLibrary.bean.job ...@@ -176,7 +176,7 @@ namespace DeviceLibrary.bean.job
//报警,$"等待{JobParam.CurTargetNode.AliceName}的人员确认超时{timeoutval}分" //报警,$"等待{JobParam.CurTargetNode.AliceName}的人员确认超时{timeoutval}分"
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId, manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.error, agv.Name, JobParam.CurTargetNode.Name, service.model.TransportStatus.ModeStr.agvButton, service.model.TransportStatus.TypeStr.error, agv.Name, JobParam.CurTargetNode.Name, service.model.TransportStatus.ModeStr.agvButton,
$"等待{JobParam.CurTargetNode.Name}确认超时{timeoutval}分")); $"等待{JobParam.CurTargetNode.Name}确认超时{timeoutval.ToString("f2")}分"), true);
} }
} }
else if (JobRunStep.IsStep(RunStep.Steel_LiftToLine_10_CheckNextLine)) else if (JobRunStep.IsStep(RunStep.Steel_LiftToLine_10_CheckNextLine))
......
...@@ -170,7 +170,7 @@ namespace DeviceLibrary.bean.job ...@@ -170,7 +170,7 @@ namespace DeviceLibrary.bean.job
//报警,$"等待{JobParam.CurTargetNode.AliceName}的人员确认超时{timeoutval}分" //报警,$"等待{JobParam.CurTargetNode.AliceName}的人员确认超时{timeoutval}分"
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId, manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.error, agv.Name, JobParam.CurTargetNode.Name, service.model.TransportStatus.ModeStr.agvButton, service.model.TransportStatus.TypeStr.error, agv.Name, JobParam.CurTargetNode.Name, service.model.TransportStatus.ModeStr.agvButton,
$"等待{JobParam.CurTargetNode.Name}确认超时{timeoutval}分")); $"等待{JobParam.CurTargetNode.Name}确认超时{timeoutval.ToString("f2")}分"), true);
} }
} }
else if (JobRunStep.IsStep(RunStep.Steel_LiftToLine_10_CheckNextLine)) else if (JobRunStep.IsStep(RunStep.Steel_LiftToLine_10_CheckNextLine))
...@@ -454,7 +454,7 @@ namespace DeviceLibrary.bean.job ...@@ -454,7 +454,7 @@ namespace DeviceLibrary.bean.job
runInfo = $"{JobName}结束:{JobParam.SrcNode.AliceName}已关门"; runInfo = $"{JobName}结束:{JobParam.SrcNode.AliceName}已关门";
JobRunStep.Msg = runInfo; JobRunStep.Msg = runInfo;
} }
else if (JobRunStep.IsTimeOut(0.5, out double time)) else if (JobRunStep.IsTimeOut(0.5, out _))
{ {
lift.LiftContext.AGVLeave(JobParam.SrcNode.Name, agv); lift.LiftContext.AGVLeave(JobParam.SrcNode.Name, agv);
System.Threading.Thread.Sleep(1000); System.Threading.Thread.Sleep(1000);
......
...@@ -115,7 +115,7 @@ namespace DeviceLibrary ...@@ -115,7 +115,7 @@ namespace DeviceLibrary
//报警,$"等待{JobParam.CurTargetNode.AliceName}的人员确认超时{timeoutval}分" //报警,$"等待{JobParam.CurTargetNode.AliceName}的人员确认超时{timeoutval}分"
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId, manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.error, agv.Name, agv.Place.Name, service.model.TransportStatus.ModeStr.agvButton, service.model.TransportStatus.TypeStr.error, agv.Name, agv.Place.Name, service.model.TransportStatus.ModeStr.agvButton,
$"等待{JobParam.SrcNode.Name}确认超时{timeoutval}分")); $"等待{JobParam.SrcNode.Name}确认超时{timeoutval.ToString("f2")}分"),true);
} }
} }
else if (JobRunStep.IsStep(RunStep.LineToLift_WaitConfirm)) else if (JobRunStep.IsStep(RunStep.LineToLift_WaitConfirm))
......
...@@ -70,7 +70,7 @@ namespace DeviceLibrary ...@@ -70,7 +70,7 @@ namespace DeviceLibrary
} }
LiftContext.SetLiftNodeOccupied(agv, liftname); LiftContext.SetLiftNodeOccupied(agv, liftname);
MissionManager.SetMissionOccupied(missionInfo, agv); MissionManager.SetMissionOccupied(missionInfo, agv);
MissionManager.Log.Info($"执行任务[{agv.Name}][目的地] {JsonHelper.SerializeObject(missionInfo)}"); MissionManager.Log.Info($"执行任务[{agv.Name}][LiftToLinesJobType] {JsonHelper.SerializeObject(missionInfo)}");
return new LiftToLinesJob(jobParam); return new LiftToLinesJob(jobParam);
} }
} }
......
...@@ -209,6 +209,8 @@ namespace DeviceLibrary ...@@ -209,6 +209,8 @@ namespace DeviceLibrary
if (agv.CurJob != null && (agv.CurJob is StandyJob || agv.CurJob is ChargeJob)) if (agv.CurJob != null && (agv.CurJob is StandyJob || agv.CurJob is ChargeJob))
{ {
agv.CurJob = null; agv.CurJob = null;
agv.JobContext = new JobContext();
continue;
} }
LogUtil.info($"读取并使用{agv.Name}上下文信息:{JsonHelper.SerializeObject(info)}"); LogUtil.info($"读取并使用{agv.Name}上下文信息:{JsonHelper.SerializeObject(info)}");
} }
......
...@@ -478,16 +478,17 @@ namespace DeviceLibrary ...@@ -478,16 +478,17 @@ namespace DeviceLibrary
/// </summary> /// </summary>
/// <param name="send"></param> /// <param name="send"></param>
/// <returns></returns> /// <returns></returns>
public static void UpdateAGVtranstask(string txt) public static void UpdateAGVtranstask(string txt,bool isError=false)
{
try
{ {
Task.Factory.StartNew(() => Task.Factory.StartNew(() =>
{ {
try
{
Dictionary<string, string> param = new Dictionary<string, string>(); Dictionary<string, string> param = new Dictionary<string, string>();
param.Add("info", txt); param.Add("info", txt);
string addr = GetItsAddr("/UpdateAGVtranstask", param); string addr = GetItsAddr("/UpdateAGVtranstask", param);
while (true) while (!isError)
{ {
string resultStr = HttpHelper.Get(addr); string resultStr = HttpHelper.Get(addr);
itsData data = JsonHelper.DeserializeJsonToObject<itsData>(resultStr); itsData data = JsonHelper.DeserializeJsonToObject<itsData>(resultStr);
...@@ -501,17 +502,17 @@ namespace DeviceLibrary ...@@ -501,17 +502,17 @@ namespace DeviceLibrary
log.Info($"上报任务执行信息成功:[{txt}][{resultStr}]"); log.Info($"上报任务执行信息成功:[{txt}][{resultStr}]");
break; break;
} }
Thread.Sleep(1000); Task.Delay(1000);
} }
});
} }
catch (Exception e) catch (Exception e)
{ {
log.Error("UpdateAGVtranstask", e); log.Error("UpdateAGVtranstask", e);
} }
} }
);
}
#endregion #endregion
} }
public class StatusResult public class StatusResult
......
...@@ -41,8 +41,8 @@ namespace DeviceLibrary.manager ...@@ -41,8 +41,8 @@ namespace DeviceLibrary.manager
agvState.state = "故障中"; agvState.state = "故障中";
if (item.Errors != null && item.Errors.Count > 0) if (item.Errors != null && item.Errors.Count > 0)
{ {
string tmp= string.Join(";", item.Errors); string tmp = string.Join(";", item.Errors);
if(!tmp.Equals(errstring)) if (!tmp.Equals(errstring))
{ {
Common.LogUtil.error(tmp); Common.LogUtil.error(tmp);
errstring = tmp; errstring = tmp;
...@@ -93,23 +93,18 @@ namespace DeviceLibrary.manager ...@@ -93,23 +93,18 @@ namespace DeviceLibrary.manager
/// 运输状态上报 /// 运输状态上报
/// </summary> /// </summary>
/// <param name="transportStatus"></param> /// <param name="transportStatus"></param>
public static void UploadTransportStatus(service.model.TransportStatus transportStatus) public static void UploadTransportStatus(service.model.TransportStatus transportStatus,bool iserror=false)
{
Task.Factory.StartNew(() =>
{ {
try try
{ {
string txt = Common.JsonHelper.SerializeObject(transportStatus); string txt = Common.JsonHelper.SerializeObject(transportStatus);
//Common.LogUtil.info($"运输状态上报{txt}"); HttpManager.UpdateAGVtranstask(txt, iserror);
HttpManager.UpdateAGVtranstask(txt);
} }
catch (Exception ex) catch (Exception ex)
{ {
Common.LogUtil.error($"UploadTransportStatus:{Common.JsonHelper.SerializeObject(transportStatus)}", ex); Common.LogUtil.error($"UploadTransportStatus:{Common.JsonHelper.SerializeObject(transportStatus)}", ex);
} }
});
} }
#endregion #endregion
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!