Commit 7f22012e 顾剑亮

debug

1 个父辈 e4d29273
正在显示 40 个修改的文件 包含 209 行增加106 行删除
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,19 +96,30 @@ 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)
{
chargeStep.Msg = _info.Name + " 到达充电位,准备充电";
chargeStep.NextStep(ChargeStep.Charging);
if (value == 1)
{
_info.Place = "充电中";
chargeStep.Msg = _info.Name + " 到达充电位,准备充电";
chargeStep.NextStep(ChargeStep.Charging);
}
}
}
......
......@@ -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)
//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)
{
standbyStep.Msg = _info.Name + " 电量小于80%,执行充电任务";
return new ChargeJob();
if (_info.Battery <= 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,56 +95,84 @@ namespace BLL
SteelManage.StorageWorkDelLeave();
storageStep.Msg = info.Name + " 收到离开信号";
if (SteelManage.FindStorageWork(info))
{
if (_info.IsWorkspace())
{
storageStep.NextStep(StorageStep.FindLine);
}
else
{
PassDoor4C();
}
}
if (_info.IsWorkspace())
storageStep.NextStep(StorageStep.End);
else
return new StandbyJob();
PassDoor4C();
//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);
storageStep.NextStep(StorageStep.End);
}
else if (storageStep.Equals(StorageStep.FindLine))
//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
PassDoor4C();
}
else
}
else if (storageStep.Equals(StorageStep.End))
{
//IsEnd = true;
//return new SendNewJob();
_info.Place = "";
IJob job = SteelManage.GetNewSteelJob(info);
if (job == null)
{
storageStep.Msg = info.Name + " 没有后续新钢板任务";
return new StandbyJob();
}
}
else if (storageStep.Equals(StorageStep.MoveLine))
{
move.Execute(_info);
if (move.IsEnd)
else
{
SteelManage.StorageWorkDel(_info.Place);
storageStep.Msg = _info.Name + " 到达 " + _info.Place;
storageStep.NextStep(StorageStep.FindLine);
return job;
}
}
else if (storageStep.Equals(StorageStep.Error))
{
}
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);
......
......@@ -29,7 +29,10 @@ namespace BLL
public static void Close()
{
if (_serviceHost != null)
_serviceHost.Close();
{
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" />
</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="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!