Commit e4d29273 顾剑亮

debug

1 个父辈 b91dc470
...@@ -58,13 +58,18 @@ namespace BLL ...@@ -58,13 +58,18 @@ namespace BLL
if (info.StateID == (int)StateID.Pause) if (info.StateID == (int)StateID.Pause)
Common.mir.State_Ready(info.IP, info.Authorization); Common.mir.State_Ready(info.IP, info.Authorization);
position[i] = new PointF(Common.agvInfos[i].Position.X, Common.agvInfos[i].Position.Y);
if (info.CurrentJob == null) if (info.CurrentJob == null)
{
//软件刚打开时,防止有任务在运行
Common.mir.Del_Mission(info.IP, info.Authorization);
info.CurrentJob = new StandbyJob(); info.CurrentJob = new StandbyJob();
}
else else
{
info.CurrentJob = info.CurrentJob.Execute(info); info.CurrentJob = info.CurrentJob.Execute(info);
} }
}
catch (Exception ex) catch (Exception ex)
{ {
Common.log.Error("CallProcess " + info.Name, ex); Common.log.Error("CallProcess " + info.Name, ex);
...@@ -131,32 +136,47 @@ namespace BLL ...@@ -131,32 +136,47 @@ namespace BLL
{ {
for (int i = 0; i < Common.agvInfos.Count; i++) for (int i = 0; i < Common.agvInfos.Count; i++)
{ {
if (Common.agvInfos[i].CurrentJob == null if (Common.agvInfos[i].CurrentJob == null)
|| Common.agvInfos[i].CurrentJob is ChargeJob
|| Common.agvInfos[i].CurrentJob is StandbyJob)
{ {
timeout[i] = DateTime.Now; timeout[i] = DateTime.Now;
continue; continue;
} }
if (Math.Abs(Common.agvInfos[i].Position.X - position[i].X) < 2
&& Math.Abs(Common.agvInfos[i].Position.Y - position[i].Y) < 2)
{
TimeSpan span = DateTime.Now - timeout[i];
if (span.TotalMinutes >= 2)
{
string name = ""; string name = "";
if (Common.agvInfos[i].Name.IndexOf("11") >= 0) if (Common.agvInfos[i].Name.IndexOf("11") >= 0)
name = "11号车"; name = "11号车";
else if (Common.agvInfos[i].Name.IndexOf("13") >= 0) else if (Common.agvInfos[i].Name.IndexOf("13") >= 0)
name = "13号车"; name = "13号车";
string value = string.Format("{0}在{1}停留超时2分钟以上", name, Common.agvInfos[i].Place);
DisplayBoard.Add(name, "lineAgv." + name + ".StandTimeOut", value); if (Math.Abs(Common.agvInfos[i].Position.X - position[i].X) < 2 && Math.Abs(Common.agvInfos[i].Position.Y - position[i].Y) < 2)
{
TimeSpan span = DateTime.Now - timeout[i];
if (span.TotalMinutes >= Common.BoardTimeout)
{
if (Common.agvInfos[i].CurrentJob is ChargeJob)
{
DisplayBoard.Add(name, "lineAgv." + name + ".Place", "AutoCharge", 1);
}
else if (Common.agvInfos[i].CurrentJob is StandbyJob)
{
DisplayBoard.Add(name, "lineAgv." + name + ".Place", "Standby", 1);
}
else
{
string value = string.Format("在{0}停留超时{1:F}分钟", Common.agvInfos[i].Place, span.TotalMinutes);
DisplayBoard.Add(name, "lineAgv." + name + ".StandTimeOut", value, 0);
} }
} }
else else
{ {
DisplayBoard.Add(name, "lineAgv." + name + ".Msg", Common.agvInfos[i].CurrentJob.Msg, 1);
}
}
else
{
DisplayBoard.Add(name, "lineAgv." + name + ".Msg", Common.agvInfos[i].CurrentJob.Msg, 1);
timeout[i] = DateTime.Now; timeout[i] = DateTime.Now;
position[i] = new PointF(Common.agvInfos[i].Position.X, Common.agvInfos[i].Position.Y);
} }
} }
......
...@@ -20,11 +20,20 @@ namespace BLL ...@@ -20,11 +20,20 @@ namespace BLL
public bool IsEnd { get; private set; } public bool IsEnd { get; private set; }
public string Msg
{
get
{
return chargeStep.Msg;
}
}
public IJob Execute(AgvInfo info) public IJob Execute(AgvInfo info)
{ {
_info = info; _info = info;
if (chargeStep.Equals(ChargeStep.None)) if (chargeStep.Equals(ChargeStep.None))
{ {
_info.From = "";
currBattery = _info.Battery; currBattery = _info.Battery;
if (_info.IsWorkspace()) if (_info.IsWorkspace())
MoveCharge(); MoveCharge();
...@@ -77,17 +86,17 @@ namespace BLL ...@@ -77,17 +86,17 @@ namespace BLL
move = new MoveJob(mission); move = new MoveJob(mission);
move.Execute(_info); move.Execute(_info);
chargeStep.NextStep(ChargeStep.MoveStation); chargeStep.NextStep(ChargeStep.MoveStation);
chargeStep.Msg = _info.Name + " 发送任务 " + mission; chargeStep.Msg = _info.Name + " 发送充电任务 " + mission;
} }
private void PassDoor() private void PassDoor()
{ {
mission = Common.MISSION_PASS_DOOR_INTO + _info.Workshop; mission = Common.MISSION_PASS_DOOR_INTO + _info.Workshop;
_info.Place = mission; _info.Place = "Pass Door";
move = new MoveJob(mission); move = new MoveJob(mission);
move.Execute(_info); move.Execute(_info);
chargeStep.NextStep(ChargeStep.PassDoor); chargeStep.NextStep(ChargeStep.PassDoor);
chargeStep.Msg = _info.Name + " 发送任务 " + mission; chargeStep.Msg = _info.Name + " 发送充电任务 " + mission;
} }
private void MoveStation() private void MoveStation()
......
...@@ -20,6 +20,14 @@ namespace BLL ...@@ -20,6 +20,14 @@ namespace BLL
public bool IsEnd { get; private set; } public bool IsEnd { get; private set; }
public string Msg
{
get
{
return moveStep.Msg;
}
}
public IJob Execute(AgvInfo info) public IJob Execute(AgvInfo info)
{ {
_info = info; _info = info;
......
...@@ -19,11 +19,20 @@ namespace BLL ...@@ -19,11 +19,20 @@ namespace BLL
public bool IsEnd { get; private set; } public bool IsEnd { get; private set; }
public string Msg
{
get
{
return sendNewStep.Msg;
}
}
public IJob Execute(AgvInfo info) public IJob Execute(AgvInfo info)
{ {
_info = info; _info = info;
if (sendNewStep.Equals(SendNewStep.None)) if (sendNewStep.Equals(SendNewStep.None))
{ {
_info.From = "";
if (_info.IsWorkspace()) if (_info.IsWorkspace())
sendNewStep.NextStep(SendNewStep.FindLine); sendNewStep.NextStep(SendNewStep.FindLine);
else else
...@@ -83,7 +92,7 @@ namespace BLL ...@@ -83,7 +92,7 @@ namespace BLL
move = new MoveJob(mission); move = new MoveJob(mission);
move.Execute(_info); move.Execute(_info);
sendNewStep.NextStep(SendNewStep.MoveLine); sendNewStep.NextStep(SendNewStep.MoveLine);
sendNewStep.Msg = _info.Name + " 发送任务 " + mission; sendNewStep.Msg = _info.Name + " 发送新钢板任务 " + mission;
} }
private void MoveLine() private void MoveLine()
...@@ -94,11 +103,11 @@ namespace BLL ...@@ -94,11 +103,11 @@ namespace BLL
private void PassDoor() private void PassDoor()
{ {
mission = Common.MISSION_PASS_DOOR_INTO + _info.Workshop; mission = Common.MISSION_PASS_DOOR_INTO + _info.Workshop;
_info.Place = mission; _info.Place = "Pass Door";
move = new MoveJob(mission); move = new MoveJob(mission);
move.Execute(_info); move.Execute(_info);
sendNewStep.NextStep(SendNewStep.PassDoor); sendNewStep.NextStep(SendNewStep.PassDoor);
sendNewStep.Msg = _info.Name + " 发送任务 " + mission; sendNewStep.Msg = _info.Name + " 发送过门任务 " + mission;
} }
private enum SendNewStep private enum SendNewStep
......
...@@ -8,7 +8,7 @@ namespace BLL ...@@ -8,7 +8,7 @@ namespace BLL
private AgvInfo _info; private AgvInfo _info;
private MoveJob move; private MoveJob move;
private string mission; private string mission;
private DateTime _getTime; //private DateTime _getTime;
private JobStep<StandbyStep> standbyStep; private JobStep<StandbyStep> standbyStep;
public StandbyJob() public StandbyJob()
...@@ -19,11 +19,20 @@ namespace BLL ...@@ -19,11 +19,20 @@ namespace BLL
public bool IsEnd { get; private set; } public bool IsEnd { get; private set; }
public string Msg
{
get
{
return standbyStep.Msg;
}
}
public IJob Execute(AgvInfo info) public IJob Execute(AgvInfo info)
{ {
_info = info; _info = info;
if (standbyStep.Equals(StandbyStep.None)) if (standbyStep.Equals(StandbyStep.None))
{ {
_info.From = "";
if (_info.IsWorkspace()) if (_info.IsWorkspace())
MoveStandby(); MoveStandby();
else else
...@@ -42,7 +51,6 @@ namespace BLL ...@@ -42,7 +51,6 @@ namespace BLL
{ {
standbyStep.NextStep(StandbyStep.End); standbyStep.NextStep(StandbyStep.End);
standbyStep.Msg = _info.Name + " 到达待机位"; standbyStep.Msg = _info.Name + " 到达待机位";
_getTime = DateTime.Now;
} }
} }
else if (standbyStep.Equals(StandbyStep.End)) else if (standbyStep.Equals(StandbyStep.End))
...@@ -54,10 +62,9 @@ namespace BLL ...@@ -54,10 +62,9 @@ namespace BLL
} }
else else
{ {
TimeSpan span = DateTime.Now - _getTime; if (_info.Battery <= 80)
if (span.TotalMinutes >= 2)
{ {
standbyStep.Msg = _info.Name + " 在待机位停留超过2分钟,执行充电任务"; standbyStep.Msg = _info.Name + " 电量小于80%,执行充电任务";
return new ChargeJob(); return new ChargeJob();
} }
else else
...@@ -78,17 +85,17 @@ namespace BLL ...@@ -78,17 +85,17 @@ namespace BLL
move = new MoveJob(mission); move = new MoveJob(mission);
move.Execute(_info); move.Execute(_info);
standbyStep.NextStep(StandbyStep.MoveStandby); standbyStep.NextStep(StandbyStep.MoveStandby);
standbyStep.Msg = _info.Name + " 发送任务 " + mission; standbyStep.Msg = _info.Name + " 发送待机位任务 " + mission;
} }
private void PassDoor() private void PassDoor()
{ {
mission = Common.MISSION_PASS_DOOR_INTO + _info.Workshop; mission = Common.MISSION_PASS_DOOR_INTO + _info.Workshop;
_info.Place = mission; _info.Place = "Pass Door";
move = new MoveJob(mission); move = new MoveJob(mission);
move.Execute(_info); move.Execute(_info);
standbyStep.NextStep(StandbyStep.PassDoor); standbyStep.NextStep(StandbyStep.PassDoor);
standbyStep.Msg = _info.Name + " 发送任务 " + mission; standbyStep.Msg = _info.Name + " 发送过门任务 " + mission;
} }
private enum StandbyStep private enum StandbyStep
......
...@@ -20,11 +20,20 @@ namespace BLL ...@@ -20,11 +20,20 @@ namespace BLL
public bool IsEnd { get; private set; } public bool IsEnd { get; private set; }
public string Msg
{
get
{
return storageStep.Msg;
}
}
public IJob Execute(AgvInfo info) public IJob Execute(AgvInfo info)
{ {
_info = info; _info = info;
if (storageStep.Equals(StorageStep.None)) if (storageStep.Equals(StorageStep.None))
{ {
_info.From = "";
if (_info.Is4DWorkshop()) if (_info.Is4DWorkshop())
MoveStorage(); MoveStorage();
else else
...@@ -151,7 +160,7 @@ namespace BLL ...@@ -151,7 +160,7 @@ namespace BLL
private void PassDoor4C() private void PassDoor4C()
{ {
mission = Common.MISSION_PASS_DOOR_4C; mission = Common.MISSION_PASS_DOOR_4C;
_info.Place = mission; _info.Place = "Pass Door";
move = new MoveJob(mission); move = new MoveJob(mission);
move.Execute(_info); move.Execute(_info);
storageStep.NextStep(StorageStep.BackDoor); storageStep.NextStep(StorageStep.BackDoor);
...@@ -161,7 +170,7 @@ namespace BLL ...@@ -161,7 +170,7 @@ namespace BLL
private void PassDoor4D() private void PassDoor4D()
{ {
mission = Common.MISSION_PASS_DOOR_4D; mission = Common.MISSION_PASS_DOOR_4D;
_info.Place = mission; _info.Place = "Pass Door";
move = new MoveJob(mission); move = new MoveJob(mission);
move.Execute(_info); move.Execute(_info);
storageStep.NextStep(StorageStep.PassDoor); storageStep.NextStep(StorageStep.PassDoor);
......
...@@ -15,15 +15,25 @@ namespace BLL ...@@ -15,15 +15,25 @@ namespace BLL
{ {
takeOldStep = new JobStep<TakeOldStep>(TakeOldStep.None); takeOldStep = new JobStep<TakeOldStep>(TakeOldStep.None);
Common.log.Debug("加载TakeOldJob"); Common.log.Debug("加载TakeOldJob");
SteelManage.OldSteelWorkDel();
} }
public bool IsEnd { get; private set; } public bool IsEnd { get; private set; }
public string Msg
{
get
{
return takeOldStep.Msg;
}
}
public IJob Execute(AgvInfo info) public IJob Execute(AgvInfo info)
{ {
_info = info; _info = info;
if (takeOldStep.Equals(TakeOldStep.None)) if (takeOldStep.Equals(TakeOldStep.None))
{ {
_info.From = "";
info.OldSteel = 0; info.OldSteel = 0;
takeOldStep.Msg = info.Name + " 查找回收钢板任务"; takeOldStep.Msg = info.Name + " 查找回收钢板任务";
takeOldStep.NextStep(TakeOldStep.FindLine); takeOldStep.NextStep(TakeOldStep.FindLine);
...@@ -53,12 +63,20 @@ namespace BLL ...@@ -53,12 +63,20 @@ namespace BLL
} }
else if (takeOldStep.Equals(TakeOldStep.GoWashPoint)) else if (takeOldStep.Equals(TakeOldStep.GoWashPoint))
{ {
if (info.OldSteel == 0)
{
takeOldStep.NextStep(TakeOldStep.End);
takeOldStep.Msg = _info.Name + " 回收钢板数量为0,结束任务";
}
else
{
mission = Common.MISSION_MOVE_WASH + _info.Workshop; mission = Common.MISSION_MOVE_WASH + _info.Workshop;
_info.Place = mission; _info.Place = mission;
move = new MoveJob(mission); move = new MoveJob(mission);
move.Execute(_info); move.Execute(_info);
takeOldStep.NextStep(TakeOldStep.WaitWashPoint); takeOldStep.NextStep(TakeOldStep.WaitWashPoint);
takeOldStep.Msg = _info.Name + " 发送任务 " + mission; takeOldStep.Msg = _info.Name + " 发送回收钢板任务 " + mission;
}
} }
else if (takeOldStep.Equals(TakeOldStep.WaitWashPoint)) else if (takeOldStep.Equals(TakeOldStep.WaitWashPoint))
{ {
...@@ -92,7 +110,7 @@ namespace BLL ...@@ -92,7 +110,7 @@ namespace BLL
move = new MoveJob(mission); move = new MoveJob(mission);
move.Execute(_info); move.Execute(_info);
takeOldStep.NextStep(TakeOldStep.MoveLine); takeOldStep.NextStep(TakeOldStep.MoveLine);
takeOldStep.Msg = _info.Name + " 发送任务 " + mission; takeOldStep.Msg = _info.Name + " 发送回收钢板任务 " + mission;
} }
else else
{ {
......
...@@ -18,11 +18,20 @@ namespace BLL ...@@ -18,11 +18,20 @@ namespace BLL
public bool IsEnd { get; private set; } public bool IsEnd { get; private set; }
public string Msg
{
get
{
return washPointStep.Msg;
}
}
public IJob Execute(AgvInfo info) public IJob Execute(AgvInfo info)
{ {
_info = info; _info = info;
if (washPointStep.Equals(WashPointStep.None)) if (washPointStep.Equals(WashPointStep.None))
{ {
_info.From = "";
if (_info.IsWorkspace()) if (_info.IsWorkspace())
MoveWash(); MoveWash();
else else
...@@ -46,6 +55,7 @@ namespace BLL ...@@ -46,6 +55,7 @@ namespace BLL
} }
else if (washPointStep.Equals(WashPointStep.End)) else if (washPointStep.Equals(WashPointStep.End))
{ {
_info.Place = "";
IJob job = SteelManage.GetNewSteelJob(info); IJob job = SteelManage.GetNewSteelJob(info);
if (job == null) if (job == null)
{ {
...@@ -78,7 +88,7 @@ namespace BLL ...@@ -78,7 +88,7 @@ namespace BLL
private void PassDoor() private void PassDoor()
{ {
mission = Common.MISSION_PASS_DOOR_INTO + _info.Workshop; mission = Common.MISSION_PASS_DOOR_INTO + _info.Workshop;
_info.Place = mission; _info.Place = "Pass Door";
move = new MoveJob(mission); move = new MoveJob(mission);
move.Execute(_info); move.Execute(_info);
washPointStep.NextStep(WashPointStep.PassDoor); washPointStep.NextStep(WashPointStep.PassDoor);
......
...@@ -44,6 +44,53 @@ namespace BLL ...@@ -44,6 +44,53 @@ namespace BLL
} }
} }
public static void OldSteelWorkDel()
{
if (!Common.WorkTimeoutDel) return;
int index = 0;
bool remove = false;
while (index < oldSteelWork.Count)
{
TimeSpan span = DateTime.Now - oldSteelWork[index].DateTime;
if (span.TotalMinutes >= Common.WorkTimeout)
{
oldSteelWork.RemoveAt(index);
remove = true;
}
else
{
index++;
}
}
if (remove)
{
SaveOldSteelWork();
Common.log.Info("删除超时" + Common.WorkTimeout + "分钟之前的所有回收钢板任务");
}
}
public static void OldSteelWorkDelAll(string workshop)
{
int lineIdx = Common.agvLines.FindIndex(s => s.Workshop == workshop);
if (lineIdx == -1) return;
int index = 0;
while (index < oldSteelWork.Count)
{
int idx = Array.FindIndex(Common.agvLines[lineIdx].Lines, s => s == oldSteelWork[index].Place);
if (idx > -1)
oldSteelWork.RemoveAt(index);
else
index++;
}
SaveOldSteelWork();
Common.log.Info("删除" + workshop + "所有回收钢板任务");
}
public static void OldSteelWorkDelAll() public static void OldSteelWorkDelAll()
{ {
oldSteelWork.Clear(); oldSteelWork.Clear();
...@@ -148,10 +195,53 @@ namespace BLL ...@@ -148,10 +195,53 @@ namespace BLL
} }
else else
{ {
Common.log.Info("没有找到(" + place + ")送新钢板任务"); Common.log.Info("没有找到(" + from + "," + place + ")送新钢板任务");
}
}
public static void NewSteelWorkDel()
{
if (!Common.WorkTimeoutDel) return;
int index = 0;
bool remove = false;
while (index < newSteelWork.Count)
{
TimeSpan span = DateTime.Now - newSteelWork[index].DateTime;
if (span.TotalMinutes >= Common.WorkTimeout)
{
newSteelWork.RemoveAt(index);
remove = true;
}
else
{
index++;
}
}
if (remove)
{
SaveNewSteelWork();
Common.log.Info("删除超时" + Common.WorkTimeout + "分钟之前的所有送新钢板任务");
} }
} }
public static void NewSteelWorkDelAll(string workshop)
{
int index = 0;
while (index < newSteelWork.Count)
{
int idx = newSteelWork.FindIndex(sw => sw.From == workshop + "WASH");
if (idx > -1)
newSteelWork.RemoveAt(index);
else
index++;
}
SaveNewSteelWork();
Common.log.Info("删除" + workshop + "wash所有送新钢板任务");
}
public static void NewSteelWorkDelAll() public static void NewSteelWorkDelAll()
{ {
newSteelWork.Clear(); newSteelWork.Clear();
...@@ -181,24 +271,50 @@ namespace BLL ...@@ -181,24 +271,50 @@ namespace BLL
public static bool FindNewSteelWork(AgvInfo info, out string place) public static bool FindNewSteelWork(AgvInfo info, out string place)
{ {
place = ""; place = "";
string name = "";
bool find = false;
int lineIdx = Common.agvLines.FindIndex(s => s.Workshop == info.Workshop); int lineIdx = Common.agvLines.FindIndex(s => s.Workshop == info.Workshop);
if (lineIdx == -1) return false; if (lineIdx == -1) return false;
for (int i = 0; i < Common.agvLines[lineIdx].Lines.Length; i++) bool find = false;
for (int i = 0; i < newSteelWork.Count; i++)
{ {
name = Common.agvLines[lineIdx].Lines[i]; if (newSteelWork[i].Place == "STORAGE")
int idx = newSteelWork.FindIndex(s => s.Place == name); {
if (idx > -1) place = newSteelWork[i].Place;
info.From = newSteelWork[i].From;
find = true;
break;
}
else
{ {
int index = Array.FindIndex(Common.agvLines[lineIdx].Lines, s => s == newSteelWork[i].Place);
if (index > -1)
{
place = newSteelWork[i].Place;
info.From = newSteelWork[i].From;
find = true; find = true;
break; break;
} }
} }
}
place = name;
//for (int i = 0; i < Common.agvLines[lineIdx].Lines.Length; i++)
//{
// name = Common.agvLines[lineIdx].Lines[i];
// int idx = newSteelWork.FindIndex(s => s.Place == name);
// if (idx > -1)
// {
// info.From = newSteelWork[idx].From;
// find = true;
// break;
// }
//}
//place = name;
return find; return find;
} }
...@@ -245,6 +361,27 @@ namespace BLL ...@@ -245,6 +361,27 @@ namespace BLL
} }
} }
public static void StorageWorkDelAll(string workshop)
{
int lineIdx = Common.agvLines.FindIndex(s => s.Workshop == workshop);
if (lineIdx == -1) return;
int index = 0;
while (index < storageWork.Count)
{
int idx = Array.FindIndex(Common.agvLines[lineIdx].Lines, s => s == storageWork[index].Place);
if (idx > -1)
storageWork.RemoveAt(index);
else
index++;
}
index = storageWork.FindIndex(sw => sw.Place == workshop + "_ENTER");
if (index > -1) storageWork.RemoveAt(index);
SaveStorageWork();
Common.log.Info("删除" + workshop + "仓库钢板任务");
}
public static void StorageWorkDelAll() public static void StorageWorkDelAll()
{ {
storageWork.Clear(); storageWork.Clear();
...@@ -348,12 +485,12 @@ namespace BLL ...@@ -348,12 +485,12 @@ namespace BLL
rtn = GetWash(info); rtn = GetWash(info);
if (rtn) if (rtn)
{ {
Common.log.Info(info.Workshop + "清洗点呼叫"); Common.log.Info(info.Name + " " + info.Workshop + "清洗点呼叫");
return new WashPointJob(); return new WashPointJob();
} }
else else
{ {
Common.log.Debug("没有找到" + info.Workshop + "清洗点呼叫"); Common.log.Debug(info.Name + " 没有找到" + info.Workshop + "清洗点呼叫");
} }
#endregion #endregion
...@@ -361,12 +498,12 @@ namespace BLL ...@@ -361,12 +498,12 @@ namespace BLL
rtn = GetStorage(info); rtn = GetStorage(info);
if (rtn) if (rtn)
{ {
Common.log.Info("4D仓库呼叫"); Common.log.Info(info.Name + " 4D仓库呼叫");
return new StorageJob(); return new StorageJob();
} }
else else
{ {
Common.log.Debug("没有找到4D仓库呼叫"); Common.log.Debug(info.Name + " 没有找到4D仓库呼叫");
} }
#endregion #endregion
...@@ -374,12 +511,12 @@ namespace BLL ...@@ -374,12 +511,12 @@ namespace BLL
rtn = GetOldSteel(info); rtn = GetOldSteel(info);
if (rtn) if (rtn)
{ {
Common.log.Info(info.Workshop + "回收钢板"); Common.log.Info(info.Name + " " + info.Workshop + "回收钢板");
return new TakeOldJob(); return new TakeOldJob();
} }
else else
{ {
Common.log.Debug("没有找到" + info.Workshop + "回收钢板任务"); Common.log.Debug(info.Name + " 没有找到" + info.Workshop + "回收钢板任务");
} }
#endregion #endregion
...@@ -393,12 +530,12 @@ namespace BLL ...@@ -393,12 +530,12 @@ namespace BLL
bool rtn = GetNewSteel(info); bool rtn = GetNewSteel(info);
if (rtn) if (rtn)
{ {
Common.log.Info(info.Workshop + "送新钢板呼叫"); Common.log.Info(info.Name + " " + info.Workshop + "送新钢板呼叫");
return new SendNewJob(); return new SendNewJob();
} }
else else
{ {
Common.log.Debug("没有找到" + info.Workshop + "送新钢板呼叫"); Common.log.Debug(info.Name + " 没有找到" + info.Workshop + "送新钢板呼叫");
return null; return null;
} }
...@@ -461,6 +598,13 @@ namespace BLL ...@@ -461,6 +598,13 @@ namespace BLL
{ {
if (newSteelWork[i].From == info.From) if (newSteelWork[i].From == info.From)
{ {
if (newSteelWork[i].Place.ToUpper() == "STORAGE")
{
find = true;
break;
}
else
{
int index = Array.FindIndex(Common.agvLines[lineIdx].Lines, s => s == newSteelWork[i].Place); int index = Array.FindIndex(Common.agvLines[lineIdx].Lines, s => s == newSteelWork[i].Place);
if (index > -1) if (index > -1)
{ {
...@@ -469,6 +613,7 @@ namespace BLL ...@@ -469,6 +613,7 @@ namespace BLL
} }
} }
} }
}
return find; return find;
} }
......
...@@ -80,7 +80,7 @@ namespace BLL ...@@ -80,7 +80,7 @@ namespace BLL
} }
else else
{ {
res = new Result { Code = -2, Msg = "Not Find" }; res = new Result { Code = -2, Msg = "Not Find " + place };
Common.log.Info("没有找到" + place); Common.log.Info("没有找到" + place);
} }
} }
...@@ -110,7 +110,7 @@ namespace BLL ...@@ -110,7 +110,7 @@ namespace BLL
} }
else else
{ {
res = new Result { Code = -2, Msg = "Not Find" }; res = new Result { Code = -2, Msg = "Not Find (" + from + "," + place + ")" };
Common.log.Info("没有找到" + place); Common.log.Info("没有找到" + place);
} }
} }
...@@ -158,7 +158,7 @@ namespace BLL ...@@ -158,7 +158,7 @@ namespace BLL
} }
else else
{ {
res = new Result { Code = -2, Msg = "Not Find" }; res = new Result { Code = -2, Msg = "Not Find " + place };
Common.log.Info("没有找到" + place); Common.log.Info("没有找到" + place);
} }
} }
...@@ -185,20 +185,29 @@ namespace BLL ...@@ -185,20 +185,29 @@ namespace BLL
private bool FindLine(string from, string[] place) private bool FindLine(string from, string[] place)
{ {
bool rtn = false; bool rtn = false;
for (int i = 0; i < Common.agvLines.Count; i++) for (int i = 0; i < Common.agvLines.Count; i++)
{ {
if (from == "STORAGE")
rtn = true;
else
rtn = Common.agvLines[i].FindLine(from); rtn = Common.agvLines[i].FindLine(from);
if (rtn) if (!rtn) continue;
{
for (int j = 0; j < place.Length; j++) for (int j = 0; j < place.Length; j++)
{ {
if (place[j].ToUpper() == "STORAGE")
{
rtn = true;
}
else
{
rtn = Common.agvLines[i].FindLine(place[j]); rtn = Common.agvLines[i].FindLine(place[j]);
if (!rtn) return rtn; if (!rtn) break;
} }
return true;
} }
if (rtn) break;
} }
return false; return rtn;
} }
private string FindAgv() private string FindAgv()
......
...@@ -22,6 +22,10 @@ namespace Model ...@@ -22,6 +22,10 @@ namespace Model
//public static string[] PLACE_NAME; //public static string[] PLACE_NAME;
public static bool FLEET_SEND; public static bool FLEET_SEND;
public static string BoardURL; public static string BoardURL;
public static int BoardTimeout;
public static bool WorkTimeoutDel = false;
public static bool WorkAutoDel = false;
public static int WorkTimeout;
public static bool StorageDockFinish = false; //停靠完成 public static bool StorageDockFinish = false; //停靠完成
public static bool StorageDockAlway = false; //指定停靠状态,一直不改变 public static bool StorageDockAlway = false; //指定停靠状态,一直不改变
......
...@@ -6,6 +6,8 @@ namespace Model ...@@ -6,6 +6,8 @@ namespace Model
{ {
public bool IsEnd { get; } public bool IsEnd { get; }
public string Msg { get; }
public IJob Execute(AgvInfo info); public IJob Execute(AgvInfo info);
} }
......
...@@ -17,8 +17,8 @@ D:\Neotel\AGVControl_Steel\Model\bin\Debug\log4net.dll ...@@ -17,8 +17,8 @@ D:\Neotel\AGVControl_Steel\Model\bin\Debug\log4net.dll
D:\Neotel\AGVControl_Steel\Model\bin\Debug\RestSharp.dll D:\Neotel\AGVControl_Steel\Model\bin\Debug\RestSharp.dll
D:\Neotel\AGVControl_Steel\Model\bin\Debug\log4net.xml D:\Neotel\AGVControl_Steel\Model\bin\Debug\log4net.xml
D:\Neotel\AGVControl_Steel\Model\bin\Debug\RestSharp.xml D:\Neotel\AGVControl_Steel\Model\bin\Debug\RestSharp.xml
D:\Neotel\AGVControl_Steel\Model\obj\Debug\Model.csprojAssemblyReference.cache
D:\Neotel\AGVControl_Steel\Model\obj\Debug\Model.csproj.CoreCompileInputs.cache D:\Neotel\AGVControl_Steel\Model\obj\Debug\Model.csproj.CoreCompileInputs.cache
D:\Neotel\AGVControl_Steel\Model\obj\Debug\Model.csproj.CopyComplete D:\Neotel\AGVControl_Steel\Model\obj\Debug\Model.csproj.CopyComplete
D:\Neotel\AGVControl_Steel\Model\obj\Debug\Model.dll D:\Neotel\AGVControl_Steel\Model\obj\Debug\Model.dll
D:\Neotel\AGVControl_Steel\Model\obj\Debug\Model.pdb D:\Neotel\AGVControl_Steel\Model\obj\Debug\Model.pdb
D:\Neotel\AGVControl_Steel\Model\obj\Debug\Model.csprojAssemblyReference.cache
...@@ -9,8 +9,12 @@ ...@@ -9,8 +9,12 @@
<add key="WebService" value="http://10.85.196.40:8089/"/> <add key="WebService" value="http://10.85.196.40:8089/"/>
<!--<add key="WebService" value="http://127.0.0.1:8089/"/>--> <!--<add key="WebService" value="http://127.0.0.1:8089/"/>-->
<add key="Board" value="http://10.85.199.25/myproject/rest/api/qisda/device/updateDeviceAlarmMsg"/> <add key="Board" value="http://10.85.199.25/myproject/rest/api/qisda/device/updateDeviceAlarmMsg"/>
<add key="BoardTimeout" value="3"/>
<add key="AGV_BATTERY_MAX" value="100"/> <add key="AGV_BATTERY_MAX" value="100"/>
<add key="AGV_BATTERY_MIN" value="40"/> <add key="AGV_BATTERY_MIN" value="40"/>
<add key="WorkTimeout" value="10"/>
<add key="WorkTimeoutDel" value="false"/>
<add key="WorkAutoDel" value="false"/>
<add key="11号_4C" value="false"/> <add key="11号_4C" value="false"/>
<add key="13号_4D" value="false"/> <add key="13号_4D" value="false"/>
</appSettings> </appSettings>
......
...@@ -13,7 +13,7 @@ namespace AGVControl_Steel ...@@ -13,7 +13,7 @@ namespace AGVControl_Steel
{ {
public partial class FrmMain : Form public partial class FrmMain : Form
{ {
//private Webs.WebService webService; private bool checkedChange;
private BLL.Control control; private BLL.Control control;
public FrmMain() public FrmMain()
...@@ -43,6 +43,12 @@ namespace AGVControl_Steel ...@@ -43,6 +43,12 @@ namespace AGVControl_Steel
private void FrmMain_Load(object sender, EventArgs e) private void FrmMain_Load(object sender, EventArgs e)
{ {
checkedChange = true;
ChkWorkTimeoutDel.Text = "回收钢板时删除" + Common.WorkTimeout + "min前的任务";
ChkWorkTimeoutDel.Checked = Common.WorkTimeoutDel;
ChkWorkAutoDel.Checked = Common.WorkAutoDel;
checkedChange = false;
Common.log.LogBox = TxtLog; Common.log.LogBox = TxtLog;
Common.lstOldSteel = LstOldSteel; Common.lstOldSteel = LstOldSteel;
Common.lstNewSteel = LstNewSteel; Common.lstNewSteel = LstNewSteel;
...@@ -101,6 +107,13 @@ namespace AGVControl_Steel ...@@ -101,6 +107,13 @@ namespace AGVControl_Steel
Common.appConfig.Save(); Common.appConfig.Save();
System.Configuration.ConfigurationManager.RefreshSection("appSettings"); System.Configuration.ConfigurationManager.RefreshSection("appSettings");
Common.log.Info("手动修改 " + info.Name + " IsUse=" + info.IsAuto); Common.log.Info("手动修改 " + info.Name + " IsUse=" + info.IsAuto);
if (info.IsAuto && Common.WorkAutoDel)
{
BLL.SteelManage.OldSteelWorkDelAll(info.Workshop);
BLL.SteelManage.NewSteelWorkDelAll(info.Workshop);
BLL.SteelManage.StorageWorkDelAll(info.Workshop);
}
} }
else if (e.ColumnIndex == DgvName.Columns.Count - 1) //最后一列,清除任务 else if (e.ColumnIndex == DgvName.Columns.Count - 1) //最后一列,清除任务
{ {
...@@ -302,5 +315,25 @@ namespace AGVControl_Steel ...@@ -302,5 +315,25 @@ namespace AGVControl_Steel
{ {
TxtLog.Text = ""; TxtLog.Text = "";
} }
private void ChkWorkAutoDel_CheckedChanged(object sender, EventArgs e)
{
if (checkedChange) return;
Common.WorkAutoDel = ChkWorkAutoDel.Checked;
Common.appConfig.AppSettings.Settings["WorkAutoDel"].Value = Common.WorkAutoDel.ToString();
Common.appConfig.Save();
System.Configuration.ConfigurationManager.RefreshSection("appSettings");
Common.log.Info("修改WorkAutoDel=" + Common.WorkAutoDel.ToString());
}
private void ChkWorkTimeoutDel_CheckedChanged(object sender, EventArgs e)
{
if (checkedChange) return;
Common.WorkTimeoutDel = ChkWorkTimeoutDel.Checked;
Common.appConfig.AppSettings.Settings["WorkTimeoutDel"].Value = Common.WorkTimeoutDel.ToString();
Common.appConfig.Save();
System.Configuration.ConfigurationManager.RefreshSection("appSettings");
Common.log.Info("修改WorkTimeoutDel=" + Common.WorkTimeoutDel.ToString());
}
} }
} }
...@@ -19,7 +19,7 @@ namespace AGVControl_Steel ...@@ -19,7 +19,7 @@ namespace AGVControl_Steel
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
if (!RunMode()) return; //if (!RunMode()) return;
Common.log = new Log("AGVControl_Steel"); Common.log = new Log("AGVControl_Steel");
Common.log.Info("=====程序开始====="); Common.log.Info("=====程序开始=====");
ReadConfig(); ReadConfig();
...@@ -45,6 +45,10 @@ namespace AGVControl_Steel ...@@ -45,6 +45,10 @@ namespace AGVControl_Steel
Common.appConfig = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None); Common.appConfig = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None);
Common.FLEET_SEND = Convert.ToBoolean(Common.appConfig.AppSettings.Settings["FLEET_Send"].Value); Common.FLEET_SEND = Convert.ToBoolean(Common.appConfig.AppSettings.Settings["FLEET_Send"].Value);
Common.BoardURL = Common.appConfig.AppSettings.Settings["Board"].Value; Common.BoardURL = Common.appConfig.AppSettings.Settings["Board"].Value;
Common.BoardTimeout = Convert.ToInt32(Common.appConfig.AppSettings.Settings["BoardTimeout"].Value);
Common.WorkTimeout = Convert.ToInt32(Common.appConfig.AppSettings.Settings["WorkTimeout"].Value);
Common.WorkTimeoutDel = Convert.ToBoolean(Common.appConfig.AppSettings.Settings["WorkTimeoutDel"].Value);
Common.WorkAutoDel = Convert.ToBoolean(Common.appConfig.AppSettings.Settings["WorkAutoDel"].Value);
Common.mir = new MiR_API { FleetIP = Common.appConfig.AppSettings.Settings["FLEET_IP"].Value }; //asa Common.mir = new MiR_API { FleetIP = Common.appConfig.AppSettings.Settings["FLEET_IP"].Value }; //asa
ReadAgvInfo(); ReadAgvInfo();
ReadAgvMission(); ReadAgvMission();
......
...@@ -32,5 +32,5 @@ using System.Runtime.InteropServices; ...@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示: //通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.2.0.0")]
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<configuration> <configuration>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup> </startup>
<appSettings> <appSettings>
<add key="FLEET_IP" value="10.85.199.3"/> <add key="FLEET_IP" value="10.85.199.3" />
<add key="FLEET_Send" value="true"/> <add key="FLEET_Send" value="true" />
<add key="WebService" value="http://10.85.196.40:8089/"/> <add key="WebService" value="http://10.85.196.40:8089/" />
<!--<add key="WebService" value="http://127.0.0.1:8089/"/>--> <add key="Board" value="http://10.85.199.25/myproject/rest/api/qisda/device/updateDeviceAlarmMsg" />
<add key="Board" value="http://10.85.199.25/myproject/rest/api/qisda/device/updateDeviceAlarmMsg"/> <add key="BoardTimeout" value="3" />
<add key="AGV_BATTERY_MAX" value="100"/> <add key="AGV_BATTERY_MAX" value="100" />
<add key="AGV_BATTERY_MIN" value="40"/> <add key="AGV_BATTERY_MIN" value="40" />
<add key="11号_4C" value="false"/> <add key="WorkTimeout" value="10" />
<add key="13号_4D" value="false"/> <add key="WorkTimeoutDel" value="False" />
<add key="WorkAutoDel" value="False" />
<add key="11号_4C" value="false" />
<add key="13号_4D" value="false" />
</appSettings> </appSettings>
</configuration> </configuration>
\ No newline at end of file \ No newline at end of file
此文件类型无法预览
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!