Commit 208ae8ed 顾剑亮

修改清洗点逻辑

1 个父辈 25e9fa32
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
<Compile Include="Job\ChargeJob.cs" /> <Compile Include="Job\ChargeJob.cs" />
<Compile Include="Model\AgvInfo.cs" /> <Compile Include="Model\AgvInfo.cs" />
<Compile Include="Job\SendNewJob.cs" /> <Compile Include="Job\SendNewJob.cs" />
<Compile Include="Job\StorageJob.cs" />
<Compile Include="UI\FrmMain.cs"> <Compile Include="UI\FrmMain.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
...@@ -89,6 +90,7 @@ ...@@ -89,6 +90,7 @@
<Compile Include="BLL\WebService.cs" /> <Compile Include="BLL\WebService.cs" />
<Compile Include="Model\SteelWork.cs" /> <Compile Include="Model\SteelWork.cs" />
<Compile Include="BLL\SteelManage.cs" /> <Compile Include="BLL\SteelManage.cs" />
<Compile Include="Job\WashPointJob.cs" />
<EmbeddedResource Include="UI\FrmMain.resx"> <EmbeddedResource Include="UI\FrmMain.resx">
<DependentUpon>FrmMain.cs</DependentUpon> <DependentUpon>FrmMain.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>
......
...@@ -41,10 +41,11 @@ ...@@ -41,10 +41,11 @@
<add key="WebService" value="http://10.85.196.40:8089/"/> <add key="WebService" value="http://10.85.196.40:8089/"/>
<add key="AGV_BATTERY_MAX" value="100"/> <add key="AGV_BATTERY_MAX" value="100"/>
<add key="AGV_BATTERY_MIN" value="60"/> <add key="AGV_BATTERY_MIN" value="60"/>
<add key="4D_Line" value="D1,D2,D3,D4,D5,D6,D8,D9,D10,D11,D12,D14,D15,D16"/> <!--<add key="4D_Line" value="D1,D2,D3,D4,D5,D6,D8,D9,D10,D11,D12,D14,D15,D16"/>
<add key="4C_Line" value="C1,C2,C3,C4,C5,C6,C7,C8,C9,C10"/> <add key="4C_Line" value="C1,C2,C3,C4,C5,C6,C7,C8,C9,C10"/>
<add key="Store" value="4cwash,4dwash,storage"/> <add key="Store" value="4cwash,4dwash,storage"/>-->
<add key="4D_AGV" value="6"/> <add key="PlaceName" value="D1,D2,D3,D4,D5,D6,D8,D9,D10,D11,D12,D14,D15,D16,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,4cwash,4dwash,storage"/>
<add key="4D_AGV" value="3"/>
<add key="4C_AGV" value="32"/> <add key="4C_AGV" value="32"/>
</appSettings> </appSettings>
</configuration> </configuration>
\ No newline at end of file \ No newline at end of file
...@@ -22,11 +22,14 @@ namespace AGVControl_Steel ...@@ -22,11 +22,14 @@ namespace AGVControl_Steel
public static System.Configuration.Configuration appConfig; public static System.Configuration.Configuration appConfig;
public static log4net.ILog log; public static log4net.ILog log;
public static string[] LINE_NAME_4D; public static string[] PLACE_NAME;
public static string[] LINE_NAME_4C; //public static string[] LINE_NAME_4D;
public static string[] STORE_NAME; //public static string[] LINE_NAME_4C;
//public static string[] STORE_NAME;
public const string WORKSHOP_4D = "4D"; public const string WORKSHOP_4D = "4D";
public const string WORKSHOP_4C = "4C"; public const string WORKSHOP_4C = "4C";
//public const string WASH_4D = "4Dwash";
//public const string WASH_4C = "4Cwash";
public const string MISSION_TAKE_OFF_SHELF = "Placeqisdashelf"; public const string MISSION_TAKE_OFF_SHELF = "Placeqisdashelf";
public const string MISSION_TAKE_ON_SHELF = "Pickupqisdashelf"; public const string MISSION_TAKE_ON_SHELF = "Pickupqisdashelf";
public const string MISSION_MOVE_4C_4D = "MoveDoor-4C-4D"; public const string MISSION_MOVE_4C_4D = "MoveDoor-4C-4D";
......
...@@ -60,6 +60,9 @@ namespace BLL ...@@ -60,6 +60,9 @@ namespace BLL
GetAgvState(ref info); GetAgvState(ref info);
if (!info.IsAuto) continue; //手动 if (!info.IsAuto) continue; //手动
if (info.StateID == 4) //Pause
Common.mir.State_Ready(info.IP, info.Authorization);
if (info.CurrentJob == null) if (info.CurrentJob == null)
info.CurrentJob = new StandbyJob(); info.CurrentJob = new StandbyJob();
else else
...@@ -98,10 +101,6 @@ namespace BLL ...@@ -98,10 +101,6 @@ namespace BLL
int idx = Common.agvInfos.FindIndex(s => s.IP == ip); int idx = Common.agvInfos.FindIndex(s => s.IP == ip);
if (idx > -1) AgvChanged?.Invoke(idx); if (idx > -1) AgvChanged?.Invoke(idx);
if (info.StateID == 4) //Pause
{
Common.mir.State_Ready(info.IP, info.Authorization);
}
} }
} }
......
...@@ -86,24 +86,12 @@ namespace BLL ...@@ -86,24 +86,12 @@ namespace BLL
string name = ""; string name = "";
bool find = false; bool find = false;
if (info.Workshop == Common.WORKSHOP_4D) string s = info.Workshop.Substring(1, 1);
for (int i = 0; i < Common.PLACE_NAME.Length; i++)
{ {
for (int i = 0; i < Common.LINE_NAME_4D.Length; i++) name = Common.PLACE_NAME[i];
if (name.StartsWith(s))
{ {
name = Common.LINE_NAME_4D[i];
index = oldSteelWork.FindIndex(s => s.Place == name);
if (index > -1)
{
find = true;
break;
}
}
}
else if (info.Workshop == Common.WORKSHOP_4C)
{
for (int i = 0; i < Common.LINE_NAME_4C.Length; i++)
{
name = Common.LINE_NAME_4C[i];
index = oldSteelWork.FindIndex(s => s.Place == name); index = oldSteelWork.FindIndex(s => s.Place == name);
if (index > -1) if (index > -1)
{ {
...@@ -112,6 +100,7 @@ namespace BLL ...@@ -112,6 +100,7 @@ namespace BLL
} }
} }
} }
place = name; place = name;
return find; return find;
} }
...@@ -169,67 +158,29 @@ namespace BLL ...@@ -169,67 +158,29 @@ namespace BLL
string name = ""; string name = "";
bool find = false; bool find = false;
if (info.Workshop == Common.WORKSHOP_4D) for (int i = 0; i < Common.PLACE_NAME.Length; i++)
{
for (int i = 0; i < Common.LINE_NAME_4D.Length; i++)
{
name = Common.LINE_NAME_4D[i];
if (info.SteelFrom == "")
{
index = newSteelWork.FindIndex(s => s.Place == name);
if (index > -1)
{
find = true;
info.SteelFrom = newSteelWork[index].From;
break;
}
}
else
{
index = newSteelWork.FindIndex(s => s.From == info.SteelFrom && s.Place == name);
if (index > -1)
{
find = true;
break;
}
}
}
}
else if (info.Workshop == Common.WORKSHOP_4C)
{ {
for (int i = 0; i < Common.LINE_NAME_4C.Length; i++) name = Common.PLACE_NAME[i];
index = newSteelWork.FindIndex(s => s.From == info.SteelFrom && s.Place == name);
if (index > -1)
{ {
name = Common.LINE_NAME_4C[i]; find = true;
if (info.SteelFrom == "") break;
{
index = newSteelWork.FindIndex(s => s.Place == name);
if (index > -1)
{
find = true;
info.SteelFrom = newSteelWork[index].From;
break;
}
}
else
{
index = newSteelWork.FindIndex(s => s.From == info.SteelFrom && s.Place == name);
if (index > -1)
{
find = true;
break;
}
}
} }
} }
place = name; place = name;
return find; return find;
//int idx = newSteelWork.FindIndex(s => s.From == from && s.Place == place);
//return idx > -1;
} }
public bool FindNewSteelWork(AgvInfo info)
{
int index = newSteelWork.FindIndex(s => s.From == info.SteelFrom);
if (index > -1)
return true;
else
return false;
}
...@@ -237,35 +188,50 @@ namespace BLL ...@@ -237,35 +188,50 @@ namespace BLL
public Job GetSteelJob(AgvInfo info) public Job GetSteelJob(AgvInfo info)
{ {
string name = info.Workshop.Substring(1, 1);
//TEST //TEST
string s = ""; string s = "";
for (int i = 0; i < oldSteelWork.Count; i++) for (int i = 0; i < oldSteelWork.Count; i++)
s += oldSteelWork[i].Place + ";"; s += oldSteelWork[i].Place + ";";
Common.log.Debug("name=" + name + " oldSteelWork=" + s); Common.log.Debug("TEST oldSteelWork=" + s);
s = ""; s = "";
for (int i = 0; i < newSteelWork.Count; i++) for (int i = 0; i < newSteelWork.Count; i++)
s += newSteelWork[i].From + "," + newSteelWork[i].Place + "; "; s += newSteelWork[i].From + "," + newSteelWork[i].Place + "; ";
Common.log.Debug("name=" + name + " newSteelWork=" + s); Common.log.Debug("TEST newSteelWork=" + s);
//回收旧钢板
string name = info.Workshop.Substring(1, 1);
int index = oldSteelWork.FindIndex(s => s.Place.StartsWith(name)); int index = oldSteelWork.FindIndex(s => s.Place.StartsWith(name));
if (index == -1) if (index > -1)
{ {
index = newSteelWork.FindIndex(s => s.Place.StartsWith(name)); Common.log.Info(info.Workshop + "旧钢板回收");
if (index == -1)
return null;
else
return new SendNewJob();
}
else
return new TakeOldJob(); return new TakeOldJob();
}
//清洗点呼叫
index = newSteelWork.FindIndex(s => s.From.StartsWith(info.Workshop.ToLower()) && s.From == s.Place);
if (index > -1)
{
info.SteelFrom = newSteelWork[index].From;
Common.log.Info(info.Workshop + "清洗点呼叫");
return new WashPointJob();
}
//仓库呼叫
index = newSteelWork.FindIndex(s => s.From == "storage" && s.From == s.Place);
if (index > -1)
{
info.SteelFrom = newSteelWork[index].From;
Common.log.Info("4D仓库呼叫");
return new StorageJob();
}
return null;
} }
} }
......
...@@ -26,6 +26,15 @@ namespace Webs ...@@ -26,6 +26,15 @@ namespace Webs
[OperationContract] [OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "StealAgv/sendNew", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)] [WebInvoke(Method = "POST", UriTemplate = "StealAgv/sendNew", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result SendNewPost(Stream info); Result SendNewPost(Stream info);
[OperationContract]
[WebGet(UriTemplate = "StealAgv/storage", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result StorageGet();
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "StealAgv/storage", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result StoragePost(Stream info);
} }
[DataContract] [DataContract]
...@@ -81,6 +90,20 @@ namespace Webs ...@@ -81,6 +90,20 @@ namespace Webs
return SendNew(arr[0], arr[1]); return SendNew(arr[0], arr[1]);
} }
public Result StorageGet()
{
Common.log.Info("storage[GET]");
return new Result() { Code = 0, Msg = "TEST" };
}
public Result StoragePost(Stream info)
{
Common.log.Info("storage[POST]");
return new Result() { Code = 0, Msg = "TEST" };
}
private Result TakeOld(string place) private Result TakeOld(string place)
...@@ -90,22 +113,24 @@ namespace Webs ...@@ -90,22 +113,24 @@ namespace Webs
try try
{ {
place = place.ToUpper(); place = place.ToUpper();
int index1 = Array.FindIndex(Common.LINE_NAME_4D, s => s == place); int index = Array.FindIndex(Common.PLACE_NAME, s => s == place);
int index2 = Array.FindIndex(Common.LINE_NAME_4C, s => s == place);
if (index1 == -1 && index2 == -1) if (index == -1)
{ {
res = new Result { Code = -2, Msg = "Not find place=" + place }; res = new Result { Code = -2, Msg = "Not find place=" + place };
Common.log.Info("没有找到" + place);
} }
else else
{ {
Common.steelManage.OldSteelWorkAdd(place); Common.steelManage.OldSteelWorkAdd(place);
res = new Result { Code = 0, Msg = "OK" }; res = new Result { Code = 0, Msg = "OK" };
Common.log.Info("TakeOld(" + place + ") OK");
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
res = new Result { Code = -100, Msg = ex.Message }; res = new Result { Code = -100, Msg = ex.Message };
Common.log.Error("TakeOld", ex);
} }
return res; return res;
...@@ -118,24 +143,26 @@ namespace Webs ...@@ -118,24 +143,26 @@ namespace Webs
try try
{ {
from = from.ToLower(); from = from.ToLower();
int index = Array.FindIndex(Common.STORE_NAME, s => s == from); int index = Array.FindIndex(Common.PLACE_NAME, s => s == from);
if (index == -1) if (index == -1)
{ {
res = new Result { Code = -1, Msg = "Not find from=" + from }; res = new Result { Code = -1, Msg = "Not find from=" + from };
Common.log.Info("没有找到" + from);
} }
else else
{ {
place = place.ToUpper(); if (place == "EmptyShelfIn")
if (place == "EMPTYSHELFIN")
{ {
Common.steelManage.NewSteelWorkAdd(from, place); Common.steelManage.NewSteelWorkAdd(from, place);
res = new Result { Code = 0, Msg = "OK" }; res = new Result { Code = 0, Msg = "OK" };
Common.log.Info("SendNew(" + from + "," + place + ") OK");
} }
else if (place == "EMPTYSHELFLEAVE") else if (place == "EmptyShelfLeave")
{ {
Common.steelManage.NewSteelWorkAdd(from, place); Common.steelManage.NewSteelWorkAdd(from, place);
res = new Result { Code = 0, Msg = "OK" }; res = new Result { Code = 0, Msg = "OK" };
Common.log.Info("SendNew(" + from + "," + place + ") OK");
} }
else else
{ {
...@@ -143,12 +170,18 @@ namespace Webs ...@@ -143,12 +170,18 @@ namespace Webs
string[] arr = place.Split(','); string[] arr = place.Split(',');
for (int i = 0; i < arr.Length; i++) for (int i = 0; i < arr.Length; i++)
{ {
int index1 = Array.FindIndex(Common.LINE_NAME_4D, s => s == arr[i]); if (arr[i].StartsWith("c") || arr[i].StartsWith("d"))
int index2 = Array.FindIndex(Common.LINE_NAME_4C, s => s == arr[i]); arr[i] = arr[i].ToUpper();
else if (arr[i].StartsWith("C") || arr[i].StartsWith("D"))
arr[i] = arr[i].ToUpper();
else
arr[i] = arr[i].ToLower();
index = Array.FindIndex(Common.PLACE_NAME, s => s == arr[i]);
if (index1 == -1 && index2 == -1) if (index == -1)
{ {
res = new Result { Code = -2, Msg = "Not find place=" + arr[i] }; res = new Result { Code = -2, Msg = "Not find place=" + arr[i] };
Common.log.Info("没有找到" + arr[i]);
find = false; find = false;
break; break;
} }
...@@ -159,13 +192,17 @@ namespace Webs ...@@ -159,13 +192,17 @@ namespace Webs
} }
} }
if (find) if (find)
{
res = new Result { Code = 0, Msg = "OK" }; res = new Result { Code = 0, Msg = "OK" };
Common.log.Info("SendNew(" + from + ",[" + place + "]) OK");
}
} }
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
res = new Result { Code = -100, Msg = ex.Message }; res = new Result { Code = -100, Msg = ex.Message };
Common.log.Error("SendNew", ex);
} }
return res; return res;
......
...@@ -17,40 +17,34 @@ namespace Model ...@@ -17,40 +17,34 @@ namespace Model
{ {
if (sendNewStep.IsEqual(SendNewStep.None)) if (sendNewStep.IsEqual(SendNewStep.None))
{ {
//wash storage 区分 info.FillSteelCount();
sendNewStep.Msg = info.FullName + "等待任务";
sendNewStep.NextStep(SendNewStep.FindMission);
sendNewStep.NextStep(SendNewStep.GoWashPoint);
} }
else if (sendNewStep.IsEqual(SendNewStep.GoWashPoint)) else if (sendNewStep.IsEqual(SendNewStep.FindMission))
{ {
if (info.Workshop == Common.WORKSHOP_4D) rtn = Common.steelManage.FindNewSteelWork(info);
mission = Common.MISSION_MOVE_WASH_4D;
else if (info.Workshop == Common.WORKSHOP_4C)
mission = Common.MISSION_MOVE_WASH_4C;
rtn = Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, mission, out id);
if (rtn) if (rtn)
{ {
sendNewStep.Msg = info.FullName + "去" + info.Workshop + "清洗点"; if (info.IsSelfWorkshop())
sendNewStep.NextStep(SendNewStep.WaitWashPoint); {
} sendNewStep.Msg = info.FullName + "找到任务,开始执行";
else sendNewStep.NextStep(SendNewStep.FindLine);
{ }
sendNewStep.Msg = info.FullName + "发送" + mission + "任务失败"; else
{
MoveDoor(info);
}
} }
} }
else if (sendNewStep.IsEqual(SendNewStep.WaitWashPoint)) else if (sendNewStep.IsEqual(SendNewStep.WaitWorkshopDoor))
{ {
rtn = Common.mir.Get_MissionState_Fleet(info.Authorization, id, out string state); rtn = Common.mir.Get_MissionState_Fleet(info.Authorization, id, out string state);
if (rtn) if (rtn)
{ {
if (state == MissionState.Done.ToString()) if (state == MissionState.Done.ToString())
{ {
info.FillSteelCount(); sendNewStep.Msg = info.FullName + "已过车间门,开始执行任务";
sendNewStep.Msg = info.FullName + "已在清洗点";
sendNewStep.NextStep(SendNewStep.FindLine); sendNewStep.NextStep(SendNewStep.FindLine);
} }
else if (state == MissionState.Aborted.ToString()) else if (state == MissionState.Aborted.ToString())
...@@ -72,8 +66,18 @@ namespace Model ...@@ -72,8 +66,18 @@ namespace Model
} }
else else
{ {
FindLine(info); rtn = Common.steelManage.FindNewSteelWork(info, out string place);
if (!rtn) if (rtn)
{
name = place;
info.Place = name;
mission = "MoveSteel" + name;
Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, mission, out id);
sendNewStep.Msg = info.FullName + "发送任务" + mission;
sendNewStep.NextStep(SendNewStep.MoveLine);
info.SteelCountAdd();
}
else
{ {
sendNewStep.Msg = info.FullName + "没有后续新钢板任务"; sendNewStep.Msg = info.FullName + "没有后续新钢板任务";
sendNewStep.NextStep(SendNewStep.End); sendNewStep.NextStep(SendNewStep.End);
...@@ -110,28 +114,32 @@ namespace Model ...@@ -110,28 +114,32 @@ namespace Model
return this; return this;
} }
private void FindLine(AgvInfo info) private void MoveDoor(AgvInfo info)
{ {
rtn = Common.steelManage.FindNewSteelWork(info, out string place); if (info.Workshop == Common.WORKSHOP_4D)
mission = Common.MISSION_MOVE_4C_4D;
else if (info.Workshop == Common.WORKSHOP_4C)
mission = Common.MISSION_MOVE_4D_4C;
rtn = Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, mission, out id);
if (rtn) if (rtn)
{ {
name = place; sendNewStep.Msg = info.FullName + "在" + info.Workshop + "车间,先过车间门";
info.Place = name; sendNewStep.NextStep(SendNewStep.WaitWorkshopDoor);
mission = "MoveSteel" + name; }
Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, mission, out id); else
sendNewStep.Msg = info.FullName + "发送任务" + mission; {
sendNewStep.NextStep(SendNewStep.MoveLine); sendNewStep.Msg = info.FullName + "发送" + mission + "任务失败";
info.SteelCountAdd();
} }
} }
private enum SendNewStep private enum SendNewStep
{ {
None, None,
FindMission,
WaitWorkshopDoor,
FindLine, FindLine,
MoveLine, MoveLine,
GoWashPoint,
WaitWashPoint,
End End
} }
} }
......
...@@ -60,6 +60,7 @@ namespace Model ...@@ -60,6 +60,7 @@ namespace Model
{ {
if (info.Battery <= info.BatteryMin) if (info.Battery <= info.BatteryMin)
{ {
Common.log.Info(info.FullName + "电量小于" + info.BatteryMin + ",执行充电任务");
return new ChargeJob(); return new ChargeJob();
} }
else else
......
using AGVControl_Steel;
namespace Model
{
public class StorageJob : Job
{
private string id;
private JobStep<StorageStep> storageStep;
public StorageJob()
{
storageStep = new JobStep<StorageStep>(StorageStep.None);
}
public override Job Execute(AgvInfo info)
{
if (storageStep.IsEqual(StorageStep.None))
{
if (info.Is4DWorkshop())
storageStep.NextStep(StorageStep.GoStorage);
else
MoveDoor(info);
}
else if (storageStep.IsEqual(StorageStep.WaitWorkshopDoor))
{
rtn = Common.mir.Get_MissionState_Fleet(info.Authorization, id, out string state);
if (rtn)
{
if (state == MissionState.Done.ToString())
{
storageStep.Msg = info.FullName + "已过车间门";
storageStep.NextStep(StorageStep.GoStorage);
}
else if (state == MissionState.Aborted.ToString())
{
storageStep.Msg = info.FullName + "任务状态" + MissionState.Aborted.ToString();
}
}
else
{
storageStep.Msg = info.FullName + "获取任务状态id[" + id + "]失败";
}
}
else if (storageStep.IsEqual(StorageStep.GoStorage))
{
rtn = Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, Common.MISSION_MOVE_STORAGE, out id);
if (rtn)
{
storageStep.Msg = info.FullName + "去4D仓库";
storageStep.NextStep(StorageStep.WaitStorage);
}
else
{
storageStep.Msg = info.FullName + "发送" + mission + "任务失败";
}
}
else if (storageStep.IsEqual(StorageStep.WaitStorage))
{
rtn = Common.mir.Get_MissionState_Fleet(info.Authorization, id, out string state);
if (rtn)
{
if (state == MissionState.Done.ToString())
{
Common.steelManage.NewSteelWorkDel(info.SteelFrom, info.SteelFrom);
storageStep.Msg = info.FullName + "已在仓库";
storageStep.NextStep(StorageStep.End);
}
else if (state == MissionState.Aborted.ToString())
{
storageStep.Msg = info.FullName + "任务状态" + MissionState.Aborted.ToString();
}
}
else
{
storageStep.Msg = info.FullName + "获取任务状态id[" + id + "]失败";
}
}
else if (storageStep.IsEqual(StorageStep.End))
{
return new SendNewJob();
}
return this;
}
private void MoveDoor(AgvInfo info)
{
rtn = Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, Common.MISSION_MOVE_4C_4D, out id);
if (rtn)
{
storageStep.Msg = info.FullName + "在" + info.Workshop + "车间,先过车间门";
storageStep.NextStep(StorageStep.WaitWorkshopDoor);
}
else
{
storageStep.Msg = info.FullName + "发送" + mission + "任务失败";
}
}
private enum StorageStep
{
None,
WaitWorkshopDoor,
GoStorage,
WaitStorage,
End
}
}
}
using AGVControl_Steel;
namespace Model
{
public class WashPointJob : Job
{
private string id;
private JobStep<WashPointStep> washPointStep;
public WashPointJob()
{
washPointStep = new JobStep<WashPointStep>(WashPointStep.None);
}
public override Job Execute(AgvInfo info)
{
if (washPointStep.IsEqual(WashPointStep.None))
{
washPointStep.NextStep(WashPointStep.GoWashPoint);
}
else if (washPointStep.IsEqual(WashPointStep.GoWashPoint))
{
if (info.Workshop == Common.WORKSHOP_4D)
mission = Common.MISSION_MOVE_WASH_4D;
else if (info.Workshop == Common.WORKSHOP_4C)
mission = Common.MISSION_MOVE_WASH_4C;
rtn = Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, mission, out id);
if (rtn)
{
washPointStep.Msg = info.FullName + "去" + info.Workshop + "清洗点";
washPointStep.NextStep(WashPointStep.WaitWashPoint);
}
else
{
washPointStep.Msg = info.FullName + "发送" + mission + "任务失败";
}
}
else if (washPointStep.IsEqual(WashPointStep.WaitWashPoint))
{
rtn = Common.mir.Get_MissionState_Fleet(info.Authorization, id, out string state);
if (rtn)
{
if (state == MissionState.Done.ToString())
{
Common.steelManage.NewSteelWorkDel(info.SteelFrom, info.SteelFrom);
washPointStep.Msg = info.FullName + "已在清洗点";
washPointStep.NextStep(WashPointStep.End);
}
else if (state == MissionState.Aborted.ToString())
{
washPointStep.Msg = info.FullName + "任务状态" + MissionState.Aborted.ToString();
}
}
else
{
washPointStep.Msg = info.FullName + "获取任务状态id[" + id + "]失败";
}
}
else if (washPointStep.IsEqual(WashPointStep.End))
{
return new SendNewJob();
}
return this;
}
private enum WashPointStep
{
None,
GoWashPoint,
WaitWashPoint,
End
}
}
}
...@@ -106,7 +106,7 @@ namespace Model ...@@ -106,7 +106,7 @@ namespace Model
/// <returns></returns> /// <returns></returns>
public string[] ToRow() public string[] ToRow()
{ {
string[] arr = new string[] { Name, Place, StateText, MissionText, Battery.ToString(), IsOnline.ToString(), IsAuto.ToString() }; string[] arr = new string[] { Name, Place, StateText, MissionText, Battery.ToString(), IsOnline.ToString(), IsAuto.ToString(), "清除" };
return arr; return arr;
} }
...@@ -133,7 +133,21 @@ namespace Model ...@@ -133,7 +133,21 @@ namespace Model
return false; return false;
} }
/// <summary>
/// 是否在4D车间
/// </summary>
/// <returns></returns>
public bool Is4DWorkshop()
{
if (Position.Y < 55)
return true;
else if (Position.Y > 62)
return false;
else
return false;
}
/// <summary> /// <summary>
/// 钢板是否已放满 /// 钢板是否已放满
/// </summary> /// </summary>
......
...@@ -74,8 +74,12 @@ namespace Model ...@@ -74,8 +74,12 @@ namespace Model
if (!value.Equals(_msg)) if (!value.Equals(_msg))
{ {
Common.log.Info(_step.ToString() + ":" + value); Common.log.Info(_step.ToString() + ":" + value);
Common.txtLog.AppendText(value + "\r\n"); if (Common.txtLog != null)
Common.txtLog.ScrollToCaret(); {
string time = string.Format("[{0:HH:mm:ss}] ", DateTime.Now);
Common.txtLog.AppendText(time + value + "\r\n");
Common.txtLog.ScrollToCaret();
}
} }
} }
_msg = value; _msg = value;
......
...@@ -91,9 +91,10 @@ namespace AGVControl_Steel ...@@ -91,9 +91,10 @@ namespace AGVControl_Steel
Common.log.Info("读取配置文件 " + Common.PATH_AGV_MISSION); Common.log.Info("读取配置文件 " + Common.PATH_AGV_MISSION);
Common.LINE_NAME_4D = Common.appConfig.AppSettings.Settings["4D_Line"].Value.Split(','); //Common.LINE_NAME_4D = Common.appConfig.AppSettings.Settings["4D_Line"].Value.Split(',');
Common.LINE_NAME_4C = Common.appConfig.AppSettings.Settings["4C_Line"].Value.Split(','); //Common.LINE_NAME_4C = Common.appConfig.AppSettings.Settings["4C_Line"].Value.Split(',');
Common.STORE_NAME = Common.appConfig.AppSettings.Settings["Store"].Value.Split(','); //Common.STORE_NAME = Common.appConfig.AppSettings.Settings["Store"].Value.Split(',');
Common.PLACE_NAME = Common.appConfig.AppSettings.Settings["PlaceName"].Value.Split(',');
string id = Common.appConfig.AppSettings.Settings["4D_AGV"].Value; string id = Common.appConfig.AppSettings.Settings["4D_AGV"].Value;
......
...@@ -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.1.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")]
...@@ -68,7 +68,7 @@ namespace AGVControl_Steel ...@@ -68,7 +68,7 @@ namespace AGVControl_Steel
if (e.RowIndex == -1) return; if (e.RowIndex == -1) return;
AgvInfo info = Common.agvInfos[e.RowIndex]; AgvInfo info = Common.agvInfos[e.RowIndex];
if (e.ColumnIndex == DgvName.Columns.Count - 1) //最后一列,自动/手动 if (e.ColumnIndex == DgvName.Columns.Count - 2) //最后二列,自动/手动
{ {
info.IsAuto = !info.IsAuto; info.IsAuto = !info.IsAuto;
DgvName.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = info.IsAuto.ToString(); DgvName.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = info.IsAuto.ToString();
...@@ -77,14 +77,23 @@ namespace AGVControl_Steel ...@@ -77,14 +77,23 @@ namespace AGVControl_Steel
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);
} }
else if (e.ColumnIndex == DgvName.Columns.Count - 1) //最后一列,清除任务
{
string text = "确定要清除 " + info.Name + " 的任务吗?";
DialogResult dr = MessageBox.Show(text, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (dr == DialogResult.Yes)
{
info.CurrentJob = null;
Common.mir.Del_Mission(info.IP, info.Authorization);
info.IsAuto = false;
DgvName.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = info.IsAuto.ToString();
Common.appConfig.AppSettings.Settings[info.FleetID].Value = info.IsAuto.ToString();
Common.appConfig.Save();
System.Configuration.ConfigurationManager.RefreshSection("appSettings");
}
}
} }
private void button1_Click(object sender, EventArgs e)
{
//Common.GetJob();
}
} }
......
...@@ -138,6 +138,9 @@ ...@@ -138,6 +138,9 @@
<metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="Column8.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
......
...@@ -41,10 +41,11 @@ ...@@ -41,10 +41,11 @@
<add key="WebService" value="http://10.85.196.40:8089/"/> <add key="WebService" value="http://10.85.196.40:8089/"/>
<add key="AGV_BATTERY_MAX" value="100"/> <add key="AGV_BATTERY_MAX" value="100"/>
<add key="AGV_BATTERY_MIN" value="60"/> <add key="AGV_BATTERY_MIN" value="60"/>
<add key="4D_Line" value="D1,D2,D3,D4,D5,D6,D8,D9,D10,D11,D12,D14,D15,D16"/> <!--<add key="4D_Line" value="D1,D2,D3,D4,D5,D6,D8,D9,D10,D11,D12,D14,D15,D16"/>
<add key="4C_Line" value="C1,C2,C3,C4,C5,C6,C7,C8,C9,C10"/> <add key="4C_Line" value="C1,C2,C3,C4,C5,C6,C7,C8,C9,C10"/>
<add key="Store" value="4cwash,4dwash,storage"/> <add key="Store" value="4cwash,4dwash,storage"/>-->
<add key="4D_AGV" value="6"/> <add key="PlaceName" value="D1,D2,D3,D4,D5,D6,D8,D9,D10,D11,D12,D14,D15,D16,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,4cwash,4dwash,storage"/>
<add key="4D_AGV" value="3"/>
<add key="4C_AGV" value="32"/> <add key="4C_AGV" value="32"/>
</appSettings> </appSettings>
</configuration> </configuration>
\ No newline at end of file \ No newline at end of file
...@@ -411,6 +411,12 @@ ...@@ -411,6 +411,12 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Model.AgvInfo.Is4DWorkshop">
<summary>
是否在4D车间
</summary>
<returns></returns>
</member>
<member name="M:Model.AgvInfo.IsSteelFull"> <member name="M:Model.AgvInfo.IsSteelFull">
<summary> <summary>
钢板是否已放满 钢板是否已放满
......
...@@ -30,6 +30,6 @@ AutoCharge4C,8ed7b459-f2b0-11ea-8452-94c691a7387d ...@@ -30,6 +30,6 @@ AutoCharge4C,8ed7b459-f2b0-11ea-8452-94c691a7387d
AutoCharge4D,2f0a31b1-f2ab-11ea-8452-94c691a7387d AutoCharge4D,2f0a31b1-f2ab-11ea-8452-94c691a7387d
MoveDoor-4C-4D,d67f31c8-ca7e-11ea-9a66-94c691a7387d MoveDoor-4C-4D,d67f31c8-ca7e-11ea-9a66-94c691a7387d
MoveDoor-4D-4C,fd6e26ac-c1bf-11ea-9a66-94c691a7387d MoveDoor-4D-4C,fd6e26ac-c1bf-11ea-9a66-94c691a7387d
MoveStorage,418c9064-f2ac-11ea-8452-94c691a7387d MoveSteelstorage,418c9064-f2ac-11ea-8452-94c691a7387d
Pickupqisdashelf,f2acdcae-e524-11ea-b003-0001299a3f0e Pickupqisdashelf,f2acdcae-e524-11ea-b003-0001299a3f0e
Placeqisdashelf,4001120d-e525-11ea-b003-0001299a3f0e Placeqisdashelf,4001120d-e525-11ea-b003-0001299a3f0e
\ No newline at end of file \ No newline at end of file
573b11aed246e2ddfaeaaf13f2b3caf88f7d0efd 1010f035bba49815b3022e46603e0845961d0731
...@@ -33,6 +33,10 @@ ...@@ -33,6 +33,10 @@
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.checkBox2 = new System.Windows.Forms.CheckBox(); this.checkBox2 = new System.Windows.Forms.CheckBox();
this.checkBox3 = new System.Windows.Forms.CheckBox(); this.checkBox3 = new System.Windows.Forms.CheckBox();
this.button2 = new System.Windows.Forms.Button();
this.textBox2 = new System.Windows.Forms.TextBox();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.SuspendLayout(); this.SuspendLayout();
// //
// checkBox1 // checkBox1
...@@ -83,11 +87,54 @@ ...@@ -83,11 +87,54 @@
this.checkBox3.Text = "storage"; this.checkBox3.Text = "storage";
this.checkBox3.UseVisualStyleBackColor = true; this.checkBox3.UseVisualStyleBackColor = true;
// //
// button2
//
this.button2.Location = new System.Drawing.Point(12, 131);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(90, 23);
this.button2.TabIndex = 6;
this.button2.Text = "4dwash呼叫";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(216, 12);
this.textBox2.Multiline = true;
this.textBox2.Name = "textBox2";
this.textBox2.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textBox2.Size = new System.Drawing.Size(300, 301);
this.textBox2.TabIndex = 7;
//
// button3
//
this.button3.Location = new System.Drawing.Point(12, 160);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(90, 23);
this.button3.TabIndex = 8;
this.button3.Text = "4cwash呼叫";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(12, 189);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(90, 23);
this.button4.TabIndex = 9;
this.button4.Text = "storage呼叫";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(367, 181); this.ClientSize = new System.Drawing.Size(577, 328);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.button2);
this.Controls.Add(this.checkBox3); this.Controls.Add(this.checkBox3);
this.Controls.Add(this.checkBox2); this.Controls.Add(this.checkBox2);
this.Controls.Add(this.button1); this.Controls.Add(this.button1);
...@@ -107,6 +154,10 @@ ...@@ -107,6 +154,10 @@
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.CheckBox checkBox2; private System.Windows.Forms.CheckBox checkBox2;
private System.Windows.Forms.CheckBox checkBox3; private System.Windows.Forms.CheckBox checkBox3;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
} }
} }
...@@ -26,6 +26,7 @@ namespace Test ...@@ -26,6 +26,7 @@ namespace Test
client.Timeout = -1; client.Timeout = -1;
RestRequest request = new RestRequest(Method.GET); RestRequest request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request); IRestResponse response = client.Execute(request);
textBox2.Text = response.Content;
} }
else if (checkBox2.Checked) else if (checkBox2.Checked)
{ {
...@@ -33,6 +34,7 @@ namespace Test ...@@ -33,6 +34,7 @@ namespace Test
client.Timeout = -1; client.Timeout = -1;
RestRequest request = new RestRequest(Method.GET); RestRequest request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request); IRestResponse response = client.Execute(request);
textBox2.Text = response.Content;
} }
else if (checkBox3.Checked) else if (checkBox3.Checked)
{ {
...@@ -40,6 +42,7 @@ namespace Test ...@@ -40,6 +42,7 @@ namespace Test
client.Timeout = -1; client.Timeout = -1;
RestRequest request = new RestRequest(Method.GET); RestRequest request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request); IRestResponse response = client.Execute(request);
textBox2.Text = response.Content;
} }
else else
{ {
...@@ -50,6 +53,7 @@ namespace Test ...@@ -50,6 +53,7 @@ namespace Test
client.Timeout = -1; client.Timeout = -1;
RestRequest request = new RestRequest(Method.GET); RestRequest request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request); IRestResponse response = client.Execute(request);
textBox2.Text = response.Content;
System.Threading.Thread.Sleep(500); System.Threading.Thread.Sleep(500);
} }
} }
...@@ -57,5 +61,35 @@ namespace Test ...@@ -57,5 +61,35 @@ namespace Test
MessageBox.Show("OK"); MessageBox.Show("OK");
} }
private void button2_Click(object sender, EventArgs e)
{
RestClient client = new RestClient("http://10.85.196.40:8089/StealAgv/sendNew?from=4dwash&place=4dwash");
client.Timeout = -1;
RestRequest request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
textBox2.Text = response.Content;
MessageBox.Show("OK");
}
private void button3_Click(object sender, EventArgs e)
{
RestClient client = new RestClient("http://10.85.196.40:8089/StealAgv/sendNew?from=4cwash&place=4cwash");
client.Timeout = -1;
RestRequest request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
textBox2.Text = response.Content;
MessageBox.Show("OK");
}
private void button4_Click(object sender, EventArgs e)
{
RestClient client = new RestClient("http://10.85.196.40:8089/StealAgv/sendNew?from=storage&place=storage");
client.Timeout = -1;
RestRequest request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
textBox2.Text = response.Content;
MessageBox.Show("OK");
}
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!