Commit 954c4ece 刘韬

1

1 个父辈 ac41f2a3
...@@ -36,6 +36,10 @@ namespace OnlineStore.Common ...@@ -36,6 +36,10 @@ namespace OnlineStore.Common
[MyConfigComment("右侧接驳台出入模式")] [MyConfigComment("右侧接驳台出入模式")]
public static MyConfig<InOutModeE> Device_RightInoutMode = InOutModeE.Both; public static MyConfig<InOutModeE> Device_RightInoutMode = InOutModeE.Both;
[MyConfigComment("屏蔽进出轴伸出时的层信号检查")]
public static MyConfig<bool> Device_DisableFloorCheck = false;
[MyConfigComment("扫码识别类型")] [MyConfigComment("扫码识别类型")]
public static MyConfig<string[]> CodeScan_CodeType = new string[] { "QR Code" }; public static MyConfig<string[]> CodeScan_CodeType = new string[] { "QR Code" };
[MyConfigComment("扫码读码数量")] [MyConfigComment("扫码读码数量")]
......
...@@ -205,6 +205,10 @@ namespace OnlineStore.Common ...@@ -205,6 +205,10 @@ namespace OnlineStore.Common
/// </summary> /// </summary>
public static string posId = "posId"; public static string posId = "posId";
/// <summary> /// <summary>
/// 工单号
/// </summary>
public static string hSerial = "hSerial";
/// <summary>
/// 料盘宽 /// 料盘宽
/// </summary> /// </summary>
public static string plateW = "plateW"; public static string plateW = "plateW";
......
using System; using Newtonsoft.Json;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
...@@ -110,32 +111,15 @@ namespace OnlineStore.Common ...@@ -110,32 +111,15 @@ namespace OnlineStore.Common
return result; return result;
} }
static object lockpost = new object(); static object lockpost = new object();
public static Operation Post(string url, Operation operation, bool simulate, bool printlog=false) public static T Post<T>(string url, T operation, bool simulate, bool printlog=false)
{ {
try try
{ {
if (simulate)
{//模拟服务器返回
operation.status = 200;
operation.data.Clear();
operation.data.Add("posId", "A001");
string pos = "D100-111#D102-222#D104-333";
operation.data.Add("pos", pos);
if (operation.op == 1 || operation.op == 2)
{//入库或出库
string json = JsonHelper.SerializeObject(operation);
LogUtil.error( "模拟HTTP服务器返回出库入库信息:" + json);
return operation;
}
}
else
{
//lock (lockpost) //lock (lockpost)
{ {
string json = JsonHelper.SerializeObject(operation); string json = JsonConvert.SerializeObject(operation);
string result = Post(url, json,2000); string result = Post(url, json, 2000);
Operation op = JsonHelper.DeserializeJsonToObject<Operation>(result); T op = JsonConvert.DeserializeObject<T>(result);
if (printlog) if (printlog)
{ {
...@@ -143,13 +127,13 @@ namespace OnlineStore.Common ...@@ -143,13 +127,13 @@ namespace OnlineStore.Common
} }
return op; return op;
} }
}
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("Post 出错【operation.op=" + operation.op + "】:" + ex); LogUtil.error("Post 出错:" + ex);
} }
return null; return default;
} }
public static string Get(string url) public static string Get(string url)
{ {
......
...@@ -56,6 +56,9 @@ ...@@ -56,6 +56,9 @@
<Reference Include="Neotel.Rmaxis"> <Reference Include="Neotel.Rmaxis">
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\Neotel.Rmaxis.dll</HintPath> <HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\Neotel.Rmaxis.dll</HintPath>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SdkApi.Core"> <Reference Include="SdkApi.Core">
<HintPath>..\..\LinkOS-PC-Samples-ZSDK_DevDemos_.NET\Source\Sdk\SdkApi.Core.dll</HintPath> <HintPath>..\..\LinkOS-PC-Samples-ZSDK_DevDemos_.NET\Source\Sdk\SdkApi.Core.dll</HintPath>
</Reference> </Reference>
...@@ -148,6 +151,7 @@ ...@@ -148,6 +151,7 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Config\CameraB.json"> <None Include="Config\CameraB.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
......
...@@ -131,18 +131,15 @@ namespace DeviceLibrary ...@@ -131,18 +131,15 @@ namespace DeviceLibrary
try try
{ {
Task[] cameraTask = new Task[cameraNameList.Count()];
for (int ii = 0; ii < cameraNameList.Count(); ii++) for (int ii = 0; ii < cameraNameList.Count(); ii++)
{ {
var cameraName = cameraNameList[ii]; var cameraName = cameraNameList[ii];
cameraTask[ii] = Task.Run(new Action(() =>
{
int retrytime = 0; int retrytime = 0;
retry: retry:
LogUtil.info($"【" + cameraName + "】开始取图片"); LogUtil.info($"【" + cameraName + "】开始取图片");
if (cameraName.Trim().Equals("")) if (cameraName.Trim().Equals(""))
{ {
return; continue;
} }
DateTime startTime = DateTime.Now; DateTime startTime = DateTime.Now;
HalconDotNet.HObject ho_Image = null; HalconDotNet.HObject ho_Image = null;
...@@ -154,9 +151,10 @@ namespace DeviceLibrary ...@@ -154,9 +151,10 @@ namespace DeviceLibrary
if (bmp == null) if (bmp == null)
{ {
if (retrytime > 2) if (retrytime > 2)
return; continue;
retrytime++; retrytime++;
LogUtil.info($"bitmap为空重试第{retrytime}次"); LogUtil.info($"bitmap为空重试第{retrytime}次");
CloseCamera(cameraName);
Task.Delay(1500).Wait(); Task.Delay(1500).Wait();
goto retry; goto retry;
} }
...@@ -165,7 +163,7 @@ namespace DeviceLibrary ...@@ -165,7 +163,7 @@ namespace DeviceLibrary
{ {
LogUtil.error(" 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机"); LogUtil.error(" 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机");
CloseCamera(cameraName); CloseCamera(cameraName);
return; continue;
} }
camera_event?.Invoke(null, bmp); camera_event?.Invoke(null, bmp);
LogUtil.info(" 【" + cameraName + "】取图片完成,开始扫码"); LogUtil.info(" 【" + cameraName + "】取图片完成,开始扫码");
...@@ -179,7 +177,7 @@ namespace DeviceLibrary ...@@ -179,7 +177,7 @@ namespace DeviceLibrary
List<CodeInfo> cc = new List<CodeInfo>(); List<CodeInfo> cc = new List<CodeInfo>();
cc = RemoteDecodeHelper.DecodeRequest(bmp, remoteDecodeParam); cc = RemoteDecodeHelper.DecodeRequest(bmp, remoteDecodeParam);
if (cc != null) if (cc != null && cc.Count > 0)
{ {
lock (codeList) lock (codeList)
{ {
...@@ -220,16 +218,8 @@ namespace DeviceLibrary ...@@ -220,16 +218,8 @@ namespace DeviceLibrary
if (bmp != null) if (bmp != null)
bmp.Dispose(); bmp.Dispose();
} }
}));
Task.Delay(ii * 500).Wait();
} }
while (!cameraTask[0].IsCompleted || !cameraTask[1].IsCompleted)
{
Application.DoEvents();
Thread.Sleep(100);
}
} }
catch (AccessViolationException e) catch (AccessViolationException e)
{ {
......
...@@ -50,6 +50,8 @@ namespace DeviceLibrary ...@@ -50,6 +50,8 @@ namespace DeviceLibrary
moveInfo.log($"{axisBean.AxisName},已在位置,无需上升"); moveInfo.log($"{axisBean.AxisName},已在位置,无需上升");
return; return;
} }
if (!axisBean.IsServeoOn)
axisBean.Open(true, out string msg);
IOManager.IOMove(axisbreak,IO_VALUE.HIGH); IOManager.IOMove(axisbreak,IO_VALUE.HIGH);
Thread.Sleep(200); Thread.Sleep(200);
axisBean.RelMove(StrokeLength, (double)upspeed); axisBean.RelMove(StrokeLength, (double)upspeed);
...@@ -90,6 +92,8 @@ namespace DeviceLibrary ...@@ -90,6 +92,8 @@ namespace DeviceLibrary
moveInfo.log($"{axisBean.AxisName},已在位置,无需下降"); moveInfo.log($"{axisBean.AxisName},已在位置,无需下降");
return; return;
} }
if (!axisBean.IsServeoOn)
axisBean.Open(true, out string msg);
IOManager.IOMove(axisbreak, IO_VALUE.HIGH); IOManager.IOMove(axisbreak, IO_VALUE.HIGH);
Thread.Sleep(200); Thread.Sleep(200);
axisBean.RelMove(-StrokeLength, (double)downspeed); axisBean.RelMove(-StrokeLength, (double)downspeed);
......
using OnlineStore; using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using OnlineStore;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
...@@ -48,7 +50,11 @@ namespace DeviceLibrary ...@@ -48,7 +50,11 @@ namespace DeviceLibrary
{ {
if (!RobotManage.isRunning) if (!RobotManage.isRunning)
ProcessMsg(Msg.msg); ProcessMsg(Msg.msg);
if (!string.IsNullOrEmpty(server))
{
SendLineStatus(); SendLineStatus();
SendDoorStatus();
}
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -215,6 +221,23 @@ namespace DeviceLibrary ...@@ -215,6 +221,23 @@ namespace DeviceLibrary
} }
return host + api_communication; return host + api_communication;
} }
public static string GetPostApi(string api)
{
var host = server;
if (!host.StartsWith("http://"))
{
host = "http://" + host;
}
if (!host.EndsWith("/"))
{
host = host + "/";
}
if (api.StartsWith("/"))
{
api = api.Substring(1);
}
return host + api;
}
int getthtime = 0; int getthtime = 0;
public void SendLineStatus() public void SendLineStatus()
{ {
...@@ -289,6 +312,7 @@ namespace DeviceLibrary ...@@ -289,6 +312,7 @@ namespace DeviceLibrary
string posId = data[ParamDefine.posId]; string posId = data[ParamDefine.posId];
int.TryParse(data[ParamDefine.plateW], out int plateW); int.TryParse(data[ParamDefine.plateW], out int plateW);
int.TryParse(data[ParamDefine.plateH], out int plateH); int.TryParse(data[ParamDefine.plateH], out int plateH);
string hSerial = "";// data[ParamDefine.hSerial];
//string[] posArray = posId.Split('#'); //string[] posArray = posId.Split('#');
//if (!(posArray.Length == 2)) //if (!(posArray.Length == 2))
//{ //{
...@@ -313,10 +337,10 @@ namespace DeviceLibrary ...@@ -313,10 +337,10 @@ namespace DeviceLibrary
if (inOutDevice.IsInStoreReady) if (inOutDevice.IsInStoreReady)
{ {
WarnMsg = ""; WarnMsg = "";
JobInfo inStoreJob = new JobInfo(message, posId); JobInfo inStoreJob = new JobInfo(message, posId,hSerial);
inOutDevice.StartInStore(inStoreJob); inOutDevice.StartInStore(inStoreJob);
//如果当前正在出入库中,需要记录下来,等待空闲时执行 //如果当前正在出入库中,需要记录下来,等待空闲时执行
LogUtil.info(StoreName + " 收到服务器入库命令:库位号【" + posId + "】二维码【" + message + "】 开始入库!"); LogUtil.info(StoreName + " 收到服务器入库命令:库位号【" + posId + "】二维码【" + message + "】 工单号[+"+ hSerial + "]开始入库!");
} }
else else
{ {
...@@ -379,6 +403,9 @@ namespace DeviceLibrary ...@@ -379,6 +403,9 @@ namespace DeviceLibrary
string plateWStr = data[ParamDefine.plateW]; string plateWStr = data[ParamDefine.plateW];
string plateHStr = data[ParamDefine.plateH]; string plateHStr = data[ParamDefine.plateH];
string singleOut = data[ParamDefine.singleOut]; string singleOut = data[ParamDefine.singleOut];
string hSerials = "";
if (data.ContainsKey(ParamDefine.hSerial))
hSerials = data[ParamDefine.hSerial];
LogUtil.info("收到服务器出库消息:poaIs=" + posIdStr + ",platew=" + plateWStr + ",plateh=" + plateHStr + ",singleOut=" + singleOut); LogUtil.info("收到服务器出库消息:poaIs=" + posIdStr + ",platew=" + plateWStr + ",plateh=" + plateHStr + ",singleOut=" + singleOut);
char splitChar = '|'; char splitChar = '|';
...@@ -386,6 +413,7 @@ namespace DeviceLibrary ...@@ -386,6 +413,7 @@ namespace DeviceLibrary
string[] plateWArray = plateWStr.Split(splitChar); string[] plateWArray = plateWStr.Split(splitChar);
string[] plateHArray = plateHStr.Split(splitChar); string[] plateHArray = plateHStr.Split(splitChar);
string[] singleOutArray = singleOut.Split(splitChar); string[] singleOutArray = singleOut.Split(splitChar);
//string[] hSerialArray = hSerials.Split(splitChar);
int index = -1; int index = -1;
foreach (string posId in posIdArray) foreach (string posId in posIdArray)
{ {
...@@ -394,6 +422,10 @@ namespace DeviceLibrary ...@@ -394,6 +422,10 @@ namespace DeviceLibrary
int.TryParse(plateHArray[index], out int plateH); int.TryParse(plateHArray[index], out int plateH);
bool isSingleOut = singleOutArray[index].ToLower().Equals("true"); bool isSingleOut = singleOutArray[index].ToLower().Equals("true");
string hSerial = hSerials;
//if(hSerialArray.Length>= index+1)
// hSerial=hSerialArray[index];
//根据发送的posId获取位置列表 //根据发送的posId获取位置列表
ACStorePosition position = CSVPositionReader<ACStorePosition>.GetPositon(posId); ACStorePosition position = CSVPositionReader<ACStorePosition>.GetPositon(posId);
if (position == null) if (position == null)
...@@ -405,7 +437,7 @@ namespace DeviceLibrary ...@@ -405,7 +437,7 @@ namespace DeviceLibrary
} }
else else
{ {
RobotManage.mainMachine.AddOutStoreTask(posId); RobotManage.mainMachine.AddOutStoreTask(posId, hSerial);
} }
} }
TimeSpan span = DateTime.Now - time; TimeSpan span = DateTime.Now - time;
...@@ -465,8 +497,12 @@ namespace DeviceLibrary ...@@ -465,8 +497,12 @@ namespace DeviceLibrary
path = path.Substring(0, path.Length - 1); path = path.Substring(0, path.Length - 1);
return path; return path;
} }
public void SendDoorStatus()
{
foreach(var dev in InOutDevice.InOutDeviceList) {
HttpHelper.Post<DoorInfo>(GetPostApi("/api/xlc/updateDoorInfo"), dev.Value.DoorInfo, false);
}
}
} }
public class ResultData public class ResultData
{ {
...@@ -542,4 +578,34 @@ namespace DeviceLibrary ...@@ -542,4 +578,34 @@ namespace DeviceLibrary
/// </summary> /// </summary>
InStoreError = 14, InStoreError = 14,
} }
public class DoorInfo {
public DoorInfo(doorIndexE doorIndexE) {
doorIndex = doorIndexE;
status = doorStatusE.free;
hasContainer = false;
hSerial = "";
}
public doorIndexE doorIndex;
public doorStatusE status;
public bool hasContainer;
public string hSerial;
}
public enum doorIndexE {
LeftIn=2,
LeftOut=1,
RightIn=4,
RightOut=3,
}
public enum doorStatusE
{
free=1,
inStore=2,
outStore=3,
needBox=4,
fullBoxNeedLeave=5
}
} }
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" requireReinstallation="true" /> <package id="System.ValueTuple" version="4.5.0" targetFramework="net461" requireReinstallation="true" />
</packages> </packages>
\ No newline at end of file \ No newline at end of file
...@@ -283,6 +283,10 @@ namespace DeviceLibrary ...@@ -283,6 +283,10 @@ namespace DeviceLibrary
public bool IsBusy { public bool IsBusy {
get => AxisManager.GetBusyStatus(Config.DeviceName, Config.GetAxisValue()) == 1; get => AxisManager.GetBusyStatus(Config.DeviceName, Config.GetAxisValue()) == 1;
} }
public bool IsServeoOn
{
get => AxisManager.IsServeoOn(Config.DeviceName, Config.GetAxisValue());
}
public void SuddenStop() public void SuddenStop()
{ {
AxisManager.SuddenStop(Config.DeviceName, Config.GetAxisValue()); AxisManager.SuddenStop(Config.DeviceName, Config.GetAxisValue());
......
...@@ -66,10 +66,10 @@ namespace DeviceLibrary ...@@ -66,10 +66,10 @@ namespace DeviceLibrary
From = from.clone(); From = from.clone();
To = to.clone(); To = to.clone();
MoveInfo.NewMove(MoveStep.StoreTS01); MoveInfo.NewMove(MoveStep.StoreTS01);
MoveInfo.log($"{storeMoveType}:开始运输周转箱,从:{from.posid},到:{to.posid}"); MoveInfo.log($"{storeMoveType}:开始运输周转箱,从:{From.posid},到:{To.posid}");
} }
MoveInfo.MoveParam.WareCode = WareCode; MoveInfo.MoveParam.WareCode = WareCode;
MoveInfo.MoveParam.PosID = $"{From.posid}=>{To.posid}"; MoveInfo.MoveParam.PosID = $"{(From==null?"None":From.posid)}=>{To.posid}";
ErrMsgTxt = ""; ErrMsgTxt = "";
return true; return true;
//thread = new Thread(new ThreadStart(Run)); //thread = new Thread(new ThreadStart(Run));
...@@ -110,6 +110,24 @@ namespace DeviceLibrary ...@@ -110,6 +110,24 @@ namespace DeviceLibrary
if (MoveInfo.MoveStep != MoveStep.StoreTS05) if (MoveInfo.MoveStep != MoveStep.StoreTS05)
return false; return false;
if (From.posid == BoxStorePosition.rightdoor || From.posid == BoxStorePosition.leftdoor)
{
if (InOutDevice.InOutDeviceList[From.CurrentSide].InWaitBoxLeave)
{
MoveInfo.NextMoveStep(MoveStep.StoreTS06);
MoveInfo.log($"{storeMoveType}:{From.CurrentSide}:防护门打开");
InOutDevice.InOutDeviceList[From.CurrentSide].OpenDoor(MoveInfo);
}
else
{
if (MoveInfo.IsTimeOut(10))
{
Msg.add("等待入库料箱升降台到位", MsgLevel.warning);
MoveInfo.log($"{storeMoveType}:等待入库料箱升降台到位");
}
}
}else
MoveInfo.NextMoveStep(MoveStep.StoreTS06); MoveInfo.NextMoveStep(MoveStep.StoreTS06);
return true; return true;
} }
...@@ -126,13 +144,13 @@ namespace DeviceLibrary ...@@ -126,13 +144,13 @@ namespace DeviceLibrary
if (IOManager.IOValue(IO_Type.SideA_ForkMaterial_Check).Equals(IO_VALUE.HIGH) || if (IOManager.IOValue(IO_Type.SideA_ForkMaterial_Check).Equals(IO_VALUE.HIGH) ||
IOManager.IOValue(IO_Type.SideB_ForkMaterial_Check).Equals(IO_VALUE.HIGH)) IOManager.IOValue(IO_Type.SideB_ForkMaterial_Check).Equals(IO_VALUE.HIGH))
{ {
Msg.add("伸缩叉2侧X10/X11检测到有物料无法继续,请检查", MsgLevel.alarm); Msg.add("伸缩叉2侧X06/X07检测到有物料无法继续,请检查", MsgLevel.alarm);
RobotManage.UserPause("伸缩叉2侧X10,X11检测到有物料无法继续,请检查"); RobotManage.UserPause("伸缩叉2侧X06/X07检测到有物料无法继续,请检查");
} }
else if (IOManager.IOValue(IO_Type.ForkMaterial_Check).Equals(IO_VALUE.HIGH)) else if (IOManager.IOValue(IO_Type.ForkMaterial_Check).Equals(IO_VALUE.HIGH))
{ {
Msg.add("出库时伸缩叉X09检测到有物料无法继续,请检查", MsgLevel.alarm); Msg.add("出库时伸缩叉X05检测到有物料无法继续,请检查", MsgLevel.alarm);
RobotManage.UserPause("出库时伸缩叉X09检测到有物料无法继续,请检查"); RobotManage.UserPause("出库时伸缩叉X05检测到有物料无法继续,请检查");
} }
else else
{ {
...@@ -164,22 +182,30 @@ namespace DeviceLibrary ...@@ -164,22 +182,30 @@ namespace DeviceLibrary
case MoveStep.StoreTS05: case MoveStep.StoreTS05:
if (!PreMove) if (!PreMove)
{ {
if (From.posid == BoxStorePosition.rightdoor || From.posid == BoxStorePosition.leftdoor) //if (From.posid == BoxStorePosition.rightdoor || From.posid == BoxStorePosition.leftdoor)
{ //{
if (InOutDevice.InOutDeviceList[From.CurrentSide].InWaitBoxLeave) // if (InOutDevice.InOutDeviceList[From.CurrentSide].InWaitBoxLeave)
{ // {
MoveInfo.NextMoveStep(MoveStep.StoreTS06); // MoveInfo.NextMoveStep(MoveStep.StoreTS06);
} // MoveInfo.log($"{storeMoveType}:{From.CurrentSide}:防护门打开");
else // InOutDevice.InOutDeviceList[From.CurrentSide].OpenDoor(MoveInfo);
{ // }
if (MoveInfo.IsTimeOut(10)) // else
{ // {
Msg.add("等待入库料箱升降台到位", MsgLevel.warning); // if (MoveInfo.IsTimeOut(10))
MoveInfo.log($"{storeMoveType}:等待入库料箱升降台到位"); // {
} // Msg.add("等待入库料箱升降台到位", MsgLevel.warning);
} // MoveInfo.log($"{storeMoveType}:等待入库料箱升降台到位");
} // }
else // }
//}
//else
//{
// MoveInfo.NextMoveStep(MoveStep.StoreTS06);
// MoveInfo.log($"{BoxStorePosition.rightdoor}:{BoxStorePosition.leftdoor}");
// MoveInfo.log($"{storeMoveType}:{From.posid}:{From.posid == BoxStorePosition.rightdoor}:{From.posid == BoxStorePosition.leftdoor}");
//}
MoveInfo.NextMoveStep(MoveStep.StoreTS06); MoveInfo.NextMoveStep(MoveStep.StoreTS06);
} }
break; break;
...@@ -207,18 +233,20 @@ namespace DeviceLibrary ...@@ -207,18 +233,20 @@ namespace DeviceLibrary
if (IOManager.IOValue(IO_Type.SideA_ForkMaterial_Check).Equals(IO_VALUE.HIGH) || if (IOManager.IOValue(IO_Type.SideA_ForkMaterial_Check).Equals(IO_VALUE.HIGH) ||
IOManager.IOValue(IO_Type.SideB_ForkMaterial_Check).Equals(IO_VALUE.HIGH)) IOManager.IOValue(IO_Type.SideB_ForkMaterial_Check).Equals(IO_VALUE.HIGH))
{ {
Msg.add("伸缩叉2侧X10/X11检测到有物料无法继续,请检查", MsgLevel.alarm); Msg.add("伸缩叉2侧X06/X07检测到有物料无法继续,请检查", MsgLevel.alarm);
RobotManage.UserPause("伸缩叉2侧X10/X11检测到有物料无法继续,请检查"); RobotManage.UserPause("伸缩叉2侧X06/X07检测到有物料无法继续,请检查");
} }
else if (!IgnoreX09 && IOManager.IOValue(IO_Type.ForkMaterial_Check).Equals(IO_VALUE.LOW)) else if (!IgnoreX09 && IOManager.IOValue(IO_Type.ForkMaterial_Check).Equals(IO_VALUE.LOW))
{ {
Msg.add("出库时伸缩叉X09没有检测到有物料无法继续,请检查", MsgLevel.alarm,ErrInfo.X09_BoxNotDetect); Msg.add("出库时伸缩叉X05没有检测到有物料无法继续,请检查", MsgLevel.alarm,ErrInfo.X09_BoxNotDetect);
RobotManage.UserPause("出库时伸缩叉X09没有检测到有物料无法继续,请检查"); RobotManage.UserPause("出库时伸缩叉X05没有检测到有物料无法继续,请检查");
} }
else else
{ {
IgnoreX09 = false; IgnoreX09 = false;
MoveInfo.NextMoveStep(MoveStep.StoreTS10); MoveInfo.NextMoveStep(MoveStep.StoreTS10);
if (From.posid == BoxStorePosition.rightdoor || From.posid == BoxStorePosition.leftdoor)
InOutDevice.InOutDeviceList[From.CurrentSide].CloseDoor(MoveInfo);
if (isNotSameSide(To.Xaxis_P2, To.Yaxis_PL)) if (isNotSameSide(To.Xaxis_P2, To.Yaxis_PL))
{ {
YAxis.AbsMove(MoveInfo, Config.Yaxis_P1, Config.Yaxis_P1_speed); YAxis.AbsMove(MoveInfo, Config.Yaxis_P1, Config.Yaxis_P1_speed);
...@@ -243,7 +271,10 @@ namespace DeviceLibrary ...@@ -243,7 +271,10 @@ namespace DeviceLibrary
Msg.add("等待出口顶升清空周转箱", MsgLevel.warning); Msg.add("等待出口顶升清空周转箱", MsgLevel.warning);
return false; return false;
} }
} MoveInfo.NextMoveStep(MoveStep.StoreTS12);
InOutDevice.InOutDeviceList[To.CurrentSide].OpenDoor(MoveInfo);
return false;
}else
MoveInfo.NextMoveStep(MoveStep.StoreTS12); MoveInfo.NextMoveStep(MoveStep.StoreTS12);
break; break;
case MoveStep.StoreTS12: case MoveStep.StoreTS12:
...@@ -272,17 +303,19 @@ namespace DeviceLibrary ...@@ -272,17 +303,19 @@ namespace DeviceLibrary
if (IOManager.IOValue(IO_Type.SideA_ForkMaterial_Check).Equals(IO_VALUE.HIGH) || if (IOManager.IOValue(IO_Type.SideA_ForkMaterial_Check).Equals(IO_VALUE.HIGH) ||
IOManager.IOValue(IO_Type.SideB_ForkMaterial_Check).Equals(IO_VALUE.HIGH)) IOManager.IOValue(IO_Type.SideB_ForkMaterial_Check).Equals(IO_VALUE.HIGH))
{ {
Msg.add("伸缩叉2侧X10/X11检测到有物料无法继续,请检查", MsgLevel.alarm); Msg.add("伸缩叉2侧X06/X07检测到有物料无法继续,请检查", MsgLevel.alarm);
RobotManage.UserPause("伸缩叉2侧X10/X11检测到有物料无法继续,请检查"); RobotManage.UserPause("伸缩叉2侧X06/X07检测到有物料无法继续,请检查");
} }
else if (IOManager.IOValue(IO_Type.ForkMaterial_Check).Equals(IO_VALUE.HIGH)) else if (IOManager.IOValue(IO_Type.ForkMaterial_Check).Equals(IO_VALUE.HIGH))
{ {
Msg.add("入库后伸缩叉X09上任然检测到物料,请检查", MsgLevel.alarm); Msg.add("入库后伸缩叉X05上任然检测到物料,请检查", MsgLevel.alarm);
RobotManage.UserPause("入库后伸缩叉X09上任然检测到物料,请检查"); RobotManage.UserPause("入库后伸缩叉X05上任然检测到物料,请检查");
} }
else else
{ {
MoveInfo.NextMoveStep(MoveStep.StoreTS16); MoveInfo.NextMoveStep(MoveStep.StoreTS16);
if (To.posid == BoxStorePosition.rightdoor || To.posid == BoxStorePosition.leftdoor)
InOutDevice.InOutDeviceList[To.CurrentSide].CloseDoor(MoveInfo);
MoveInfo.log($"{storeMoveType}:安全检查"); MoveInfo.log($"{storeMoveType}:安全检查");
} }
break; break;
......
...@@ -56,7 +56,7 @@ namespace DeviceLibrary ...@@ -56,7 +56,7 @@ namespace DeviceLibrary
Robot_Config Config; Robot_Config Config;
MainMachine mainMachine; MainMachine mainMachine;
public string Name; public string Name;
public DoorInfo DoorInfo=new DoorInfo(doorIndexE.LeftIn);
public InOutDevice(InOutSideE inOutSide, InOutModeE inOutMode, Robot_Config _Config, MainMachine _mainMachine) public InOutDevice(InOutSideE inOutSide, InOutModeE inOutMode, Robot_Config _Config, MainMachine _mainMachine)
{ {
AxisBean Lift_Moto; AxisBean Lift_Moto;
...@@ -181,6 +181,48 @@ namespace DeviceLibrary ...@@ -181,6 +181,48 @@ namespace DeviceLibrary
InProcess(); InProcess();
else if (CurrnetDirection == InOutDirectionE.OUT) else if (CurrnetDirection == InOutDirectionE.OUT)
OutProcess(); OutProcess();
if (CurrnetDirection == InOutDirectionE.IN)
{
if (InOutSide == InOutSideE.Left)
DoorInfo.doorIndex = doorIndexE.LeftIn;
else if (InOutSide == InOutSideE.Right)
DoorInfo.doorIndex = doorIndexE.RightIn;
DoorInfo.hSerial = MoveInfo.MoveParam.hSerial;
DoorInfo.status = doorStatusE.inStore;
DoorInfo.hasContainer = false;
}
else if (CurrnetDirection == InOutDirectionE.OUT)
{
if (InOutSide == InOutSideE.Left)
DoorInfo.doorIndex = doorIndexE.LeftOut;
else if (InOutSide == InOutSideE.Right)
DoorInfo.doorIndex = doorIndexE.RightOut;
DoorInfo.hSerial = MoveInfo.MoveParam.hSerial;
DoorInfo.status = doorStatusE.outStore;
DoorInfo.hasContainer = true;
if (MoveInfo.MoveStep == MoveStep.OutWaitAgv)
{
DoorInfo.status = doorStatusE.fullBoxNeedLeave;
}
}
else
{
if (CanIn(out string msg))
{
if (InOutSide == InOutSideE.Left)
DoorInfo.doorIndex = doorIndexE.LeftIn;
else if (InOutSide == InOutSideE.Right)
DoorInfo.doorIndex = doorIndexE.RightIn;
DoorInfo.status = doorStatusE.needBox;
DoorInfo.hasContainer = false;
}
}
} }
public bool CanIn(out string msg) public bool CanIn(out string msg)
{ {
......
...@@ -23,6 +23,15 @@ namespace DeviceLibrary ...@@ -23,6 +23,15 @@ namespace DeviceLibrary
{ {
get => MoveInfo.MoveStep == MoveStep.InWaitBoxLeave; get => MoveInfo.MoveStep == MoveStep.InWaitBoxLeave;
} }
public void OpenDoor(MoveInfo moveInfo) {
LogUtil.info($"OpenDoor:low:{DO_Door_Down},up:{DO_Door_Up}");
MainMachine.CylinderMove(moveInfo, DO_Door_Down, DO_Door_Up, IO_VALUE.HIGH);
}
public void CloseDoor(MoveInfo moveInfo)
{
MainMachine.CylinderMove(moveInfo, DO_Door_Down, DO_Door_Up, IO_VALUE.LOW);
}
/// <summary> /// <summary>
/// if (InMoveInfo.MoveStep == MoveStep.InWaitServerCallback) /// if (InMoveInfo.MoveStep == MoveStep.InWaitServerCallback)
/// </summary> /// </summary>
...@@ -34,6 +43,7 @@ namespace DeviceLibrary ...@@ -34,6 +43,7 @@ namespace DeviceLibrary
{ {
MoveInfo.MoveParam.WareCode = jobInfo.WareNum; MoveInfo.MoveParam.WareCode = jobInfo.WareNum;
MoveInfo.MoveParam.PosID = jobInfo.PosId; MoveInfo.MoveParam.PosID = jobInfo.PosId;
MoveInfo.MoveParam.hSerial = jobInfo.hSerial;
MoveInfo.NextMoveStep(MoveStep.StartInStore); MoveInfo.NextMoveStep(MoveStep.StartInStore);
return true; return true;
} }
...@@ -60,7 +70,7 @@ namespace DeviceLibrary ...@@ -60,7 +70,7 @@ namespace DeviceLibrary
MoveInfo.log("线体正转,放下前阻挡"); MoveInfo.log("线体正转,放下前阻挡");
break; break;
case MoveStep.AgvIn01: case MoveStep.AgvIn01:
MoveInfo.NextMoveStep(MoveStep.In03); MoveInfo.NextMoveStep(MoveStep.In02);
Line.LineRun("work", false, 10); Line.LineRun("work", false, 10);
MiddleStop(MoveInfo, IO_VALUE.HIGH); MiddleStop(MoveInfo, IO_VALUE.HIGH);
FrontStop(MoveInfo, IO_VALUE.LOW); FrontStop(MoveInfo, IO_VALUE.LOW);
...@@ -70,7 +80,7 @@ namespace DeviceLibrary ...@@ -70,7 +80,7 @@ namespace DeviceLibrary
if (IOValue(IO_F_Stop_Out).Equals(IO_VALUE.HIGH)) if (IOValue(IO_F_Stop_Out).Equals(IO_VALUE.HIGH))
{ {
MoveInfo.NextMoveStep(MoveStep.In03); MoveInfo.NextMoveStep(MoveStep.In03);
Lift.LiftDown(MoveInfo); Lift.LiftDown(null);
MoveInfo.log("检测到周转箱2,升降台下降,前往中间阻挡"); MoveInfo.log("检测到周转箱2,升降台下降,前往中间阻挡");
} }
else if (MoveInfo.IsTimeOut(3)) else if (MoveInfo.IsTimeOut(3))
...@@ -84,7 +94,8 @@ namespace DeviceLibrary ...@@ -84,7 +94,8 @@ namespace DeviceLibrary
if (IOValue(IO_M_Stop_In).Equals(IO_VALUE.HIGH)) if (IOValue(IO_M_Stop_In).Equals(IO_VALUE.HIGH))
{ {
Line.LineStop("work"); Line.LineStop("work");
MoveInfo.NextMoveStep(MoveStep.InWaitServerCallback); MoveInfo.NextMoveStep(MoveStep.In04);
Lift.LiftDown(MoveInfo);
FrontStop(MoveInfo, IO_VALUE.HIGH); FrontStop(MoveInfo, IO_VALUE.HIGH);
ScanCode(100); ScanCode(100);
MoveInfo.log("开始扫码,入口阻挡上升, 线体停止"); MoveInfo.log("开始扫码,入口阻挡上升, 线体停止");
...@@ -105,6 +116,7 @@ namespace DeviceLibrary ...@@ -105,6 +116,7 @@ namespace DeviceLibrary
var x = InScanTask.Result; var x = InScanTask.Result;
if (x.Count == 0) if (x.Count == 0)
{ {
//MoveInfo.NextMoveStep(MoveStep.InWaitServerCallback);
MoveInfo.NextMoveStep(MoveStep.In03); MoveInfo.NextMoveStep(MoveStep.In03);
MoveInfo.log($"未识别到有效二维码,重新拍照"); MoveInfo.log($"未识别到有效二维码,重新拍照");
return; return;
...@@ -128,8 +140,8 @@ namespace DeviceLibrary ...@@ -128,8 +140,8 @@ namespace DeviceLibrary
case MoveStep.InWaitServerCallback: case MoveStep.InWaitServerCallback:
if (RobotManage.InoutDebugMode) if (RobotManage.InoutDebugMode)
{ {
Msg.add("等待手动选择入库库位", MsgLevel.info); //Msg.add("等待手动选择入库库位", MsgLevel.info);
MoveInfo.NextMoveStep(MoveStep.StartInStore);
} }
else if (MoveInfo.IsTimeOut(5)) else if (MoveInfo.IsTimeOut(5))
Msg.add("等待服务器返回库位", MsgLevel.info); Msg.add("等待服务器返回库位", MsgLevel.info);
...@@ -236,7 +248,8 @@ namespace DeviceLibrary ...@@ -236,7 +248,8 @@ namespace DeviceLibrary
IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH); IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
Task.Delay(delay).Wait(); Task.Delay(delay).Wait();
List<CodeInfo> LastCodeList; List<CodeInfo> LastCodeList;
LastCodeList = CodeManager.CameraScan(new List<string> { Config.CameraName }); CodeManager.CloseCamera(InOutSide == InOutSideE.Left ? Config.CameraName_Left : Config.CameraName_Right);
LastCodeList = CodeManager.CameraScan(new List<string> { InOutSide== InOutSideE.Left? Config.CameraName_Left: Config.CameraName_Right });
return LastCodeList; return LastCodeList;
})); }));
......
using OnlineStore.LoadCSVLibrary; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -20,7 +21,10 @@ namespace DeviceLibrary ...@@ -20,7 +21,10 @@ namespace DeviceLibrary
if (MoveInfo.MoveStep != MoveStep.Wait) if (MoveInfo.MoveStep != MoveStep.Wait)
return false; return false;
MoveInfo.NewMove(MoveStep.Out01); MoveInfo.NewMove(MoveStep.Out01);
CurrnetDirection = InOutDirectionE.OUT;
MoveInfo.MoveParam.PosID= jobInfo.PosId; MoveInfo.MoveParam.PosID= jobInfo.PosId;
MoveInfo.MoveParam.hSerial= jobInfo.hSerial;
MoveInfo.log("开始出库任务");
return true; return true;
} }
void OutProcess() void OutProcess()
......
...@@ -10,7 +10,7 @@ namespace DeviceLibrary ...@@ -10,7 +10,7 @@ namespace DeviceLibrary
{ {
partial class InOutDevice partial class InOutDevice
{ {
public static bool GetInStoreWaitSide(out InOutSideE inOutSide, out InOutDevice iod) public static bool GetInStoreWaitSide(out InOutSideE inOutSide, out InOutDevice iod, bool dontCheckPosid = false)
{ {
inOutSide = InOutSideE.Left; inOutSide = InOutSideE.Left;
...@@ -19,7 +19,7 @@ namespace DeviceLibrary ...@@ -19,7 +19,7 @@ namespace DeviceLibrary
{ {
var ioddic = InOutDeviceList.ElementAt(i); var ioddic = InOutDeviceList.ElementAt(i);
var InMoveInfo = ioddic.Value.MoveInfo; var InMoveInfo = ioddic.Value.MoveInfo;
if (InMoveInfo.MoveStep >= MoveStep.StartInStore && InMoveInfo.MoveStep <= MoveStep.InWaitBoxLeave && !string.IsNullOrEmpty(InMoveInfo.MoveParam.PosID)) if (InMoveInfo.MoveStep >= MoveStep.StartInStore && InMoveInfo.MoveStep <= MoveStep.InWaitBoxLeave && (!string.IsNullOrEmpty(InMoveInfo.MoveParam.PosID)|| dontCheckPosid))
{ {
inOutSide = ioddic.Key; inOutSide = ioddic.Key;
iod = ioddic.Value; iod = ioddic.Value;
......
...@@ -70,12 +70,13 @@ namespace DeviceLibrary ...@@ -70,12 +70,13 @@ namespace DeviceLibrary
{ {
public JobInfo() public JobInfo()
{ } { }
public JobInfo(string wareNum, string posId) public JobInfo(string wareNum, string posId,string hSerial)
{ {
this.WareNum = wareNum; this.WareNum = wareNum;
this.PosId = posId; this.PosId = posId;
this.plateH = 0; this.plateH = 0;
this.plateW = 0; this.plateW = 0;
this.hSerial = hSerial;
} }
public JobInfo(string wareNum, string posId, int platew, int plateh) public JobInfo(string wareNum, string posId, int platew, int plateh)
{ {
...@@ -104,6 +105,10 @@ namespace DeviceLibrary ...@@ -104,6 +105,10 @@ namespace DeviceLibrary
/// 料盘高 /// 料盘高
/// </summary> /// </summary>
public int plateH { get; set; } public int plateH { get; set; }
/// <summary>
/// 工单号
/// </summary>
public string hSerial { get; set; }
public string ToStr() public string ToStr()
{ {
......
...@@ -76,6 +76,7 @@ namespace DeviceLibrary ...@@ -76,6 +76,7 @@ namespace DeviceLibrary
/// 批次号 /// 批次号
/// </summary> /// </summary>
public string Batch { get; set; } public string Batch { get; set; }
public string hSerial { get; set; }
public int HeightPos = 0; public int HeightPos = 0;
public BoxParam clone() public BoxParam clone()
......
...@@ -17,7 +17,8 @@ namespace DeviceLibrary ...@@ -17,7 +17,8 @@ namespace DeviceLibrary
InOutDevice AutoTestInDevice; InOutDevice AutoTestInDevice;
InOutDevice AutoTestOutDevice; InOutDevice AutoTestOutDevice;
public bool StartAutoInOutTest(int posindex, out string errmsg) bool Singlein = false;
public bool StartAutoInOutTest(int posindex,bool singlein, out string errmsg)
{ {
errmsg = ""; errmsg = "";
if (!boxTransport.IsComplateOrFree) if (!boxTransport.IsComplateOrFree)
...@@ -26,7 +27,7 @@ namespace DeviceLibrary ...@@ -26,7 +27,7 @@ namespace DeviceLibrary
return false; return false;
} }
if(!InOutDevice.GetInStoreWaitSide(out InOutSideE AutoTestInSide, out InOutDevice AutoTestInDevice)) if(!InOutDevice.GetInStoreWaitSide(out InOutSideE AutoTestInSide, out InOutDevice AutoTestInDevice,true))
{ {
errmsg = "入库周转箱没有准备好,无法启动"; errmsg = "入库周转箱没有准备好,无法启动";
return false; return false;
...@@ -38,11 +39,33 @@ namespace DeviceLibrary ...@@ -38,11 +39,33 @@ namespace DeviceLibrary
} }
poslist =CSVPositionReader<ACStorePosition>.getPositionList(); poslist =CSVPositionReader<ACStorePosition>.getPositionList();
AutoInOutTest = true; AutoInOutTest = true;
StopAutoInOut = false; StopAutoInOut = singlein;
CurrentPosIndex = posindex; CurrentPosIndex = posindex;
Singlein = singlein;
//AIOTMoveInfo.NewMove(MoveStep.Wait); //AIOTMoveInfo.NewMove(MoveStep.Wait);
return true; return true;
} }
public bool StartManualOutTest(int posindex, out string errmsg)
{
errmsg = "";
if (!boxTransport.IsComplateOrFree)
{
errmsg = "料仓忙碌中,无法启动";
return false;
}
if (!InOutDevice.GetOutStoreFreeSide(out InOutSideE AutoTestOutSide, out InOutDevice AutoTestOutDevice))
{
errmsg = "出库口有周转箱,无法启动";
return false;
}
poslist = CSVPositionReader<ACStorePosition>.getPositionList();
AutoInOutTest = true;
StopAutoInOut = true;
CurrentPosIndex = posindex;
Singlein = false;
AIOTMoveInfo.NewMove(MoveStep.StoreOut10);
return true;
}
public void StopAutoInOutTest() public void StopAutoInOutTest()
{ {
StopAutoInOut = true; StopAutoInOut = true;
...@@ -63,12 +86,34 @@ namespace DeviceLibrary ...@@ -63,12 +86,34 @@ namespace DeviceLibrary
switch (AIOTMoveInfo.MoveStep) switch (AIOTMoveInfo.MoveStep)
{ {
case MoveStep.Wait: case MoveStep.Wait:
if (InOutDevice.GetInStoreWaitSide(out InOutSideE inOutSide, out InOutDevice iod)) if (AutoInOutTest && InOutDevice.GetInStoreWaitSide(out InOutSideE inOutSide, out InOutDevice iod,true))
{ {
InMoveInfo = iod.MoveInfo; InMoveInfo = iod.MoveInfo;
CurrentSide = inOutSide; CurrentSide = inOutSide;
AIOTMoveInfo.NextMoveStep(MoveStep.StoreIn01); AIOTMoveInfo.NextMoveStep(MoveStep.StoreIn01);
AIOTMoveInfo.log($"入库周转箱已准备好"); AIOTMoveInfo.log($"入库周转箱已准备好");
}else if (InOutDevice.GetInStoreWaitSide(out inOutSide, out iod))
{
InMoveInfo = iod.MoveInfo;
CurrentSide = inOutSide;
AIOTMoveInfo.NextMoveStep(MoveStep.StoreIn01);
AIOTMoveInfo.log($"入库周转箱已准备好1");
StopAutoInOut = true;
}
else if (boxTransport.IsComplateOrFree)
{
if (InOutDevice.GetOutStoreFreeSide(out inOutSide, out iod) && OutStoreJobList.Dequeue(out JobInfo jobInfo1))
{
StoreMoveInfo.log("检测到出库空闲侧:" + inOutSide);
if (iod.TurnToOut(jobInfo1))
{
CurrentSide = inOutSide;
CurrentInOut = iod;
AIOTMoveInfo.NewMove(MoveStep.StoreOut10);
AIOTMoveInfo.MoveParam.PosID = jobInfo1.PosId;
StoreMoveInfo.log($"{CurrentSide}:开始出库任务");
}
}
} }
break; break;
case MoveStep.StoreIn01: case MoveStep.StoreIn01:
...@@ -102,6 +147,11 @@ namespace DeviceLibrary ...@@ -102,6 +147,11 @@ namespace DeviceLibrary
CurrentPosIndex--; CurrentPosIndex--;
if (CurrentPosIndex < 0 || StopAutoInOut) if (CurrentPosIndex < 0 || StopAutoInOut)
{ {
if (Singlein) {
AIOTMoveInfo.NextMoveStep(MoveStep.Wait);
AutoInOutTest = false;
return;
}
AIOTMoveInfo.log($"已达到最后一个库位{CurrentPosIndex},或手动停止{StopAutoInOut},自动出入库停止,将周转箱送至出口"); AIOTMoveInfo.log($"已达到最后一个库位{CurrentPosIndex},或手动停止{StopAutoInOut},自动出入库停止,将周转箱送至出口");
AIOTMoveInfo.NextMoveStep(MoveStep.StoreOut10); AIOTMoveInfo.NextMoveStep(MoveStep.StoreOut10);
return; return;
...@@ -117,15 +167,22 @@ namespace DeviceLibrary ...@@ -117,15 +167,22 @@ namespace DeviceLibrary
} }
break; break;
case MoveStep.StoreOut10: case MoveStep.StoreOut10:
if (InOutDevice.GetOutStoreFreeSide(out InOutSideE inOutSide2, out InOutDevice iod2) && OutStoreJobList.Dequeue(out JobInfo jobInfo)) if (!InOutDevice.GetOutStoreFreeSide(out InOutSideE inOutSide2, out InOutDevice iod2))
{ {
Msg.add("出口位置被占用无法送出料箱",MsgLevel.warning); Msg.add("出口位置被占用无法送出料箱",MsgLevel.warning);
return; return;
} }
ac = poslist[CurrentPosIndex];
JobInfo jobInfo = new JobInfo();
jobInfo.PosId = ac.PositionNum;
if (!iod2.TurnToOut(jobInfo))
{
return;
}
CurrentSide = inOutSide2; CurrentSide = inOutSide2;
CurrentInOut = iod2; CurrentInOut = iod2;
AIOTMoveInfo.NextMoveStep(MoveStep.StoreOut11); AIOTMoveInfo.NextMoveStep(MoveStep.StoreOut11);
ac = poslist[CurrentPosIndex];
if (!boxTransport.Start(new BoxStorePosition(ac), new BoxStorePosition(Config, CurrentSide), StoreMoveType.OutStore, "auto")) if (!boxTransport.Start(new BoxStorePosition(ac), new BoxStorePosition(Config, CurrentSide), StoreMoveType.OutStore, "auto"))
{ {
AIOTMoveInfo.log($"料仓周转启动失败"); AIOTMoveInfo.log($"料仓周转启动失败");
......
...@@ -12,10 +12,10 @@ namespace DeviceLibrary ...@@ -12,10 +12,10 @@ namespace DeviceLibrary
{ {
partial class MainMachine partial class MainMachine
{ {
public void AddOutStoreTask(string posId) { public void AddOutStoreTask(string posId,string hSerial) {
JobInfo jobInfo = new JobInfo("", posId); JobInfo jobInfo = new JobInfo("", posId, hSerial);
OutStoreJobList.Enqueue(jobInfo); OutStoreJobList.Enqueue(jobInfo);
LogUtil.info($"添加出库任务队列: {posId},当前任务数量: {OutStoreJobList.Count}"); LogUtil.info($"添加出库任务队列: {posId},工单号:{hSerial},当前任务数量: {OutStoreJobList.Count}");
} }
MoveInfo InMoveInfo; MoveInfo InMoveInfo;
InOutSideE CurrentSide; InOutSideE CurrentSide;
...@@ -33,7 +33,8 @@ namespace DeviceLibrary ...@@ -33,7 +33,8 @@ namespace DeviceLibrary
{ {
InMoveInfo = iod.MoveInfo; InMoveInfo = iod.MoveInfo;
CurrentSide = inOutSide; CurrentSide = inOutSide;
//CurrentInOut = iod; CurrentInOut = iod;
CurrentInOut.CurrnetDirection = InOutDirectionE.IN;
StoreMoveInfo.NextMoveStep(MoveStep.StoreIn01); StoreMoveInfo.NextMoveStep(MoveStep.StoreIn01);
StoreMoveInfo.MoveParam = InMoveInfo.MoveParam.clone(); StoreMoveInfo.MoveParam = InMoveInfo.MoveParam.clone();
StoreMoveInfo.log($"{CurrentSide}:入库周转箱已准备好"); StoreMoveInfo.log($"{CurrentSide}:入库周转箱已准备好");
...@@ -42,12 +43,15 @@ namespace DeviceLibrary ...@@ -42,12 +43,15 @@ namespace DeviceLibrary
else if (boxTransport.IsComplateOrFree) { else if (boxTransport.IsComplateOrFree) {
if (InOutDevice.GetOutStoreFreeSide(out InOutSideE inOutSide2, out InOutDevice iod2) && OutStoreJobList.Dequeue(out JobInfo jobInfo)) if (InOutDevice.GetOutStoreFreeSide(out InOutSideE inOutSide2, out InOutDevice iod2) && OutStoreJobList.Dequeue(out JobInfo jobInfo))
{ {
StoreMoveInfo.log("检测到出库空闲侧:" + inOutSide2);
if (iod2.TurnToOut(jobInfo)) if (iod2.TurnToOut(jobInfo))
{ {
CurrentSide = inOutSide2; CurrentSide = inOutSide2;
CurrentInOut = iod2; CurrentInOut = iod2;
StoreMoveInfo.NewMove(MoveStep.StoreOut10); StoreMoveInfo.NewMove(MoveStep.StoreOut10);
StoreMoveInfo.MoveParam.PosID = jobInfo.PosId; StoreMoveInfo.MoveParam.PosID = jobInfo.PosId;
StoreMoveInfo.MoveParam.hSerial = jobInfo.hSerial;
StoreMoveInfo.log($"{CurrentSide}:开始出库任务"); StoreMoveInfo.log($"{CurrentSide}:开始出库任务");
ServerCM.storeStatus = StoreStatus.OutStoreExecute; ServerCM.storeStatus = StoreStatus.OutStoreExecute;
} }
...@@ -57,7 +61,7 @@ namespace DeviceLibrary ...@@ -57,7 +61,7 @@ namespace DeviceLibrary
case MoveStep.StoreIn01: case MoveStep.StoreIn01:
StoreMoveInfo.NextMoveStep(MoveStep.StoreIn02); StoreMoveInfo.NextMoveStep(MoveStep.StoreIn02);
var ac = CSVPositionReader<ACStorePosition>.GetPositon(StoreMoveInfo.MoveParam.PosID); var ac = CSVPositionReader<ACStorePosition>.GetPositon(StoreMoveInfo.MoveParam.PosID);
boxTransport.Start(new BoxStorePosition(Config, CurrentSide), new BoxStorePosition(ac),StoreMoveType.InStore, StoreMoveInfo.MoveParam.WareCode,true); boxTransport.Start(new BoxStorePosition(Config, CurrentSide), new BoxStorePosition(ac), StoreMoveType.InStore, StoreMoveInfo.MoveParam.WareCode, true);
StoreMoveInfo.log($"{CurrentSide}:开始转运周转箱"); StoreMoveInfo.log($"{CurrentSide}:开始转运周转箱");
ServerCM.SendStoreState(StoreMoveInfo.MoveParam.PosID, StoreStatus.InStoreExecute); ServerCM.SendStoreState(StoreMoveInfo.MoveParam.PosID, StoreStatus.InStoreExecute);
break; break;
...@@ -67,7 +71,8 @@ namespace DeviceLibrary ...@@ -67,7 +71,8 @@ namespace DeviceLibrary
if (boxTransport.ReadyToTakeBox()) if (boxTransport.ReadyToTakeBox())
{ {
StoreMoveInfo.NextMoveStep(MoveStep.StoreIn03); StoreMoveInfo.NextMoveStep(MoveStep.StoreIn03);
}else if (StoreMoveInfo.IsTimeOut(10)) }
else if (StoreMoveInfo.IsTimeOut(10))
{ {
boxTransport.Reset(); boxTransport.Reset();
StoreMoveInfo.log($"{CurrentSide}:等待转运装置到位超时, 退出等待"); StoreMoveInfo.log($"{CurrentSide}:等待转运装置到位超时, 退出等待");
...@@ -104,8 +109,15 @@ namespace DeviceLibrary ...@@ -104,8 +109,15 @@ namespace DeviceLibrary
break; break;
case MoveStep.StoreOut10: case MoveStep.StoreOut10:
StoreMoveInfo.NextMoveStep(MoveStep.StoreOut11); StoreMoveInfo.NextMoveStep(MoveStep.StoreOut11);
if (StoreMoveInfo.MoveParam.PosID == "Reset")
{
boxTransport.Start(null, new BoxStorePosition(Config, CurrentSide), StoreMoveType.OutStore, StoreMoveInfo.MoveParam.WareCode);
}
else
{
var outac = CSVPositionReader<ACStorePosition>.GetPositon(StoreMoveInfo.MoveParam.PosID); var outac = CSVPositionReader<ACStorePosition>.GetPositon(StoreMoveInfo.MoveParam.PosID);
boxTransport.Start(new BoxStorePosition(outac),new BoxStorePosition(Config, CurrentSide),StoreMoveType.OutStore, StoreMoveInfo.MoveParam.WareCode); boxTransport.Start(new BoxStorePosition(outac), new BoxStorePosition(Config, CurrentSide), StoreMoveType.OutStore, StoreMoveInfo.MoveParam.WareCode);
}
StoreMoveInfo.log($"{CurrentSide}:开始转运周转箱"); StoreMoveInfo.log($"{CurrentSide}:开始转运周转箱");
ServerCM.SendStoreState(StoreMoveInfo.MoveParam.PosID, StoreStatus.OutStoreExecute); ServerCM.SendStoreState(StoreMoveInfo.MoveParam.PosID, StoreStatus.OutStoreExecute);
break; break;
...@@ -128,6 +140,7 @@ namespace DeviceLibrary ...@@ -128,6 +140,7 @@ namespace DeviceLibrary
if (boxTransport.IsPutOnOut) if (boxTransport.IsPutOnOut)
{ {
CurrentInOut.MoveInfo.NextMoveStep(MoveStep.OutBoxPutOn); CurrentInOut.MoveInfo.NextMoveStep(MoveStep.OutBoxPutOn);
CurrentInOut.MoveInfo.MoveParam = StoreMoveInfo.MoveParam.clone();
StoreMoveInfo.log($"周转箱已到达目的地"); StoreMoveInfo.log($"周转箱已到达目的地");
ServerCM.SendStoreState(StoreMoveInfo.MoveParam.PosID, StoreStatus.OutStoreBoxEnd); ServerCM.SendStoreState(StoreMoveInfo.MoveParam.PosID, StoreStatus.OutStoreBoxEnd);
OutStoreJobList.ClearLastPosid(StoreMoveInfo.MoveParam.PosID); OutStoreJobList.ClearLastPosid(StoreMoveInfo.MoveParam.PosID);
...@@ -149,8 +162,6 @@ namespace DeviceLibrary ...@@ -149,8 +162,6 @@ namespace DeviceLibrary
{ {
state = $"入库中,库位号:{StoreMoveInfo.MoveParam.PosID}"; state = $"入库中,库位号:{StoreMoveInfo.MoveParam.PosID}";
} }
return state; return state;
} }
} }
......
...@@ -121,7 +121,7 @@ namespace DeviceLibrary ...@@ -121,7 +121,7 @@ namespace DeviceLibrary
} }
else else
{ {
if (GetYAxisLevel() == 0) if (!Setting_Init.Device_DisableFloorCheck && GetYAxisLevel() == 0)
{ {
return (true, "升降机构不在托盘进出位置"); return (true, "升降机构不在托盘进出位置");
} }
...@@ -224,8 +224,8 @@ namespace DeviceLibrary ...@@ -224,8 +224,8 @@ namespace DeviceLibrary
else else
currnetstoreStatus = StoreStatus.Debugging; currnetstoreStatus = StoreStatus.Debugging;
//if (ServerCM.storeStatus== StoreStatus.InStoreExecute || ServerCM.storeStatus == StoreStatus.)
ServerCM.storeStatus = currnetstoreStatus; //ServerCM.storeStatus = currnetstoreStatus;
} }
} }
LogUtil.info("主线程已退出."); LogUtil.info("主线程已退出.");
...@@ -282,19 +282,20 @@ namespace DeviceLibrary ...@@ -282,19 +282,20 @@ namespace DeviceLibrary
if (IOValue(IO_Type.SideA_ForkMaterial_Check).Equals(IO_VALUE.HIGH) || if (IOValue(IO_Type.SideA_ForkMaterial_Check).Equals(IO_VALUE.HIGH) ||
IOValue(IO_Type.SideB_ForkMaterial_Check).Equals(IO_VALUE.HIGH)) IOValue(IO_Type.SideB_ForkMaterial_Check).Equals(IO_VALUE.HIGH))
{ {
Msg.add("伸缩叉2侧X10/X11检测到有物料无法继续", MsgLevel.warning); Msg.add("伸缩叉2侧X06/X07检测到有物料无法继续", MsgLevel.warning);
RobotManage.UserPause("回时料叉上有物料"); RobotManage.UserPause("回时料叉上有物料");
return; return;
} }
ResetMoveInfo.NextMoveStep(MoveStep.H04_HomeReset); ResetMoveInfo.NextMoveStep(MoveStep.H04_HomeReset);
ResetMoveInfo.log("开始回原,行走机构,回原"); YAxis.HomeMove(ResetMoveInfo, forceHome);
XAxis.HomeMove(ResetMoveInfo, forceHome); ResetMoveInfo.log("正在回原 ,升降轴,回原");
ResetMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); ResetMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break; break;
case MoveStep.H04_HomeReset: case MoveStep.H04_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H05_HomeReset); ResetMoveInfo.NextMoveStep(MoveStep.H05_HomeReset);
YAxis.HomeMove(ResetMoveInfo, forceHome);
ResetMoveInfo.log("正在回原 ,升降轴,回原"); ResetMoveInfo.log("开始回原,行走机构,回原");
XAxis.HomeMove(ResetMoveInfo, forceHome);
break; break;
case MoveStep.H05_HomeReset: case MoveStep.H05_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H06_HomeReset); ResetMoveInfo.NextMoveStep(MoveStep.H06_HomeReset);
...@@ -316,14 +317,15 @@ namespace DeviceLibrary ...@@ -316,14 +317,15 @@ namespace DeviceLibrary
case MoveStep.H07_HomeReset: case MoveStep.H07_HomeReset:
if (IOValue(IO_Type.ForkMaterial_Check).Equals(IO_VALUE.HIGH)) if (IOValue(IO_Type.ForkMaterial_Check).Equals(IO_VALUE.HIGH))
{ {
ResetMoveInfo.NextMoveStep(MoveStep.H08_HomeReset); ResetMoveInfo.NextMoveStep(MoveStep.HEND_HomeReset);
ResetMoveInfo.log("进出轴X09上有周转箱"); ResetMoveInfo.log("进出轴X05上有周转箱");
AddOutStoreTask("Reset", "");
} }
else if (IOValue(IO_Type.SideA_ForkMaterial_Check).Equals(IO_VALUE.HIGH) || else if (IOValue(IO_Type.SideA_ForkMaterial_Check).Equals(IO_VALUE.HIGH) ||
IOValue(IO_Type.SideB_ForkMaterial_Check).Equals(IO_VALUE.HIGH)) IOValue(IO_Type.SideB_ForkMaterial_Check).Equals(IO_VALUE.HIGH))
{ {
Msg.add("伸缩叉2侧X10/X11检测到有物料无法继续", MsgLevel.warning); Msg.add("伸缩叉2侧X06/X07检测到有物料无法继续", MsgLevel.warning);
RobotManage.UserPause("回源时料叉上有物料"); RobotManage.UserPause("回源时料叉上有物料");
return; return;
} }
...@@ -334,7 +336,7 @@ namespace DeviceLibrary ...@@ -334,7 +336,7 @@ namespace DeviceLibrary
break; break;
case MoveStep.H08_HomeReset: case MoveStep.H08_HomeReset:
if (InOutDevice.GetOutStoreFreeSide(out InOutSideE inOutSide2, out InOutDevice iod2)){// && IsOutLiftEmpty) { if (InOutDevice.GetOutStoreFreeSide(out InOutSideE inOutSide2, out InOutDevice iod2)){// && IsOutLiftEmpty) {
iod2.TurnToOut(new JobInfo("ReturnHome", "ReturnHome")); iod2.TurnToOut(new JobInfo("ReturnHome", "ReturnHome", "ReturnHome"));
ResetMoveInfo.NextMoveStep(MoveStep.H09_HomeReset); ResetMoveInfo.NextMoveStep(MoveStep.H09_HomeReset);
boxTransport.Start(null, new BoxStorePosition(Config, inOutSide2), StoreMoveType.ReturnHome, "ReturnHome"); boxTransport.Start(null, new BoxStorePosition(Config, inOutSide2), StoreMoveType.ReturnHome, "ReturnHome");
ResetMoveInfo.log("进出轴上有周转箱,开始送到出口"); ResetMoveInfo.log("进出轴上有周转箱,开始送到出口");
...@@ -513,7 +515,7 @@ namespace DeviceLibrary ...@@ -513,7 +515,7 @@ namespace DeviceLibrary
public void IgnoreX09() { public void IgnoreX09() {
boxTransport.IgnoreX09 = true; boxTransport.IgnoreX09 = true;
LogUtil.info("按下X09忽略"); LogUtil.info("按下X05忽略");
} }
} }
} }
...@@ -29,8 +29,8 @@ namespace DeviceLibrary ...@@ -29,8 +29,8 @@ namespace DeviceLibrary
AgvIn01, AgvIn01,
In02, In02,
In03, In03,
InWaitServerCallback,
In04, In04,
InWaitServerCallback,
StartInStore, StartInStore,
In05, In05,
In06, In06,
......
...@@ -7,7 +7,8 @@ AXIS,,4-出料线体顶升电机,Right_Lift_Moto,4,HC,,40000,200000,200000,1000,4000,150 ...@@ -7,7 +7,8 @@ AXIS,,4-出料线体顶升电机,Right_Lift_Moto,4,HC,,40000,200000,200000,1000,4000,150
,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,
PRO,50,IO信号超时时间(秒),IOSingle_TimerOut,15,,,,,,,,,,,, PRO,50,IO信号超时时间(秒),IOSingle_TimerOut,15,,,,,,,,,,,,
PRO,50,气压检测超时,AirCheckSeconds,5,,,,,,,,,,,, PRO,50,气压检测超时,AirCheckSeconds,5,,,,,,,,,,,,
PRO,50,扫码相机,CameraName,GigE:MV-CE200-10GC (00G03770732),,,,,,,,,,,, PRO,50,左侧扫码相机,CameraName_Left,GigE:MV-CE200-10GC (00G03770732),,,,,,,,,,,,
PRO,50,右侧扫码相机,CameraName_Right,GigE:MV-CE200-10GC (00G03770732),,,,,,,,,,,,
PRO,40,入料线体顶升电机速度,InLift_Moto_Speed,30000,,,,,,,,,,,, PRO,40,入料线体顶升电机速度,InLift_Moto_Speed,30000,,,,,,,,,,,,
PRO,40,入料线体顶升电机下降速度,InLift_Moto_DownSpeed,30000,,,,,,,,,,,, PRO,40,入料线体顶升电机下降速度,InLift_Moto_DownSpeed,30000,,,,,,,,,,,,
PRO,40,出料线体顶升电机速度,OutLift_Moto_Speed,30000,,,,,,,,,,,, PRO,40,出料线体顶升电机速度,OutLift_Moto_Speed,30000,,,,,,,,,,,,
......
...@@ -119,8 +119,13 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -119,8 +119,13 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary> /// <summary>
/// PRO,0,扫码相机,CameraName,asdasdasd,,,,,,,,,,,, /// PRO,0,扫码相机,CameraName,asdasdasd,,,,,,,,,,,,
/// </summary> /// </summary>
[ConfigProAttribute("CameraName")] [ConfigProAttribute("CameraName_Left")]
public string CameraName { get; set; } public string CameraName_Left { get; set; }
/// <summary>
/// PRO,0,扫码相机,CameraName,asdasdasd,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("CameraName_Right")]
public string CameraName_Right { get; set; }
/// <summary> /// <summary>
/// PRO,0,入料线体顶升电机速度,InLift_Moto_Speed,10,,,,,,,,,,,, /// PRO,0,入料线体顶升电机速度,InLift_Moto_Speed,10,,,,,,,,,,,,
/// </summary> /// </summary>
......
...@@ -187,7 +187,7 @@ namespace TheMachine ...@@ -187,7 +187,7 @@ namespace TheMachine
this.btn_IgnoreX09.Name = "btn_IgnoreX09"; this.btn_IgnoreX09.Name = "btn_IgnoreX09";
this.btn_IgnoreX09.Size = new System.Drawing.Size(201, 40); this.btn_IgnoreX09.Size = new System.Drawing.Size(201, 40);
this.btn_IgnoreX09.TabIndex = 6; this.btn_IgnoreX09.TabIndex = 6;
this.btn_IgnoreX09.Text = "忽略X09错误,并继续运行"; this.btn_IgnoreX09.Text = "忽略X05错误,并继续运行";
this.btn_IgnoreX09.UseVisualStyleBackColor = false; this.btn_IgnoreX09.UseVisualStyleBackColor = false;
this.btn_IgnoreX09.Visible = false; this.btn_IgnoreX09.Visible = false;
this.btn_IgnoreX09.Click += new System.EventHandler(this.btn_IgnoreX09_Click); this.btn_IgnoreX09.Click += new System.EventHandler(this.btn_IgnoreX09_Click);
...@@ -229,7 +229,7 @@ namespace TheMachine ...@@ -229,7 +229,7 @@ namespace TheMachine
// cb_IgnoreSafecheck // cb_IgnoreSafecheck
// //
this.cb_IgnoreSafecheck.AutoSize = true; this.cb_IgnoreSafecheck.AutoSize = true;
this.cb_IgnoreSafecheck.Enabled = false; this.cb_IgnoreSafecheck.Enabled = true;
this.cb_IgnoreSafecheck.Location = new System.Drawing.Point(657, 47); this.cb_IgnoreSafecheck.Location = new System.Drawing.Point(657, 47);
this.cb_IgnoreSafecheck.Name = "cb_IgnoreSafecheck"; this.cb_IgnoreSafecheck.Name = "cb_IgnoreSafecheck";
this.cb_IgnoreSafecheck.Size = new System.Drawing.Size(215, 25); this.cb_IgnoreSafecheck.Size = new System.Drawing.Size(215, 25);
......
...@@ -326,7 +326,7 @@ namespace TheMachine ...@@ -326,7 +326,7 @@ namespace TheMachine
userpause = false; userpause = false;
(btn_run as Button).Text = "暂停运行"; (btn_run as Button).Text = "暂停运行";
(btn_run as Button).BackColor = Color.Yellow; (btn_run as Button).BackColor = Color.Yellow;
cb_IgnoreSafecheck.Checked = false; //cb_IgnoreSafecheck.Checked = false;
cb_IgnoreSafecheck.Enabled = false; cb_IgnoreSafecheck.Enabled = false;
} }
...@@ -340,6 +340,7 @@ namespace TheMachine ...@@ -340,6 +340,7 @@ namespace TheMachine
btn_stop.Enabled = false; btn_stop.Enabled = false;
btn_run.Text = "启动"; btn_run.Text = "启动";
btn_run.BackColor = Color.Transparent; btn_run.BackColor = Color.Transparent;
cb_IgnoreSafecheck.Enabled = true;
} }
private void 退出ToolStripMenuItem_Click(object sender, EventArgs e) private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
......
...@@ -32,6 +32,7 @@ namespace TheMachine ...@@ -32,6 +32,7 @@ namespace TheMachine
this.cmbAxis = new System.Windows.Forms.ComboBox(); this.cmbAxis = new System.Windows.Forms.ComboBox();
this.comjSpeed = new System.Windows.Forms.ComboBox(); this.comjSpeed = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.label_state = new System.Windows.Forms.Label();
this.SuspendLayout(); this.SuspendLayout();
// //
// cmbAxis // cmbAxis
...@@ -65,11 +66,21 @@ namespace TheMachine ...@@ -65,11 +66,21 @@ namespace TheMachine
this.label1.Text = "点动速度:"; this.label1.Text = "点动速度:";
this.label1.TextAlign = System.Drawing.ContentAlignment.TopRight; this.label1.TextAlign = System.Drawing.ContentAlignment.TopRight;
// //
// label_state
//
this.label_state.AutoSize = true;
this.label_state.Location = new System.Drawing.Point(81, 203);
this.label_state.Name = "label_state";
this.label_state.Size = new System.Drawing.Size(41, 12);
this.label_state.TabIndex = 338;
this.label_state.Text = "label2";
//
// Frm_AxisMoveByIO // Frm_AxisMoveByIO
// //
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(441, 298); this.ClientSize = new System.Drawing.Size(441, 298);
this.Controls.Add(this.label_state);
this.Controls.Add(this.comjSpeed); this.Controls.Add(this.comjSpeed);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.cmbAxis); this.Controls.Add(this.cmbAxis);
...@@ -79,6 +90,7 @@ namespace TheMachine ...@@ -79,6 +90,7 @@ namespace TheMachine
this.Text = "Frm_AxisMoveByIO"; this.Text = "Frm_AxisMoveByIO";
this.Load += new System.EventHandler(this.Frm_AxisMoveByIO_Load); this.Load += new System.EventHandler(this.Frm_AxisMoveByIO_Load);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
...@@ -87,5 +99,6 @@ namespace TheMachine ...@@ -87,5 +99,6 @@ namespace TheMachine
private System.Windows.Forms.ComboBox cmbAxis; private System.Windows.Forms.ComboBox cmbAxis;
private System.Windows.Forms.ComboBox comjSpeed; private System.Windows.Forms.ComboBox comjSpeed;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label_state;
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -25,7 +25,18 @@ namespace TheMachine ...@@ -25,7 +25,18 @@ namespace TheMachine
public Frm_AxisMoveByIO() public Frm_AxisMoveByIO()
{ {
InitializeComponent(); InitializeComponent();
this.FormClosing += Frm_AxisMoveByIO_FormClosing;
} }
private void Frm_AxisMoveByIO_FormClosing(object sender, FormClosingEventArgs e)
{
if (threadrun)
{
threadrun = false;
e.Cancel = true;
}
}
public void LoadData(List<AxisBean> axisList) public void LoadData(List<AxisBean> axisList)
{ {
//this.boxBean = equipBase; //this.boxBean = equipBase;
...@@ -48,36 +59,64 @@ namespace TheMachine ...@@ -48,36 +59,64 @@ namespace TheMachine
crc.LanguageProcess(this); crc.LanguageProcess(this);
} }
Thread td; Thread td;
bool threadrun = true;
private void Frm_AxisMoveByIO_Load(object sender, EventArgs e) private void Frm_AxisMoveByIO_Load(object sender, EventArgs e)
{ {
td = new Thread(new ThreadStart(monitorio)); td = new Thread(new ThreadStart(monitorio));
threadrun = true;
td.Start(); td.Start();
} }
void monitorio() { void monitorio() {
bool isrun = false; bool isrun = false;
while (!IsDisposed) { while (threadrun) {
Thread.Sleep(10); Thread.Sleep(10);
string msg = "伺服未使能";
if (!AxisManager.IsServeoOn(PortName, SlvAddr)) if (!AxisManager.IsServeoOn(PortName, SlvAddr))
continue; {
SetState(msg);
continue; }
msg = "监听中";
var Fwd = IOManager.IOValue(IO_Type.Axis_Fwd_Btn).Equals(IO_VALUE.HIGH); var Fwd = IOManager.IOValue(IO_Type.Axis_Fwd_Btn).Equals(IO_VALUE.HIGH);
var Rwd = IOManager.IOValue(IO_Type.Axis_Rwd_Btn).Equals(IO_VALUE.HIGH); var Rwd = IOManager.IOValue(IO_Type.Axis_Rwd_Btn).Equals(IO_VALUE.HIGH);
if ((Fwd && Rwd) || (!Fwd && !Rwd)) if ((Fwd && Rwd) || (!Fwd && !Rwd))
{ {
msg = "按钮已释放";
if (isrun) if (isrun)
{ {
msg += ",停止运动";
isrun = false; isrun = false;
AxisManager.SuddenStop(currentAxis.Config); AxisManager.SuddenStop(currentAxis.Config);
} }
} }
else else
{ {
msg = "按钮已按下";
if (!isrun) if (!isrun)
{ {
msg += ",开始移动";
isrun = true; isrun = true;
AxisMove(1* (Fwd?1:-1)); AxisMove((int)comjSpeed.SelectedItem * (Fwd?1:-1));
}
}
SetState(msg);
} }
this.Invoke((EventHandler)delegate {
Close();
});
} }
void SetState(string msg) {
if (IsDisposed)
return;
if (this.InvokeRequired) {
this.Invoke((EventHandler)delegate{
SetState(msg);
});
return;
} }
label_state.Text = msg;
} }
private void cmbAxis_SelectedIndexChanged(object sender, EventArgs e) private void cmbAxis_SelectedIndexChanged(object sender, EventArgs e)
{ {
......
...@@ -86,7 +86,7 @@ namespace TheMachine ...@@ -86,7 +86,7 @@ namespace TheMachine
this.cylinderButton5.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.cylinderButton5.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton5.IO_HIGH = "Right_Door_Up"; this.cylinderButton5.IO_HIGH = "Right_Door_Up";
this.cylinderButton5.IO_LOW = "Right_Door_Down"; this.cylinderButton5.IO_LOW = "Right_Door_Down";
this.cylinderButton5.Location = new System.Drawing.Point(536, 198); this.cylinderButton5.Location = new System.Drawing.Point(711, 198);
this.cylinderButton5.Name = "cylinderButton5"; this.cylinderButton5.Name = "cylinderButton5";
this.cylinderButton5.Size = new System.Drawing.Size(150, 30); this.cylinderButton5.Size = new System.Drawing.Size(150, 30);
this.cylinderButton5.TabIndex = 1; this.cylinderButton5.TabIndex = 1;
...@@ -100,7 +100,7 @@ namespace TheMachine ...@@ -100,7 +100,7 @@ namespace TheMachine
this.cylinderButton9.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.cylinderButton9.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton9.IO_HIGH = "Left_Door_Up"; this.cylinderButton9.IO_HIGH = "Left_Door_Up";
this.cylinderButton9.IO_LOW = "Left_Door_Down"; this.cylinderButton9.IO_LOW = "Left_Door_Down";
this.cylinderButton9.Location = new System.Drawing.Point(711, 198); this.cylinderButton9.Location = new System.Drawing.Point(536, 198);
this.cylinderButton9.Name = "cylinderButton9"; this.cylinderButton9.Name = "cylinderButton9";
this.cylinderButton9.Size = new System.Drawing.Size(150, 30); this.cylinderButton9.Size = new System.Drawing.Size(150, 30);
this.cylinderButton9.TabIndex = 1; this.cylinderButton9.TabIndex = 1;
...@@ -219,7 +219,7 @@ namespace TheMachine ...@@ -219,7 +219,7 @@ namespace TheMachine
this.cylinderButton3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.cylinderButton3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton3.IO_HIGH = "Right_M_Stop_Up"; this.cylinderButton3.IO_HIGH = "Right_M_Stop_Up";
this.cylinderButton3.IO_LOW = "Right_M_Stop_Down"; this.cylinderButton3.IO_LOW = "Right_M_Stop_Down";
this.cylinderButton3.Location = new System.Drawing.Point(536, 234); this.cylinderButton3.Location = new System.Drawing.Point(711, 234);
this.cylinderButton3.Name = "cylinderButton3"; this.cylinderButton3.Name = "cylinderButton3";
this.cylinderButton3.Size = new System.Drawing.Size(150, 30); this.cylinderButton3.Size = new System.Drawing.Size(150, 30);
this.cylinderButton3.TabIndex = 1; this.cylinderButton3.TabIndex = 1;
...@@ -233,7 +233,7 @@ namespace TheMachine ...@@ -233,7 +233,7 @@ namespace TheMachine
this.cylinderButton4.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.cylinderButton4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton4.IO_HIGH = "Right_F_Stop_Up"; this.cylinderButton4.IO_HIGH = "Right_F_Stop_Up";
this.cylinderButton4.IO_LOW = "Right_F_Stop_Down"; this.cylinderButton4.IO_LOW = "Right_F_Stop_Down";
this.cylinderButton4.Location = new System.Drawing.Point(536, 270); this.cylinderButton4.Location = new System.Drawing.Point(711, 270);
this.cylinderButton4.Name = "cylinderButton4"; this.cylinderButton4.Name = "cylinderButton4";
this.cylinderButton4.Size = new System.Drawing.Size(150, 30); this.cylinderButton4.Size = new System.Drawing.Size(150, 30);
this.cylinderButton4.TabIndex = 1; this.cylinderButton4.TabIndex = 1;
...@@ -247,7 +247,7 @@ namespace TheMachine ...@@ -247,7 +247,7 @@ namespace TheMachine
this.cylinderButton6.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.cylinderButton6.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton6.IO_HIGH = "Left_M_Stop_Up"; this.cylinderButton6.IO_HIGH = "Left_M_Stop_Up";
this.cylinderButton6.IO_LOW = "Left_M_Stop_Down"; this.cylinderButton6.IO_LOW = "Left_M_Stop_Down";
this.cylinderButton6.Location = new System.Drawing.Point(711, 234); this.cylinderButton6.Location = new System.Drawing.Point(536, 234);
this.cylinderButton6.Name = "cylinderButton6"; this.cylinderButton6.Name = "cylinderButton6";
this.cylinderButton6.Size = new System.Drawing.Size(150, 30); this.cylinderButton6.Size = new System.Drawing.Size(150, 30);
this.cylinderButton6.TabIndex = 1; this.cylinderButton6.TabIndex = 1;
...@@ -261,7 +261,7 @@ namespace TheMachine ...@@ -261,7 +261,7 @@ namespace TheMachine
this.cylinderButton7.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.cylinderButton7.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton7.IO_HIGH = "Left_F_Stop_Up"; this.cylinderButton7.IO_HIGH = "Left_F_Stop_Up";
this.cylinderButton7.IO_LOW = "Left_F_Stop_Down"; this.cylinderButton7.IO_LOW = "Left_F_Stop_Down";
this.cylinderButton7.Location = new System.Drawing.Point(711, 270); this.cylinderButton7.Location = new System.Drawing.Point(536, 270);
this.cylinderButton7.Name = "cylinderButton7"; this.cylinderButton7.Name = "cylinderButton7";
this.cylinderButton7.Size = new System.Drawing.Size(150, 30); this.cylinderButton7.Size = new System.Drawing.Size(150, 30);
this.cylinderButton7.TabIndex = 1; this.cylinderButton7.TabIndex = 1;
......
...@@ -259,14 +259,13 @@ namespace TheMachine ...@@ -259,14 +259,13 @@ namespace TheMachine
if (RobotManage.mainMachine.runStatus == RunStatus.Running) if (RobotManage.mainMachine.runStatus == RunStatus.Running)
{ {
string selectPositionNum = cmbPosition.Text; string selectPositionNum = cmbPosition.Text;
JobInfo jobInfo = new JobInfo("IN_TEST", selectPositionNum);
if (InOutDevice.GetInStoreWaitSide(out InOutSideE inOutSide, out InOutDevice iod)) int posindex = RobotManage.PositionNumList.IndexOf(cmbPosition.Text);
if (!RobotManage.mainMachine.StartAutoInOutTest(posindex, true, out string errmsg))
{ {
iod.StartInStore(jobInfo); MessageBox.Show(errmsg);
LogUtil.info($"手动入库:{selectPositionNum}");
return; return;
} }
MessageBox.Show("周转箱没有到位,无法手动入库");
} }
else else
{ {
...@@ -281,7 +280,12 @@ namespace TheMachine ...@@ -281,7 +280,12 @@ namespace TheMachine
string selectPositionNum = cmbPosition.Text; string selectPositionNum = cmbPosition.Text;
if (RobotManage.mainMachine.boxTransportIsFree) { if (RobotManage.mainMachine.boxTransportIsFree) {
LogUtil.info($"手动出库:{selectPositionNum}"); LogUtil.info($"手动出库:{selectPositionNum}");
RobotManage.mainMachine.AddOutStoreTask(selectPositionNum); int posindex = RobotManage.PositionNumList.IndexOf(cmbPosition.Text);
if (!RobotManage.mainMachine.StartManualOutTest(posindex, out string errmsg))
{
MessageBox.Show(errmsg);
return;
}
} }
else else
{ {
...@@ -366,7 +370,7 @@ namespace TheMachine ...@@ -366,7 +370,7 @@ namespace TheMachine
if (res == DialogResult.No) if (res == DialogResult.No)
return; return;
int posindex = RobotManage.PositionNumList.IndexOf(cmbPosition.Text); int posindex = RobotManage.PositionNumList.IndexOf(cmbPosition.Text);
if (!RobotManage.mainMachine.StartAutoInOutTest(posindex,out string errmsg)) if (!RobotManage.mainMachine.StartAutoInOutTest(posindex,false,out string errmsg))
{ {
MessageBox.Show(errmsg); MessageBox.Show(errmsg);
return; return;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!