Commit 954c4ece 刘韬

1

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