Commit 7f22012e 顾剑亮

debug

1 个父辈 e4d29273
正在显示 40 个修改的文件 包含 338 行增加214 行删除
b7ce55f3eb8a41195dbd285ef65f42aa74fe3fdd
efce7a7e15002dab6df048e19122b7243d3113b0
......@@ -25,3 +25,16 @@ D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.csp
D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.exe
D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.pdb
D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.csprojAssemblyReference.cache
D:\Neotel\AGVControl_Steel\AGVControl_Steel\bin\Debug\AGVControl_Steel.exe.config
D:\Neotel\AGVControl_Steel\AGVControl_Steel\bin\Debug\AGVControl_Steel.exe
D:\Neotel\AGVControl_Steel\AGVControl_Steel\bin\Debug\AGVControl_Steel.pdb
D:\Neotel\AGVControl_Steel\AGVControl_Steel\bin\Debug\ClassFormParent.dll
D:\Neotel\AGVControl_Steel\AGVControl_Steel\bin\Debug\ClassFormParent.pdb
D:\Neotel\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.csprojAssemblyReference.cache
D:\Neotel\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.FrmMain.resources
D:\Neotel\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.Properties.Resources.resources
D:\Neotel\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.csproj.GenerateResource.cache
D:\Neotel\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.csproj.CoreCompileInputs.cache
D:\Neotel\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.csproj.CopyComplete
D:\Neotel\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.exe
D:\Neotel\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.pdb
......@@ -9,8 +9,8 @@ namespace BLL
private MoveJob move;
private string mission;
private JobStep<ChargeStep> chargeStep;
private int currBattery;
//private const int CHARGE_PLACE_PLC = 20;
//private int currBattery;
private const int CHARGE_PLC = 20;
public ChargeJob()
{
......@@ -34,7 +34,8 @@ namespace BLL
if (chargeStep.Equals(ChargeStep.None))
{
_info.From = "";
currBattery = _info.Battery;
_info.Place = "";
//currBattery = _info.Battery;
if (_info.IsWorkspace())
MoveCharge();
else
......@@ -48,12 +49,14 @@ namespace BLL
}
else if (chargeStep.Equals(ChargeStep.MoveStation))
{
move.Execute(_info);
MoveStation();
}
else if (chargeStep.Equals(ChargeStep.Charging))
{
Common.log.Debug(_info.Name + " 当前电量" + _info.Battery);
move.Execute(_info);
if (_info.Battery == _info.BatteryMax)
{
chargeStep.Msg = _info.Name + " 电量达到" + _info.BatteryMax;
......@@ -71,6 +74,7 @@ namespace BLL
}
else if (chargeStep.Equals(ChargeStep.End))
{
_info.Place = "充电结束";
Common.mir.Del_Mission(_info.IP, _info.Authorization);
chargeStep.Msg = _info.Name + " 充电工作结束,回待机位";
return new StandbyJob();
......@@ -82,7 +86,7 @@ namespace BLL
private void MoveCharge()
{
mission = Common.MISSION_CHARGE + _info.Workshop;
_info.Place = mission;
_info.Place = "去充电位";
move = new MoveJob(mission);
move.Execute(_info);
chargeStep.NextStep(ChargeStep.MoveStation);
......@@ -92,21 +96,32 @@ namespace BLL
private void PassDoor()
{
mission = Common.MISSION_PASS_DOOR_INTO + _info.Workshop;
_info.Place = "Pass Door";
_info.Place = string.Format("去{0}车间", _info.Workshop);
move = new MoveJob(mission);
move.Execute(_info);
chargeStep.NextStep(ChargeStep.PassDoor);
chargeStep.Msg = _info.Name + " 发送充电任务 " + mission;
chargeStep.Msg = _info.Name + " 发送过车间门任务 " + mission;
}
private void MoveStation()
{
if (_info.Battery > currBattery)
//if (_info.Battery > currBattery)
//{
// chargeStep.Msg = _info.Name + " 到达充电位,准备充电";
// chargeStep.NextStep(ChargeStep.Charging);
//}
bool rtn = Common.mir.Get_Register(_info.IP, _info.Authorization, CHARGE_PLC, out int value);
if (rtn)
{
if (value == 1)
{
_info.Place = "充电中";
chargeStep.Msg = _info.Name + " 到达充电位,准备充电";
chargeStep.NextStep(ChargeStep.Charging);
}
}
}
private enum ChargeStep
{
......
......@@ -68,9 +68,9 @@ namespace BLL
private void Working()
{
TimeSpan span = DateTime.Now - _getTime;
if (span.TotalMilliseconds > 5000)
{
//TimeSpan span = DateTime.Now - _getTime;
//if (span.TotalMilliseconds > 5000)
//{
bool rtn;
string state;
if (Common.FLEET_SEND)
......@@ -91,13 +91,14 @@ namespace BLL
{
Common.log.Warn("MoveJob To:" + _info.Name + ", " + _mission + " 获取状态失败");
}
}
//}
}
private void Error()
{
Common.log.Debug("MoveJob To:" + _info.Name + ", " + _mission + " 重新发送");
Common.mir.Clear_Error(_info.IP, _info.Authorization);
System.Threading.Thread.Sleep(100);
Common.mir.Del_Mission(_info.IP, _info.Authorization);
moveStep.NextStep(MoveStep.Send);
}
......
......@@ -32,7 +32,7 @@ namespace BLL
_info = info;
if (sendNewStep.Equals(SendNewStep.None))
{
_info.From = "";
_info.Place = "";
if (_info.IsWorkspace())
sendNewStep.NextStep(SendNewStep.FindLine);
else
......@@ -43,7 +43,6 @@ namespace BLL
move.Execute(_info);
if (move.IsEnd)
{
sendNewStep.Msg = _info.Name + " 完成过门";
sendNewStep.NextStep(SendNewStep.FindLine);
}
}
......@@ -53,15 +52,19 @@ namespace BLL
if (rtn)
{
if (place == "STORAGE")
{
SteelManage.NewSteelWorkDel(_info.From, place);
return new StorageJob();
}
else
{
FindLine(place);
}
}
else
{
_info.Place = "";
sendNewStep.Msg = info.Name + " 没有后续新钢板任务";
sendNewStep.NextStep(SendNewStep.End);
sendNewStep.NextStep(SendNewStep.GoWashPoint);
}
}
else if (sendNewStep.Equals(SendNewStep.MoveLine))
......@@ -74,6 +77,25 @@ namespace BLL
sendNewStep.NextStep(SendNewStep.FindLine);
}
}
else if (sendNewStep.Equals(SendNewStep.GoWashPoint))
{
mission = Common.MISSION_MOVE_WASH + _info.Workshop;
_info.Place = string.Format("去{0}清洗点", _info.Workshop);
move = new MoveJob(mission);
move.Execute(_info);
sendNewStep.NextStep(SendNewStep.WaitWashPoint);
sendNewStep.Msg = _info.Name + " 发送回清洗点任务 " + mission;
}
else if (sendNewStep.Equals(SendNewStep.WaitWashPoint))
{
move.Execute(_info);
if (move.IsEnd)
{
_info.Place = "";
sendNewStep.NextStep(SendNewStep.End);
sendNewStep.Msg = _info.Name + " 到达" + _info.Workshop + "清洗点";
}
}
else if (sendNewStep.Equals(SendNewStep.End))
{
IJob job = SteelManage.GetSteelJob(info);
......@@ -95,19 +117,14 @@ namespace BLL
sendNewStep.Msg = _info.Name + " 发送新钢板任务 " + mission;
}
private void MoveLine()
{
}
private void PassDoor()
{
mission = Common.MISSION_PASS_DOOR_INTO + _info.Workshop;
_info.Place = "Pass Door";
_info.Place = string.Format("去{0}车间", _info.Workshop);
move = new MoveJob(mission);
move.Execute(_info);
sendNewStep.NextStep(SendNewStep.PassDoor);
sendNewStep.Msg = _info.Name + " 发送过门任务 " + mission;
sendNewStep.Msg = _info.Name + " 发送过车间门任务 " + mission;
}
private enum SendNewStep
......@@ -116,7 +133,9 @@ namespace BLL
End,
PassDoor,
FindLine,
MoveLine
MoveLine,
GoWashPoint,
WaitWashPoint
}
}
}
......@@ -33,6 +33,7 @@ namespace BLL
if (standbyStep.Equals(StandbyStep.None))
{
_info.From = "";
_info.Place = "";
if (_info.IsWorkspace())
MoveStandby();
else
......@@ -49,6 +50,7 @@ namespace BLL
move.Execute(_info);
if (move.IsEnd)
{
_info.Place = "待机位";
standbyStep.NextStep(StandbyStep.End);
standbyStep.Msg = _info.Name + " 到达待机位";
}
......@@ -62,16 +64,31 @@ namespace BLL
}
else
{
//if (_info.Battery <= 80)
//{
// standbyStep.Msg = _info.Name + " 电量小于80%,执行充电任务";
// return new ChargeJob();
//}
//else
//{
// IJob job = SteelManage.GetSteelJob(info);
// if (job != null) return job;
//}
IJob job = SteelManage.GetSteelJob(info);
if (job == null)
{
if (_info.Battery <= 80)
{
standbyStep.Msg = _info.Name + " 电量小于80%,执行充电任务";
standbyStep.Msg = string.Format("{0} 当前电量{1}%,电量小于80%,执行充电任务", _info.Name, _info.Battery);
return new ChargeJob();
}
}
else
{
IJob job = SteelManage.GetSteelJob(info);
if (job != null) return job;
return job;
}
}
}
......@@ -81,7 +98,7 @@ namespace BLL
private void MoveStandby()
{
mission = Common.MISSION_STANDBY + _info.Workshop;
_info.Place = mission;
_info.Place = "去待机位";
move = new MoveJob(mission);
move.Execute(_info);
standbyStep.NextStep(StandbyStep.MoveStandby);
......@@ -91,11 +108,11 @@ namespace BLL
private void PassDoor()
{
mission = Common.MISSION_PASS_DOOR_INTO + _info.Workshop;
_info.Place = "Pass Door";
_info.Place = string.Format("去{0}车间", _info.Workshop);
move = new MoveJob(mission);
move.Execute(_info);
standbyStep.NextStep(StandbyStep.PassDoor);
standbyStep.Msg = _info.Name + " 发送过门任务 " + mission;
standbyStep.Msg = _info.Name + " 发送过车间门任务 " + mission;
}
private enum StandbyStep
......
......@@ -33,7 +33,9 @@ namespace BLL
_info = info;
if (storageStep.Equals(StorageStep.None))
{
_info.From = "";
_info.From = "STORAGE";
_info.Place = "";
dockTime = 0;
if (_info.Is4DWorkshop())
MoveStorage();
else
......@@ -50,18 +52,18 @@ namespace BLL
move.Execute(_info);
if (move.IsEnd)
{
delayGetSignal = 0;
_info.Place = "到达仓库";
storageStep.Msg = info.Name + " 已到位,等待对接信号";
storageStep.NextStep(StorageStep.GetSingle);
delayGetSignal = 0;
dockTime = 0;
}
}
else if (storageStep.Equals(StorageStep.GetSingle))
{
if (Common.StorageDockAlway || Common.StorageDockFinish)
{
SteelManage.StorageWorkDel(_info.Place);
SteelManage.StorageWorkDel(_info.Workshop + "_ENTER");
SteelManage.StorageWorkDelLeave();
storageStep.Msg = info.Name + " 等待离开信号";
storageStep.NextStep(StorageStep.WaitStorageLeave);
}
......@@ -93,55 +95,83 @@ namespace BLL
SteelManage.StorageWorkDelLeave();
storageStep.Msg = info.Name + " 收到离开信号";
if (SteelManage.FindStorageWork(info))
{
if (_info.IsWorkspace())
{
storageStep.NextStep(StorageStep.FindLine);
}
storageStep.NextStep(StorageStep.End);
else
{
PassDoor4C();
}
}
else
return new StandbyJob();
//if (SteelManage.FindStorageWork(info))
//{
// if (_info.IsWorkspace())
// {
// storageStep.NextStep(StorageStep.FindLine);
// }
// else
// {
// PassDoor4C();
// }
//}
//else
// return new StandbyJob();
}
}
else if (storageStep.Equals(StorageStep.BackDoor))
{
move.Execute(_info);
if (move.IsEnd)
storageStep.NextStep(StorageStep.FindLine);
}
else if (storageStep.Equals(StorageStep.FindLine))
storageStep.NextStep(StorageStep.End);
}
//else if (storageStep.Equals(StorageStep.FindLine))
//{
// bool rtn = SteelManage.FindStorageWork(_info, out string place);
// if (rtn)
// {
// FindLine(place);
// }
// else
// {
// storageStep.Msg = info.Name + " 没有后续新钢板任务";
// return new StandbyJob();
// }
//}
//else if (storageStep.Equals(StorageStep.MoveLine))
//{
// move.Execute(_info);
// if (move.IsEnd)
// {
// SteelManage.NewSteelWorkDel(_info.From, _info.Place);
// storageStep.Msg = _info.Name + " 到达 " + _info.Place;
// storageStep.NextStep(StorageStep.FindLine);
// }
//}
else if (storageStep.Equals(StorageStep.Error))
{
bool rtn = SteelManage.FindStorageWork(_info, out string place);
if (rtn)
if (SteelManage.FindStorageWorkLeave())
{
FindLine(place);
}
SteelManage.StorageWorkDelLeave();
storageStep.Msg = info.Name + " 收到离开信号";
if (_info.IsWorkspace())
storageStep.NextStep(StorageStep.End);
else
{
storageStep.Msg = info.Name + " 没有后续新钢板任务";
return new StandbyJob();
PassDoor4C();
}
}
else if (storageStep.Equals(StorageStep.MoveLine))
else if (storageStep.Equals(StorageStep.End))
{
move.Execute(_info);
if (move.IsEnd)
//IsEnd = true;
//return new SendNewJob();
_info.Place = "";
IJob job = SteelManage.GetNewSteelJob(info);
if (job == null)
{
SteelManage.StorageWorkDel(_info.Place);
storageStep.Msg = _info.Name + " 到达 " + _info.Place;
storageStep.NextStep(StorageStep.FindLine);
}
return new StandbyJob();
}
else if (storageStep.Equals(StorageStep.Error))
else
{
return job;
}
else if (storageStep.Equals(StorageStep.End))
{
}
return this;
......@@ -150,31 +180,31 @@ namespace BLL
private void MoveStorage()
{
mission = Common.MISSION_MOVE_STORAGE;
_info.Place = _info.Workshop + "_ENTER";
_info.Place = "去仓库";
move = new MoveJob(mission);
move.Execute(_info);
storageStep.NextStep(StorageStep.MoveStorage);
storageStep.Msg = _info.Name + " 发送任务 " + mission;
storageStep.Msg = _info.Name + " 发送去仓库任务 " + mission;
}
private void PassDoor4C()
{
mission = Common.MISSION_PASS_DOOR_4C;
_info.Place = "Pass Door";
_info.Place = "去4C车间";
move = new MoveJob(mission);
move.Execute(_info);
storageStep.NextStep(StorageStep.BackDoor);
storageStep.Msg = _info.Name + " 发送任务 " + mission;
storageStep.Msg = _info.Name + " 去4C车间任务 " + mission;
}
private void PassDoor4D()
{
mission = Common.MISSION_PASS_DOOR_4D;
_info.Place = "Pass Door";
_info.Place = "去4D车间";
move = new MoveJob(mission);
move.Execute(_info);
storageStep.NextStep(StorageStep.PassDoor);
storageStep.Msg = _info.Name + " 发送任务 " + mission;
storageStep.Msg = _info.Name + " 去4D车间任务 " + mission;
}
private void FindLine(string place)
......@@ -184,7 +214,7 @@ namespace BLL
move = new MoveJob(mission);
move.Execute(_info);
storageStep.NextStep(StorageStep.MoveLine);
storageStep.Msg = _info.Name + " 发送任务 " + mission;
storageStep.Msg = _info.Name + " 发送新钢板任务 " + mission;
}
private enum StorageStep
......
......@@ -15,7 +15,7 @@ namespace BLL
{
takeOldStep = new JobStep<TakeOldStep>(TakeOldStep.None);
Common.log.Debug("加载TakeOldJob");
SteelManage.OldSteelWorkDel();
SteelManage.OldSteelWorkDelTimeout();
}
public bool IsEnd { get; private set; }
......@@ -34,6 +34,7 @@ namespace BLL
if (takeOldStep.Equals(TakeOldStep.None))
{
_info.From = "";
_info.Place = "";
info.OldSteel = 0;
takeOldStep.Msg = info.Name + " 查找回收钢板任务";
takeOldStep.NextStep(TakeOldStep.FindLine);
......@@ -71,11 +72,11 @@ namespace BLL
else
{
mission = Common.MISSION_MOVE_WASH + _info.Workshop;
_info.Place = mission;
_info.Place = string.Format("去{0}清洗点", _info.Workshop);
move = new MoveJob(mission);
move.Execute(_info);
takeOldStep.NextStep(TakeOldStep.WaitWashPoint);
takeOldStep.Msg = _info.Name + " 发送回收钢板任务 " + mission;
takeOldStep.Msg = _info.Name + " 发送回清洗点任务 " + mission;
}
}
else if (takeOldStep.Equals(TakeOldStep.WaitWashPoint))
......
......@@ -32,6 +32,8 @@ namespace BLL
if (washPointStep.Equals(WashPointStep.None))
{
_info.From = "";
_info.Place = "";
SteelManage.NewSteelWorkDelAll(_info.Workshop);
if (_info.IsWorkspace())
MoveWash();
else
......@@ -48,7 +50,7 @@ namespace BLL
move.Execute(_info);
if (move.IsEnd)
{
SteelManage.NewSteelWorkDel(_info.From, _info.Place);
SteelManage.NewSteelWorkDel(_info.From, _info.From);
washPointStep.NextStep(WashPointStep.End);
washPointStep.Msg = _info.Name + " 到达清洗点";
}
......@@ -78,21 +80,21 @@ namespace BLL
{
mission = Common.MISSION_MOVE_WASH + _info.Workshop;
_info.From = _info.Workshop + "WASH";
_info.Place = _info.Workshop + "WASH";
_info.Place = _info.Workshop + "清洗点";
move = new MoveJob(mission);
move.Execute(_info);
washPointStep.NextStep(WashPointStep.MoveWash);
washPointStep.Msg = _info.Name + " 发送任务 " + mission;
washPointStep.Msg = _info.Name + " 去清洗点任务 " + mission;
}
private void PassDoor()
{
mission = Common.MISSION_PASS_DOOR_INTO + _info.Workshop;
_info.Place = "Pass Door";
_info.Place = string.Format("去{0}车间", _info.Workshop);
move = new MoveJob(mission);
move.Execute(_info);
washPointStep.NextStep(WashPointStep.PassDoor);
washPointStep.Msg = _info.Name + " 发送任务 " + mission;
washPointStep.Msg = _info.Name + " 发送过车间门任务 " + mission;
}
......
......@@ -101,7 +101,7 @@ namespace BLL
foreach (Process process in processes)
{
if (process.Id == current.Id) continue; //自己
if (process.MainModule.FileName == current.MainModule.FileName)
if (process.MainModule.ModuleName == current.MainModule.ModuleName)
{
//显示已打开的程序
ShowWindow(process.MainWindowHandle, SW_RESTORE);
......
......@@ -44,7 +44,7 @@ namespace BLL
}
}
public static void OldSteelWorkDel()
public static void OldSteelWorkDelTimeout()
{
if (!Common.WorkTimeoutDel) return;
int index = 0;
......@@ -124,6 +124,8 @@ namespace BLL
string name = "";
int lineIdx = Common.agvLines.FindIndex(s => s.Workshop == info.Workshop);
if (lineIdx == -1) return false;
//回收时不去前面的产线
int placeIdx = Array.FindIndex(Common.agvLines[lineIdx].Lines, s => s == info.Place);
if (placeIdx == -1) placeIdx = 0;
......@@ -195,34 +197,12 @@ namespace BLL
}
else
{
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++;
}
}
List<string> str = new List<string>();
for (int i = 0; i < newSteelWork.Count; i++)
str.Add(string.Format("Idx={0},From={1},Place={2}", i, newSteelWork[i].From, newSteelWork[i].Place));
Common.log.Debug("NewSteelWorkDel " + string.Join("; ", str));
if (remove)
{
SaveNewSteelWork();
Common.log.Info("删除超时" + Common.WorkTimeout + "分钟之前的所有送新钢板任务");
Common.log.Info("没有找到(" + from + "," + place + ")送新钢板任务");
}
}
......@@ -273,59 +253,46 @@ namespace BLL
place = "";
int lineIdx = Common.agvLines.FindIndex(s => s.Workshop == info.Workshop);
if (lineIdx == -1) return false;
if (newSteelWork.Count == 0) return false;
bool find = false;
for (int i = 0; i < newSteelWork.Count; i++)
{
if (newSteelWork[i].Place == "STORAGE")
for (int i = 0; i < Common.agvLines[lineIdx].Lines.Length; i++)
{
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);
int index = newSteelWork.FindIndex(s => s.From == info.From && s.Place == Common.agvLines[lineIdx].Lines[i]);
if (index > -1)
{
place = newSteelWork[i].Place;
info.From = newSteelWork[i].From;
place = newSteelWork[index].Place;
find = true;
break;
}
}
}
//for (int i = 0; i < Common.agvLines[lineIdx].Lines.Length; i++)
//for (int i = 0; i < newSteelWork.Count; i++)
//{
// name = Common.agvLines[lineIdx].Lines[i];
// int idx = newSteelWork.FindIndex(s => s.Place == name);
// if (idx > -1)
// if (newSteelWork[i].From == info.Workshop + "WASH")
// {
// info.From = newSteelWork[idx].From;
// if (newSteelWork[i].Place == "STORAGE")
// {
// 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;
// break;
// }
// }
// }
//}
//place = name;
return find;
}
public static bool FindNewSteelWork(AgvInfo info)
{
int index = newSteelWork.FindIndex(s => s.From == info.Place);
if (index > -1)
return true;
else
return false;
}
#endregion
#region StorageWork
......@@ -363,20 +330,21 @@ 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++;
}
//int lineIdx = Common.agvLines.FindIndex(s => s.Workshop == workshop);
//if (lineIdx == -1) return;
index = storageWork.FindIndex(sw => sw.Place == workshop + "_ENTER");
//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++;
//}
int index = storageWork.FindIndex(sw => sw.Place == workshop + "_ENTER");
if (index > -1) storageWork.RemoveAt(index);
SaveStorageWork();
Common.log.Info("删除" + workshop + "仓库钢板任务");
......@@ -413,18 +381,40 @@ namespace BLL
place = "";
int lineIdx = Common.agvLines.FindIndex(s => s.Workshop == info.Workshop);
if (lineIdx == -1) return false;
if (newSteelWork.Count == 0) return false;
bool find = false;
for (int i = 0; i < storageWork.Count; i++)
for (int i = 0; i < Common.agvLines[lineIdx].Lines.Length; i++)
{
int index = Array.FindIndex(Common.agvLines[lineIdx].Lines, s => s == storageWork[i].Place);
int index = newSteelWork.FindIndex(s => s.From == info.From && s.Place == Common.agvLines[lineIdx].Lines[i]);
if (index > -1)
{
place = storageWork[i].Place;
place = newSteelWork[index].Place;
find = true;
break;
}
}
//for (int i = 0; i < newSteelWork.Count; i++)
//{
// if (newSteelWork[i].From == "STORAGE")
// {
// int index = Array.FindIndex(Common.agvLines[lineIdx].Lines, s => s == newSteelWork[i].Place);
// if (index > -1)
// {
// place = newSteelWork[i].Place;
// find = true;
// break;
// }
// }
//}
return find;
}
......@@ -434,16 +424,20 @@ namespace BLL
if (lineIdx == -1) return false;
bool find = false;
for (int i = 0; i < storageWork.Count; i++)
for (int i = 0; i < newSteelWork.Count; i++)
{
if (newSteelWork[i].From == "STORAGE")
{
int index = Array.FindIndex(Common.agvLines[lineIdx].Lines, s => s == storageWork[i].Place);
int index = Array.FindIndex(Common.agvLines[lineIdx].Lines, s => s == newSteelWork[i].Place);
if (index > -1)
{
find = true;
break;
}
}
}
return find;
}
public static bool FindStorageWorkLeave()
......@@ -457,7 +451,7 @@ namespace BLL
public static void StorageWorkDelLeave()
{
int index = storageWork.FindIndex(sw => sw.Place == Common.STORAGE_LEAVE);
int index = storageWork.FindIndex(s => s.Place == Common.STORAGE_LEAVE);
if (index > -1)
{
storageWork.RemoveAt(index);
......@@ -476,16 +470,13 @@ namespace BLL
if (info.Battery < info.BatteryMin)
return null;
//int newSteelIndex = newSteelWork.FindIndex(s => s.From.StartsWith(info.Workshop) && s.From == s.Place);
//int storageIndex = storageWork.FindIndex(s => s.Place.StartsWith(info.Workshop));
bool rtn;
#region 清洗点呼叫
rtn = GetWash(info);
rtn = GetWashCall(info);
if (rtn)
{
Common.log.Info(info.Name + " " + info.Workshop + "清洗点呼叫");
Common.log.Info(string.Format("{0} 清洗点呼叫{1}小车", info.Name, info.Workshop));
return new WashPointJob();
}
else
......@@ -495,20 +486,20 @@ namespace BLL
#endregion
#region 仓库入架子出钢板
rtn = GetStorage(info);
rtn = GetStorageCall(info);
if (rtn)
{
Common.log.Info(info.Name + " 4D仓库呼叫");
Common.log.Info(string.Format("{0} 仓库呼叫{1}小车", info.Name, info.Workshop));
return new StorageJob();
}
else
{
Common.log.Debug(info.Name + " 没有找到4D仓库呼叫");
Common.log.Debug(info.Name + " 没有找到仓库呼叫");
}
#endregion
#region 回收钢板
rtn = GetOldSteel(info);
rtn = GetOldSteelCall(info);
if (rtn)
{
Common.log.Info(info.Name + " " + info.Workshop + "回收钢板");
......@@ -521,7 +512,6 @@ namespace BLL
#endregion
return null;
}
......@@ -549,28 +539,47 @@ namespace BLL
private static bool GetWash(AgvInfo info)
private static bool GetWashCall(AgvInfo info)
{
int lineIdx = Common.agvLines.FindIndex(s => s.Workshop == info.Workshop);
if (lineIdx == -1) return false;
bool find = false;
string name = info.Workshop + "WASH";
for (int i = 0; i < newSteelWork.Count; i++)
{
if (newSteelWork[i].From == newSteelWork[i].Place)
{
int index = Array.FindIndex(Common.agvLines[lineIdx].Lines, s => s == newSteelWork[i].Place);
if (index > -1)
if (newSteelWork[i].From == newSteelWork[i].Place && newSteelWork[i].From == name)
{
find = true;
break;
}
}
}
//int lineIdx = Common.agvLines.FindIndex(s => s.Workshop == info.Workshop);
//if (lineIdx == -1) return false;
//bool find = false;
//for (int i = 0; i < newSteelWork.Count; i++)
//{
// if (newSteelWork[i].From == newSteelWork[i].Place)
// {
// int index = Array.FindIndex(Common.agvLines[lineIdx].Lines, s => s == newSteelWork[i].Place);
// if (index > -1)
// {
// find = true;
// break;
// }
// }
//}
return find;
}
private static bool GetOldSteel(AgvInfo info)
private static bool GetOldSteelCall(AgvInfo info)
{
int lineIdx = Common.agvLines.FindIndex(s => s.Workshop == info.Workshop);
if (lineIdx == -1) return false;
......@@ -594,33 +603,45 @@ namespace BLL
if (lineIdx == -1) return false;
bool find = false;
for (int i = 0; i < newSteelWork.Count; i++)
{
if (newSteelWork[i].From == info.From)
for (int i = 0; i < Common.agvLines[lineIdx].Lines.Length; i++)
{
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 = newSteelWork.FindIndex(s => s.From == info.From && s.Place == Common.agvLines[lineIdx].Lines[i]);
if (index > -1)
{
find = true;
break;
}
}
}
}
//for (int i = 0; i < newSteelWork.Count; i++)
//{
// 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);
// if (index > -1)
// {
// find = true;
// break;
// }
// }
// }
//}
return find;
}
private static bool GetStorage(AgvInfo info)
private static bool GetStorageCall(AgvInfo info)
{
int lineIdx = Common.agvLines.FindIndex(s => s.Workshop == info.Workshop);
if (lineIdx == -1) return false;
//int lineIdx = Common.agvLines.FindIndex(s => s.Workshop == info.Workshop);
//if (lineIdx == -1) return false;
bool find = false;
for (int i = 0; i < storageWork.Count; i++)
......
......@@ -29,7 +29,10 @@ namespace BLL
public static void Close()
{
if (_serviceHost != null)
{
if (_serviceHost.State != System.ServiceModel.CommunicationState.Faulted)
_serviceHost.Close();
}
Model.Common.log.Info("Web服务已关闭");
}
}
......
......@@ -101,6 +101,7 @@ namespace BLL
{
from = from.ToUpper();
place = place.ToUpper();
string[] arr = place.Split(',');
bool rtn = FindLine(from, arr);
if (rtn)
......
......@@ -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\log4net.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.CopyComplete
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.csprojAssemblyReference.cache
......@@ -19,7 +19,7 @@ namespace AGVControl_Steel
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//if (!RunMode()) return;
if (BLL.RunMode.IsRun()) return;
Common.log = new Log("AGVControl_Steel");
Common.log.Info("=====程序开始=====");
ReadConfig();
......
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
<appSettings>
<add key="FLEET_IP" value="10.85.199.3" />
<add key="FLEET_Send" value="true" />
<add key="WebService" value="http://10.85.196.40:8089/" />
<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_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="13号_4D" value="false" />
<add key="FLEET_IP" value="10.85.199.3"/>
<add key="FLEET_Send" value="true"/>
<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="BoardTimeout" value="3"/>
<add key="AGV_BATTERY_MAX" value="100"/>
<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="13号_4D" value="false"/>
</appSettings>
</configuration>
\ No newline at end of file
此文件类型无法预览
此文件类型无法预览
4D,D1,D2,D3,D4,D5,D6,D8,D9,D10,D11,D12,D14,D15,D16,4DWASH,STORAGE
4C,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,4CWASH
\ No newline at end of file
4C,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,4CWASH,STORAGE
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!