Commit b7caf6ec 刘韬

853二期

1 个父辈 43fb10e8
正在显示 55 个修改的文件 包含 1138 行增加190 行删除
......@@ -35,9 +35,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
<HintPath>..\DLL\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
......
此文件类型无法预览
此文件类型无法预览
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件的差异被折叠, 点击展开。
此文件类型无法预览
此文件类型无法预览
此文件的差异被折叠, 点击展开。
此文件类型无法预览
此文件类型无法预览
此文件的差异太大,无法显示。
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
<?xml version="1.0"?>
<doc>
<assembly>
<name>RemoteSheardObject</name>
</assembly>
<members>
<member name="F:RemoteLoad.Action">
<summary>
动作
</summary>
</member>
<member name="F:RemoteLoad.GroupName">
<summary>
设备名称
</summary>
</member>
<member name="F:RemoteLoad.RequestLoadInfo">
<summary>
物料信息
</summary>
</member>
<member name="F:RequestLoadInfo.DeviceGroupName">
<summary>
目的地设备名称
</summary>
</member>
<member name="F:RequestLoadInfo.TrayType">
<summary>
托盘类型
</summary>
</member>
<member name="F:RequestLoadInfo.IsEmpty">
<summary>
是否空托盘
</summary>
</member>
<member name="F:RequestLoadInfo.LoadParam">
<summary>
料盘数据
</summary>
</member>
<member name="T:TrayTypeE">
<summary>
治具类型
</summary>
</member>
<member name="F:TrayTypeE.MTP1">
<summary>
流水线料盘托盘
</summary>
</member>
<member name="F:TrayTypeE.MTP2">
<summary>
流水线治具托盘
</summary>
</member>
<member name="F:TrayTypeE.S007">
<summary>
料串
</summary>
</member>
<member name="F:TrayTypeE.M03">
<summary>
Tray料格
</summary>
</member>
<member name="F:TrayTypeE.M02">
<summary>
PCB料格
</summary>
</member>
<member name="F:TrayTypeE.M01">
<summary>
PizzaBOX料格
</summary>
</member>
<member name="F:TrayTypeE.M04">
<summary>
ShoeBOX料格
</summary>
</member>
<member name="M:ReelParam.#ctor(System.String,System.Int32,System.Int32,System.Boolean,System.String)">
<summary>
创建新出入库信息
</summary>
<param name="wareNo">二维码内容</param>
<param name="platew">宽度</param>
<param name="plateh">高度</param>
<param name="IsNg">是否是入库NG料</param>
<param name="ngMsg">NG消息</param>
</member>
<member name="P:ReelParam.WareCode">
<summary>
物品二维码信息
</summary>
</member>
<member name="P:ReelParam.PosID">
<summary>
库位号
</summary>
</member>
<member name="P:ReelParam.PlateH">
<summary>
料盘高度
</summary>
</member>
<member name="P:ReelParam.PlateW">
<summary>
料盘宽度
</summary>
</member>
<member name="F:ReelParam.IsNg">
<summary>
是否是入料NG料
</summary>
</member>
<member name="F:ReelParam.NgMsg">
<summary>
入料NG消息
</summary>
</member>
<member name="P:ReelParam.PN">
<summary>
物料编码
</summary>
</member>
<member name="P:ReelParam.QTY">
<summary>
数量
</summary>
</member>
<member name="P:ReelParam.FC">
<summary>
厂家代码
</summary>
</member>
<member name="P:ReelParam.RI">
<summary>
唯一序列号
</summary>
</member>
<member name="P:ReelParam.Batch">
<summary>
批次号
</summary>
</member>
<member name="M:ReelParam.logresult(System.Int32,System.Boolean)">
<summary>
NG口位置,1=左侧,2=右侧
</summary>
<param name="NgPos"></param>
<param name="isInstore"></param>
</member>
<member name="F:MTP.MTP1">
<summary>
料盘托盘
</summary>
</member>
<member name="F:MTP.MTP2">
<summary>
治具托盘
</summary>
</member>
<member name="P:RemoteSheardObject.EquipMsgData.status">
<summary>
1.正常, 2.报警, 3.入库中, 4.出库中, 5,满料穿
</summary>
</member>
<member name="F:RemoteSheardObject.EquipMessage.type">
消息类型,info,warning,error
</member>
<member name="P:RemoteSheardObject.MyWebClient.Timeout">
<summary>
超时时间(毫秒)
</summary>
</member>
<member name="T:RemoteSheardObject.Snowflake">
<summary>
动态生产有规律的ID Snowflake算法是Twitter的工程师为实现递增而不重复的ID实现的
http://blog.csdn.net/w200221626/article/details/52064976
C# 实现 Snowflake算法
</summary>
</member>
<member name="M:RemoteSheardObject.Snowflake.GetTimestamp">
<summary>
生成当前时间戳
</summary>
<returns>毫秒</returns>
</member>
<member name="M:RemoteSheardObject.Snowflake.GetNextTimestamp(System.Int64)">
<summary>
获取下一微秒时间戳
</summary>
<param name="lastTimestamp"></param>
<returns></returns>
</member>
<member name="M:RemoteSheardObject.Snowflake.GetId">
<summary>
获取长整形的ID
</summary>
<returns></returns>
</member>
<member name="M:RemoteSheardObject.TheLine.GetTaskCount">
<summary>
获取正在进行的任务数量
</summary>
<returns></returns>
</member>
<member name="M:RemoteSheardObject.TheLine.UploadCarrierInformation(System.Collections.Generic.List{RemoteSheardObject.TheLine.CarrierInformationData})">
<summary>
上传mycronic库存信息
</summary>
<param name="equipMsgData"></param>
</member>
<member name="M:RemoteSheardObject.TheLine.ClearNgPos(System.Int32)">
<summary>
NG口位置,1=左侧,2=右侧
</summary>
<param name="ngPos"></param>
</member>
<member name="M:RemoteSheardObject.TheLine.UploadCustData(System.String,System.String)">
<summary>
上传自定义数据
</summary>
<param name="key"></param>
<param name="value"></param>
</member>
<member name="M:RemoteSheardObject.TheLine.GetCustData(System.String)">
<summary>
上传自定义数据
</summary>
<param name="key"></param>
<param name="value"></param>
</member>
<member name="M:RemoteSheardObject.TheLine.Regetposid(ReelParam,System.String,System.String@)">
<summary>
料仓离线后二次重新获取物料库位
</summary>
<param name="reelParam"></param>
<param name="traytype"></param>
<param name="msg"></param>
<returns></returns>
</member>
<member name="M:RemoteClient.SendAndWait(RemoteLoad,System.Int32)">
<summary>
发送并等待结果
</summary>
<param name="remoteLoad"></param>
<param name="waittime"></param>
<returns></returns>
</member>
<member name="F:StoreCID.AMH_ML5_1">
<summary>
治具出入库口
</summary>
</member>
<member name="F:StoreCID.AMH_ML5_2">
<summary>
料串出入库口
</summary>
</member>
</members>
</doc>
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/>
</startup>
</configuration>
此文件类型无法预览
此文件类型无法预览
此文件的差异太大,无法显示。
copy /y D:\rick\vs\GeneralClassLibrary\CodeLibraryProject\CodeLibrary\bin\Debug\CodeLibrary.* .\
copy /y D:\rick\vs\ConfigHelper\ConfigHelper\bin\Debug\ConfigHelper.* .\
copy /y D:\rick\vs\Camera\CameraVisionLib\bin\Debug\Asa.Camera.VisionLib.* .\
copy /y D:\rick\vs\RC1271-DUOStore\dll\halcondotnet.* .\
copy /y D:\rick\vs\HuichuanLibrary\HuichuanLibrary\bin\Debug\HuichuanLibrary.* .\
copy /y D:\rick\vs\SO20242_Gree_Main\IDHIKCamera\bin\Debug\IDHIKCamera.* .\
copy /y D:\rick\vs\צ\Rmaxis\bin\Debug\log4net.* .\
copy /y D:\rick\vs\SO775-DUOStore\dll\UserFromControl.* .\
copy /y D:\rick\vs\PrintLabel\PrintLabel\bin\Debug\Asa.PrintLabel.* .\
copy /y D:\rick\vs\PrintLabel\PrintLabel\bin\Debug\zxing.* .\
copy /y D:\rick\vs\1053_CycleLine\RemoteSheardObject\bin\Debug\RemoteSheardObject.* .\
copy /y D:\rick\vs\X-Ray\X-Ray\bin\Debug\X-Ray.* .\
copy /y D:\rick\vs\CarerayImage\CarerayImage\bin\Debug\Asa.CarerayImage.* .\
copy /y D:\rick\vs\PrintLabel\ZebraPrinterHelper\bin\Debug\ZebraPrinterHelper.* .\
\ No newline at end of file
此文件类型无法预览
此文件类型无法预览
此文件的差异太大,无法显示。
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using CodeLibrary;
using Newtonsoft.Json;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
namespace DeviceLibrary
{
using static System.Windows.Forms.VisualStyles.VisualStyleElement.ProgressBar;
using crc = OnlineStore.CodeResourceControl;
public partial class LabelMachine
{
/// <summary>
/// 等待响应料盘移栽
/// </summary>
public bool NextNeedWaitTransplanting=false;
public bool CanNextWaitTransplanting(RemoteLoad remoteLoad, out string msg)
{
msg = "";
if (!RobotManage.isRunning || runStatus != RunStatus.Running)
{
msg = "主设备不在运行,不能放料";
return false;
}
if (IOValue(IO_Label_Type.Tray_Check, IO_VALUE.HIGH))
{
msg = "等待1号机物料流走";
return false;
}
if (TransMoveInfo.MoveStep != MoveStep.Wait)
{
msg = "正在处理移栽物料,不能放料";
return false;
}
NextNeedWaitTransplanting=true;
TransMoveInfo.NextMoveStep(MoveStep.Trans_WaitReady);
TransMoveInfo.ReelParam = remoteLoad.RequestLoadInfo.LoadParam.clone();
TransMoveInfo.log($"等待2号机放置料盘:"+ TransMoveInfo.ReelParam.ToDetailStr());
return true;
}
public bool PutReelFinish(RemoteLoad remoteLoad, out string msg)
{
msg = "";
NextNeedWaitTransplanting=false;
TransMoveInfo.NextMoveStep(MoveStep.Trans_01);
TransMoveInfo.ReelParam = remoteLoad.RequestLoadInfo.LoadParam.clone();
TransMoveInfo.log("收到料盘:"+ TransMoveInfo.ReelParam.ToDetailStr());
return true;
}
string GroupName = "XRAY02";
void TransProcess()
{
if (CheckWait(TransMoveInfo))
return;
switch (TransMoveInfo.MoveStep)
{
case MoveStep.Wait:
break;
case MoveStep.Trans_WaitReady:
var xrstep = (RobotManage.xrayMachine.MoveInfo.MoveStep == MoveStep.XRay_11_GetCoutResult
|| RobotManage.xrayMachine.MoveInfo.MoveStep <= MoveStep.XRay_09_SentToLabelStop);
var lbstep = (MoveInfo.MoveStep == MoveStep.Lbl_01_Wait_ATray || MoveInfo.MoveStep >= MoveStep.Lbl_03_StopDown_and_wait);
if (xrstep && lbstep
&& IOValue(IO_Label_Type.Line1_Run).Equals(IO_VALUE.LOW)
&& secPreReelParam == null
)
{
Msg.add($"等待2号机放置料盘", MsgLevel.info);
RemoteLoad remoteLoad1 = new RemoteLoad();
remoteLoad1.Seq = Snowflake.Instance().GetId();
remoteLoad1.Action = "StartPutReel";
remoteLoad1.RequestLoadInfo = new RequestLoadInfo();
var remoteresult = RemoteService.SendAndWait(GroupName, remoteLoad1);
if (remoteresult == RemoteResult.True)
{
TransMoveInfo.log($"{GroupName} 等待物料到位");
TransMoveInfo.NextMoveStep(MoveStep.Trans_WaitReel);
ConfigHelper.Config.Set($"Runtime_{GroupName}_MoveParamJson", JsonConvert.SerializeObject(TransMoveInfo.ReelParam));
return;
}
else if (remoteresult == RemoteResult.False)
{
TransMoveInfo.NextMoveStep(MoveStep.Wait);
TransMoveInfo.log($"{GroupName} 没有准备好放料盘");
}
else
{
Msg.add($"{GroupName} 通讯超时", MsgLevel.warning);
}
}
else {
Msg.add($"等待二号机放料位置空闲,D:{secPreReelParam == null},XR:{xrstep},LB:{lbstep},LR:{IOValue(IO_Label_Type.Line1_Run).Equals(IO_VALUE.LOW)}", MsgLevel.info);
}
break;
case MoveStep.Trans_WaitReel:
TransMoveInfo.log($"{GroupName} 等待料盘放下");
break;
case MoveStep.Trans_01:
TransMoveInfo.NextMoveStep(MoveStep.Trans_02);
//RobotManage.Line1.LineRun("trans", 999, "Trans_01");
//TransMoveInfo.StopwatchLog(false, "开始送出");
break;
case MoveStep.Trans_02:
if (RobotManage.labelMachine.IOValue(IO_Label_Type.Line_HasTray_Check).Equals(IO_VALUE.HIGH))
{
if (!RobotManage.offlinemode && !TransMoveInfo.ReelParam.IsNg)
{
var cl = ServerConn.inputCounterDataByXRayMachine(TransMoveInfo.ReelParam.WareCode, TransMoveInfo.ReelParam.QTY);
if (cl == null)
{
TransMoveInfo.ReelParam.IsNg = true;
TransMoveInfo.ReelParam.NgMsg = "点料数量上传失败";
TransMoveInfo.ReelParam.logresult();
}
}
TransMoveInfo.NextMoveStep(MoveStep.Trans_03);
RobotManage.labelMachine.secPreReelParam = TransMoveInfo.ReelParam;
TransMoveInfo.log("料盘到达贴标线入口");
}
else if (MoveInfo.IsTimeOut(10))
{
Msg.add("等待二号机料盘放到皮带线", MsgLevel.warning);
TransMoveInfo.log("等待二号机料盘放到皮带线");
}
break;
case MoveStep.Trans_03:
TransMoveInfo.NextMoveStep(MoveStep.Trans_04);
TransMoveInfo.log("二号料盘已准备好,等待贴标机1");
break;
case MoveStep.Trans_04:
TransMoveInfo.NextMoveStep(MoveStep.Trans_05);
TransMoveInfo.log("二号料盘已准备好,等待贴标机2");
break;
case MoveStep.Trans_05:
if (RobotManage.labelMachine.IOValue(IO_Label_Type.Line_HasTray_Check).Equals(IO_VALUE.LOW))
{
TransMoveInfo.NextMoveStep(MoveStep.Trans_06);
TransMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
TransMoveInfo.log("料盘已离开");
}
else if (TransMoveInfo.IsTimeOut(15))
{
Msg.add("等待贴标机处理二号机料盘", MsgLevel.warning);
TransMoveInfo.log("等待贴标机处理二号机料盘");
}
break;
case MoveStep.Trans_06:
TransMoveInfo.log("完成");
TransMoveInfo.EndMove();
break;
}
}
}
}
......@@ -37,6 +37,8 @@ namespace DeviceLibrary
public MoveInfo SendOutMoveInfo;
public MoveInfo VacuumMoveInfo;
public MoveInfo TransMoveInfo;
public bool Init(out string msg)
{
msg = "";
......@@ -56,6 +58,7 @@ namespace DeviceLibrary
MoveInfo = new MoveInfo(DeviceName);
SendOutMoveInfo = new MoveInfo("贴标送出");
VacuumMoveInfo = new MoveInfo("贴标吸标");
TransMoveInfo = new MoveInfo("移栽接收");
SendOutMoveInfo.Hide = true;
VacuumMoveInfo.Hide = true;
ResetMoveInfo = MoveInfo;
......@@ -97,6 +100,7 @@ namespace DeviceLibrary
if (runStatus == RunStatus.Running)
{
WorkProcess();
TransProcess();
SendOutProcess();
VacuumLabelProcess();
}
......@@ -230,6 +234,7 @@ namespace DeviceLibrary
ResetMoveInfo.log("回源完成");
ResetMoveInfo.EndMove();
MoveInfo.NewMove(MoveStep.Lbl_01_Wait_ATray);
TransMoveInfo.NewMove(MoveStep.Wait);
runStatus = RunStatus.Running;
break;
}
......
......@@ -15,16 +15,17 @@ namespace DeviceLibrary
{
//保存贴标位置调试图像
public bool saveLabelDebugBmp = true;
public void test() {
Console.WriteLine(preReelParam);
}
double labelRAxisPos = 0;
Point p1;
bool ReverseLabel = false;
//是否允许进入贴标线体
public bool TrayCanIN()
{
return IOValue(IO_Label_Type.Tray_Check).Equals(IO_VALUE.LOW) && IOValue(IO_Label_Type.TrayStop_Down).Equals(IO_VALUE.HIGH) && preReelParam==null;
return IOValue(IO_Label_Type.Tray_Check).Equals(IO_VALUE.LOW)
&& IOValue(IO_Label_Type.TrayStop_Down).Equals(IO_VALUE.HIGH)
&& preReelParam == null
&& TransMoveInfo.MoveStep == MoveStep.Wait;
//return IOValue(IO_Label_Type.Line_HasTray_Check).Equals(IO_VALUE.LOW);
}
......@@ -50,6 +51,7 @@ namespace DeviceLibrary
WaitCheckLabeltypeE WaitCheckLabeltype;
Task printTask = null;
int reelcount = 0;
bool isSecondReel = false;
void WorkProcess()
{
if (CheckWait(MoveInfo))
......@@ -58,17 +60,32 @@ namespace DeviceLibrary
switch (MoveInfo.MoveStep)
{
case MoveStep.Lbl_01_Wait_ATray:
var Label_TaryStop_Check = IOValue(IO_Label_Type.Label_TaryStop_Check);
//LogUtil.OutputDebugString($"Tray_Check:{IOValue(IO_Label_Type.Tray_Check)},Label_TaryStop_Check:{Label_TaryStop_Check},preReelParam:{preReelParam!=null}");
if (RobotManage.labelMachine.TransMoveInfo.MoveStep > MoveStep.Wait
&& RobotManage.labelMachine.TransMoveInfo.MoveStep< MoveStep.Trans_05) {
Msg.add("等待二号机完成放料", MsgLevel.warning);
MoveInfo.log("等待二号机完成放料");
return;
}
if (IOValue(IO_Label_Type.Tray_Check,IO_VALUE.HIGH) && Label_TaryStop_Check.Equals(IO_VALUE.LOW) && preReelParam != null)
var Label_TaryStop_Check = IOValue(IO_Label_Type.Label_TaryStop_Check);
//LogUtil.OutputDebugString($"Tray_Check:{IOValue(IO_Label_Type.Tray_Check)},Label_TaryStop_Check:{Label_TaryStop_Check},preReelParam:{preReelParam!=null}");
if (IOValue(IO_Label_Type.Line_HasTray_Check, IO_VALUE.HIGH) && Label_TaryStop_Check.Equals(IO_VALUE.LOW) && secPreReelParam != null)
{
isSecondReel=true;
MoveInfo.NextMoveStep(MoveStep.Lbl_02_StopUP);
MoveInfo.ReelParam = secPreReelParam;
secPreReelParam = null;
MoveInfo.log("检测到二号机料盘 ReelParam:" + MoveInfo.ReelParam.ToStr());
MoveInfo.StopwatchReset();
}else
if (IOValue(IO_Label_Type.Tray_Check,IO_VALUE.HIGH) && IOValue(IO_Label_Type.Line_HasTray_Check, IO_VALUE.LOW) && Label_TaryStop_Check.Equals(IO_VALUE.LOW) && preReelParam != null)
{
isSecondReel = false;
MoveInfo.NextMoveStep(MoveStep.Lbl_02_StopUP);
MoveInfo.ReelParam = preReelParam;
preReelParam = null;
MoveInfo.log("检测到料盘 ReelParam:" + MoveInfo.ReelParam.ToStr());
MoveInfo.StopwatchReset();
}
//else if (Tray_Check.Equals(IO_VALUE.HIGH) && MoveInfo.IsTimeOut(30))
//{
......@@ -99,8 +116,10 @@ namespace DeviceLibrary
if (MoveInfo.ReelParam.IsNg || DisableLabel)
{
MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut);
CylinderMove(MoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up, IO_VALUE.HIGH);
if (!isSecondReel)
CylinderMove(MoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up, IO_VALUE.HIGH);
CylinderMove(null, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.HIGH);
RobotManage.Line1.LineRun("label", 5, "Lbl_02_StopUP");
MoveInfo.log("NG盘直接通过");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
if (RobotManage.offlinemode)
......@@ -130,7 +149,8 @@ namespace DeviceLibrary
MoveInfo.NextMoveStep(MoveStep.Lbl_03_LineRun);
MoveInfo.log("上料区阻挡上升,贴标区阻挡下降");
CylinderMove(MoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up, IO_VALUE.HIGH);
if (!isSecondReel)
CylinderMove(MoveInfo, IO_Label_Type.TrayStop_Down, IO_Label_Type.TrayStop_Up, IO_VALUE.HIGH);
CylinderMove(null, IO_Label_Type.Label_Stop_Down, IO_Label_Type.Label_Stop_Up, IO_VALUE.LOW);
ReelLocation reelLocation;
if (RobotManage.offlinemode)
......@@ -173,6 +193,7 @@ namespace DeviceLibrary
else
{
MoveInfo.NextMoveStep(MoveStep.Lbl_BeginOut);
RobotManage.Line1.LineRun("label", 5, "Lbl_02_StopUP");
MoveInfo.ReelParam.IsNg = true;
MoveInfo.ReelParam.NgMsg = "服务器没有返回明确目标";
MoveInfo.ReelParam.logresult();
......@@ -319,8 +340,8 @@ namespace DeviceLibrary
Label_R_Axis.AbsMove(null, Config.Label_R_P2, Config.Label_R_P2_speed);
if (MoveInfo.ReelParam.IsNg || DisableLabel)
{
RobotManage.Line1.LineRun("label", 5, "Lbl_BeginOut");
RobotManage.Line2.LineRun("label", 999, "Lbl_BeginOut");
//RobotManage.Line1.LineRun("label", 5, "Lbl_BeginOut");
RobotManage.Line2.LineRun("label", 5, "Lbl_BeginOut");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
}
MoveInfo.log("Label_XYR转到取标点,待机");
......
......@@ -16,7 +16,7 @@ namespace DeviceLibrary
public virtual bool UserPause { get; set; }
public RunStatus runStatus { get; set; } = RunStatus.Stop;
protected MoveInfo ResetMoveInfo;
public MoveInfo MoveInfo;
public MoveInfo MoveInfo;
protected List<Msg> Msg = new List<Msg>();
//public delegate void Event(List<Msg> msg);
public event EventHandler<List<Msg>> ProcessMsgEvent;
......@@ -36,7 +36,18 @@ namespace DeviceLibrary
_preReelParam = value.clone();
}
}
ReelParam _secPreReelParam = null;
public ReelParam secPreReelParam
{
get => _secPreReelParam;
set
{
if (value == null)
_secPreReelParam = null;
else
_secPreReelParam = value.clone();
}
}
Thread thread;
/// <summary>
/// 整机启动变量,设置为false后将退出线程,只在停止时调用
......@@ -70,12 +81,12 @@ namespace DeviceLibrary
DeviceSuddenStop();
ok = false;
}
if (IOManager.GetDIValue("",0,16).Equals(IO_VALUE.LOW))
{
ok = false;
DeviceSuddenStop();
Msg.add(crc.GetString("device_safedoor_open", "贴标或出料机构门禁被打开"), MsgLevel.warning);
}
//if (IOManager.GetDIValue("",0,16).Equals(IO_VALUE.LOW))
//{
// ok = false;
// DeviceSuddenStop();
// Msg.add(crc.GetString("device_safedoor_open", "贴标或出料机构门禁被打开"), MsgLevel.warning);
//}
lastSafeCheckStatus = ok;
return ok;
}
......@@ -87,8 +98,7 @@ namespace DeviceLibrary
//lastSafeCheckStatus = false;
var al = new Dictionary<string, List<AxisBean>>(AxisBean.List);
AxisBean.StopMultiAxis(AxisBean.List[RobotManage.labelMachine.DeviceName]);
AxisBean.StopMultiAxis(AxisBean.List[RobotManage.t1Machine.DeviceName]);
AxisBean.StopMultiAxis(AxisBean.List[RobotManage.xrayMachine.DeviceName]);
//AxisBean.StopMultiAxis();
MoveInfo.List.ForEach((m) => { m.CanWhileCount = 5; });
......@@ -191,6 +201,14 @@ namespace DeviceLibrary
{
isOk = false;
}
MoveInfo.WaitList.ForEach((w) =>
{
if (w.WaitType.Equals(WaitEnum.W014_Msg))
{
w.IsEnd = true;
Msg.add(w.ActionMsg, (MsgLevel)w.Data);
}
});
foreach (WaitResultInfo wait in MoveInfo.WaitList)
{
if (wait.IsEnd)
......@@ -262,8 +280,6 @@ namespace DeviceLibrary
else if (wait.WaitType.Equals(WaitEnum.W008_BatchAxis))
{
AxisBean axisBean=null;
axisBean = RobotManage.t1Machine.T_Batch_Axis;
//if (wait.AxisInfo.ProName == "Right_Batch_Axis")
// axisBean = Right_Batch_Axis;
//else
......
......@@ -84,8 +84,10 @@ namespace DeviceLibrary
XRay_01_LocationDown,
XRay_02_RunIn,
XRay_02_CheckReel,
XRay_03_CloseDoor,
XRay_04_OpenXray,
XRay_04_CheckXray,
XRay_05_GetImage,
XRay_06_WaitMatchPN,
XRay_06_WaitMatchPN2,
......@@ -143,6 +145,15 @@ namespace DeviceLibrary
T1_09_ReleaseReel_Test,
Shelf_19_LocationString,
Shelf_19_LocationString_wait,
Trans_WaitReady,
Trans_WaitReel,
Trans_01,
Trans_02,
Trans_03,
Trans_04,
Trans_05,
Trans_06,
}
......
using Fleck;
using Newtonsoft.Json;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public static class RemoteService
{
/// <summary>
/// deviceGroupName
/// </summary>
static Dictionary<string,IWebSocketConnection> allClients;
static WebSocketServer server;
/// <summary>
/// 初始化监听服务
/// </summary>
public static void Init() {
FleckLog.Level = LogLevel.Debug;
allClients = new Dictionary<string, IWebSocketConnection>();
server = new WebSocketServer("ws://0.0.0.0:26901");
server.RestartAfterListenError=true;
server.Start(client =>
{
client.OnOpen = () =>
{
var deviceGroupName = client.ConnectionInfo.Path.Substring(1);
LogUtil.info($"客户端OnOpen:{deviceGroupName}");
lock (allClients)
{
if (allClients.ContainsKey(deviceGroupName))
allClients[deviceGroupName]=client;
else
allClients.Add(deviceGroupName,client);
}
};
client.OnClose = () =>
{
var deviceGroupName = client.ConnectionInfo.Path.Substring(1);
LogUtil.info($"客户端OnClose:{deviceGroupName}");
lock (allClients)
{
allClients.Remove(deviceGroupName);
}
};
client.OnMessage = message =>
{
var deviceGroupName = client.ConnectionInfo.Path.Substring(1);
ProcessMessage(deviceGroupName,message);
};
});
}
static volatile Dictionary<long, RemoteResult> lastresult = new Dictionary<long, RemoteResult>();
static void ProcessMessage(string deviceGroupName, string message) {
bool isok = true;
string msg = "";
long Seq = 1;
try
{
var remoteLoad = JsonConvert.DeserializeObject<RemoteLoad>(message);
Seq = remoteLoad.Seq;
lock (lastresult) {
lastresult[Seq] = RemoteResult.None;
}
switch (remoteLoad.Action)
{
case "RequestPutReel":
isok = RobotManage.labelMachine.CanNextWaitTransplanting(remoteLoad,out msg);
break;
case "PutReelFinish":
isok = RobotManage.labelMachine.PutReelFinish(remoteLoad,out msg);
break;
case "Heartbeats": //客户端心跳包
isok = true;
break;
case "OK":
case "FAIL":
lock (lastresult)
{
lastresult[Seq] = remoteLoad.Action == "OK" ? RemoteResult.True : RemoteResult.False;
}
LogUtil.info($"[{remoteLoad.GroupName}] Revice Command Callback:" + remoteLoad.Action);
return;
default:
break;
}
}
catch(Exception e) {
isok = false;
LogUtil.info("Remote process error:"+e.ToString());
}
SendResult(deviceGroupName, isok, msg, Seq);
}
/// <summary>
/// 发送消息,不接收返回信息
/// </summary>
/// <param name="deviceGroupName">设备ID</param>
/// <param name="message"></param>
public static void SendMessage(string deviceGroupName,RemoteLoad message) {
if (!allClients.ContainsKey(deviceGroupName))
{
LogUtil.info($"设备:{deviceGroupName} 不在线");
return;
}
try
{
allClients[deviceGroupName].Send(JsonConvert.SerializeObject(message));
}
catch (Exception ex){
LogUtil.error($"设备:{deviceGroupName} 消息发送出错:"+ex.ToString());
}
}
/// <summary>
/// 发送并等待返回
/// </summary>
/// <param name="GroupName">设备ID</param>
/// <param name="remoteLoad">载荷信息</param>
/// <param name="waittime">等待时间默认3000毫秒</param>
/// <returns></returns>
public static RemoteResult SendAndWait(string GroupName, RemoteLoad remoteLoad, int waittime = 3000)
{
remoteLoad.GroupName = GroupName;
if (remoteLoad.RequestLoadInfo != null && string.IsNullOrEmpty(remoteLoad.RequestLoadInfo.DeviceGroupName))
remoteLoad.RequestLoadInfo.DeviceGroupName = GroupName;
LogUtil.info($"[{GroupName}],发送:{remoteLoad.Action},Seq:{remoteLoad.Seq}");
lock (lastresult)
{
lastresult[remoteLoad.Seq] = RemoteResult.None;
}
SendMessage(GroupName, remoteLoad);
return WaitResult(GroupName, remoteLoad.Seq,waittime);
}
static RemoteResult WaitResult(string GroupName,long seq,int waittime = 3000)
{
if (!lastresult.ContainsKey(seq))
return RemoteResult.Timeout;
try
{
while (lastresult[seq] == RemoteResult.None && waittime > 0)
{
System.Threading.Thread.Sleep(50);
waittime = waittime - 50;
}
if (lastresult[seq] == RemoteResult.None)
{
LogUtil.info($"等待{GroupName}反馈超时 seq:" + seq);
lastresult[seq] = RemoteResult.Timeout;
}
var result = lastresult[seq];
lock (lastresult)
{
lastresult.Remove(seq);
}
return result;
}
catch(Exception ex) {
LogUtil.error($"等待{GroupName}反馈超时 seq:" + seq +" 出错:"+ex);
return RemoteResult.Timeout;
}
}
static void SendResult(string deviceGroupName, bool result,string msg,long Seq)
{
RemoteLoad remoteLoad = new RemoteLoad();
remoteLoad.Seq = Seq;
remoteLoad.Action = result?"OK":"FAIL";
remoteLoad.GroupName = deviceGroupName;
remoteLoad.Msg = msg;
SendMessage(deviceGroupName, remoteLoad);
}
}
}
......@@ -56,7 +56,7 @@ namespace DeviceLibrary
wistonAgvClient = new WistonAgvClient();
RemoteService.Init();
robots.AddRange(new IRobot[] { xrayMachine, labelMachine, filterMachine, t1Machine });
//robots.AddRange(new IRobot[] { xrayMachine });
robots.ForEach((device)=> {
......
......@@ -60,15 +60,23 @@ namespace DeviceLibrary
T_TrayPos_Axis.AbsMove(MoveInfo, Config.GetTrayPos(MoveInfo.ReelParam.PlateW), Config.TrayPos_P1_speed);
T_Pan_Axis.AbsMove(MoveInfo, Config.Pan_P1, Config.Pan_P1_speed);
T_Y_Axis.AbsMove(MoveInfo, Config.Y_P1, Config.Y_P1_speed);
RobotManage.electricGripper.Release();
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.T1_03_LocationUp:
MoveInfo.NextMoveStep(MoveStep.T1_04_DownToReel);
MoveInfo.log($"料盘顶升");
IOMove(IO_T1_Type.Line4_Run, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_T1_Type.End_Lift_Cylinder_Down, IO_T1_Type.End_Lift_Cylinder_Up, IO_VALUE.HIGH);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.End_Lift_Tray_Check, IO_VALUE.HIGH));
if (RobotManage.electricGripper.Release())
{
MoveInfo.NextMoveStep(MoveStep.T1_04_DownToReel);
MoveInfo.log($"料盘顶升");
IOMove(IO_T1_Type.Line4_Run, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_T1_Type.End_Lift_Cylinder_Down, IO_T1_Type.End_Lift_Cylinder_Up, IO_VALUE.HIGH);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.End_Lift_Tray_Check, IO_VALUE.HIGH));
}
else
{
Msg.add("夹爪忙碌中...", MsgLevel.warning);
MoveInfo.log($"夹爪忙碌中...");
}
break;
case MoveStep.T1_04_DownToReel:
MoveInfo.NextMoveStep(MoveStep.T1_05_ClampReel);
......@@ -79,18 +87,18 @@ namespace DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break;
case MoveStep.T1_05_ClampReel:
//if (RobotManage.electricGripper.Clamp(null))
//{
MoveInfo.NextMoveStep(MoveStep.T1_06_UpToTop);
RobotManage.electricGripper.Clamp(null);
MoveInfo.log($"夹爪张开");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
//}
//else
//{
// Msg.add("夹爪忙碌中...", MsgLevel.warning);
// MoveInfo.log($"夹爪忙碌中...");
//}
if (RobotManage.electricGripper.Clamp(null))
{
MoveInfo.NextMoveStep(MoveStep.T1_06_UpToTop);
//RobotManage.electricGripper.Clamp(null);
MoveInfo.log($"夹爪张开");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
}
else
{
Msg.add("夹爪忙碌中...", MsgLevel.warning);
MoveInfo.log($"夹爪忙碌中...");
}
break;
case MoveStep.T1_06_UpToTop:
MoveInfo.NextMoveStep(MoveStep.T1_07_PanToOut);
......@@ -160,11 +168,16 @@ namespace DeviceLibrary
}
break;
case MoveStep.T1_09_ReleaseReel:
MoveInfo.NextMoveStep(MoveStep.T1_09_ReleaseReel_Test);
RobotManage.electricGripper.Release();
MoveInfo.log($"夹爪放松");
//MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_T1_Type.T1_Tray_Check, IO_VALUE.HIGH));
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
if (RobotManage.electricGripper.Release())
{
MoveInfo.NextMoveStep(MoveStep.T1_09_ReleaseReel_Test);
MoveInfo.log($"夹爪放松");
}
else
{
Msg.add("夹爪忙碌中...", MsgLevel.warning);
MoveInfo.log($"夹爪忙碌中...");
}
break;
case MoveStep.T1_09_ReleaseReel_Test:
if (IOValue(IO_T1_Type.T1_Tray_Check).Equals(IO_VALUE.HIGH))
......
......@@ -158,18 +158,27 @@ namespace DeviceLibrary
MoveInfo.log($"打开出口门");
break;
case MoveStep.XRay_09_SentToLabelStop:
if (RobotManage.labelMachine.TrayCanIN())
if (RobotManage.labelMachine.TransMoveInfo.MoveStep == MoveStep.Wait)
{
MoveInfo.NextMoveStep(MoveStep.XRay_10_CloseOutDoor);
MoveInfo.log($"打开出口门,送出到贴标机构");
Line_In_Axis.SpeedMove(Config.Line_In_Relative_speed*2);
RobotManage.Line1.LineRun("xray", 999, "XRay_09_SentToLabelStop");
MoveInfo.StopwatchLog(false, "开始送出");
if (RobotManage.labelMachine.TrayCanIN())
{
MoveInfo.NextMoveStep(MoveStep.XRay_10_CloseOutDoor);
MoveInfo.log($"打开出口门,送出到贴标机构");
Line_In_Axis.SpeedMove(Config.Line_In_Relative_speed * 2);
RobotManage.Line1.LineRun("xray", 999, "XRay_09_SentToLabelStop");
MoveInfo.StopwatchLog(false, "开始送出");
}
else if (MoveInfo.IsTimeOut(30))
{
Msg.add(crc.GetString("wait_xx_free", "等待{0}空闲", RobotManage.labelMachine.DeviceNameShow), MsgLevel.warning);
MoveInfo.log("等待贴标机构入口空闲");
}
}
else if (MoveInfo.IsTimeOut(30)) {
Msg.add(crc.GetString("wait_xx_free", "等待{0}空闲", RobotManage.labelMachine.DeviceNameShow), MsgLevel.warning);
MoveInfo.log("等待贴标机构入口空闲");
else
{
Msg.add("点料机出口等待处理二号机物料", MsgLevel.warning);
MoveInfo.log($"等待处理二号机物料");
}
break;
case MoveStep.XRay_10_CloseOutDoor:
......@@ -192,12 +201,21 @@ namespace DeviceLibrary
case MoveStep.XRay_11_GetCoutResult:
if (GetResultTask == null || GetResultTask.IsCompleted)
{
RobotManage.labelMachine.preReelParam = MoveInfo.ReelParam;
MoveInfo.NextMoveStep(MoveStep.XRay_End);
MoveInfo.log($"获得点料结果 QTY:{MoveInfo.ReelParam.QTY}");
MoveInfo.StopwatchLog(false, "获得点料结果");
if (RobotManage.labelMachine.TransMoveInfo.MoveStep == MoveStep.Wait)
{
RobotManage.labelMachine.preReelParam = MoveInfo.ReelParam;
MoveInfo.NextMoveStep(MoveStep.XRay_End);
MoveInfo.log($"获得点料结果 QTY:{MoveInfo.ReelParam.QTY}");
MoveInfo.StopwatchLog(false, "获得点料结果");
}
else
{
Msg.add("点料机出口等待处理二号机物料", MsgLevel.warning);
MoveInfo.log($"等待处理二号机物料");
}
}
else if (MoveInfo.IsTimeOut(30)) {
else if (MoveInfo.IsTimeOut(30))
{
MoveInfo.NextMoveStep(MoveStep.XRay_End);
MoveInfo.log("获取点料结果超时");
MoveInfo.ReelParam.IsNg = true;
......
......@@ -6,6 +6,7 @@ using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
using X_Ray;
namespace DeviceLibrary
{
......@@ -44,10 +45,14 @@ namespace DeviceLibrary
set
{
_WareCode = value;
var w = _WareCode.Split('|');
if (w.Length == 5) {
PN = w[0];
ReeID = w[3];
if (!string.IsNullOrEmpty(_WareCode))
{
var w = _WareCode.Split('|');
if (w.Length == 5)
{
PN = w[0];
ReeID = w[3];
}
}
}
}
......@@ -95,7 +100,7 @@ namespace DeviceLibrary
/// </summary>
public ReelDest ReelDest { get; set; }
public string xrayfile, resultfile, Algo;
public ReelParam clone() {
return this.MemberwiseClone() as ReelParam;
}
......@@ -151,4 +156,46 @@ namespace DeviceLibrary
Tower,
Unknow
}
public enum RemoteResult
{
None,
Timeout,
False,
True
}
[Serializable]
public class RemoteLoad
{
/// <summary>
/// 动作
/// </summary>
public string Action;
public long Seq;
/// <summary>
/// 设备名称
/// </summary>
public string GroupName;
/// <summary>
/// 消息
/// </summary>
public string Msg;
/// <summary>
/// 物料信息
/// </summary>
public RequestLoadInfo RequestLoadInfo;
}
[Serializable]
public class RequestLoadInfo
{
/// <summary>
/// 目的地设备名称
/// </summary>
public string DeviceGroupName;
/// <summary>
/// 料盘数据
/// </summary>
public ReelParam LoadParam;
//public DoorStatusE DoorStatus;
}
}
......@@ -142,7 +142,10 @@ namespace DeviceLibrary
LogUtil.error(msg);
}
}
public void Msg(string msg, MsgLevel msgLevel)
{
WaitList.Add(WaitResultInfo.WaitMsg(msg, msgLevel));
}
public void StopwatchReset() {
Stopwatch.Restart();
}
......@@ -161,7 +164,15 @@ namespace DeviceLibrary
IsEnd = false;
CanWhileMoveCount = 0;
}
public static WaitResultInfo WaitMsg(string msg, MsgLevel msgLevel)
{
WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = WaitEnum.W014_Msg;
wait.ActionMsg = msg;
wait.IsEnd = true;
wait.Data = msgLevel;
return wait;
}
public static WaitResultInfo WaitIO(string ioType, IO_VALUE ioValue)
{
WaitResultInfo wait = new WaitResultInfo();
......@@ -336,6 +347,7 @@ namespace DeviceLibrary
/// </summary>
public Func<WaitResultInfo, bool> Action { get; set; }
public string ActionMsg { get; set; }
public dynamic Data { get; set; }
}
internal class WaitEnum
......@@ -376,5 +388,9 @@ namespace DeviceLibrary
/// 通用代理等待方法
/// </summary>
internal static int W013_Action = 13;
/// <summary>
/// 等待时反馈消息
/// </summary>
internal static int W014_Msg = 14;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public class Snowflake
{
private static long machineId;//机器ID
private static long datacenterId = 0L;//数据ID
private static long sequence = 0L;//计数从零开始
private static long twepoch = 687888001020L; //唯一时间随机量
private static long machineIdBits = 5L; //机器码字节数
private static long datacenterIdBits = 5L;//数据字节数
public static long maxMachineId = -1L ^ -1L << (int)machineIdBits; //最大机器ID
private static long maxDatacenterId = -1L ^ (-1L << (int)datacenterIdBits);//最大数据ID
private static long sequenceBits = 12L; //计数器字节数,12个字节用来保存计数码
private static long machineIdShift = sequenceBits; //机器码数据左移位数,就是后面计数器占用的位数
private static long datacenterIdShift = sequenceBits + machineIdBits;
private static long timestampLeftShift = sequenceBits + machineIdBits + datacenterIdBits; //时间戳左移动位数就是机器码+计数器总字节数+数据字节数
public static long sequenceMask = -1L ^ -1L << (int)sequenceBits; //一微秒内可以产生计数,如果达到该值则等到下一微妙在进行生成
private static long lastTimestamp = -1L;//最后时间戳
private static object syncRoot = new object();//加锁对象
static Snowflake snowflake;
public static Snowflake Instance()
{
if (snowflake == null)
snowflake = new Snowflake();
return snowflake;
}
public Snowflake()
{
Snowflakes(0L, -1);
}
public Snowflake(long machineId)
{
Snowflakes(machineId, -1);
}
public Snowflake(long machineId, long datacenterId)
{
Snowflakes(machineId, datacenterId);
}
private void Snowflakes(long machineId, long datacenterId)
{
if (machineId >= 0)
{
if (machineId > maxMachineId)
{
throw new Exception("机器码ID非法");
}
Snowflake.machineId = machineId;
}
if (datacenterId >= 0)
{
if (datacenterId > maxDatacenterId)
{
throw new Exception("数据中心ID非法");
}
Snowflake.datacenterId = datacenterId;
}
}
/// <summary>
/// 生成当前时间戳
/// </summary>
/// <returns>毫秒</returns>
private static long GetTimestamp()
{
//让他2000年开始
return (long)(DateTime.UtcNow - new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds;
}
/// <summary>
/// 获取下一微秒时间戳
/// </summary>
/// <param name="lastTimestamp"></param>
/// <returns></returns>
private static long GetNextTimestamp(long lastTimestamp)
{
long timestamp = GetTimestamp();
int count = 0;
while (timestamp <= lastTimestamp)//这里获取新的时间,可能会有错,这算法与comb一样对机器时间的要求很严格
{
count++;
if (count > 10)
throw new Exception("机器的时间可能不对");
Thread.Sleep(1);
timestamp = GetTimestamp();
}
return timestamp;
}
/// <summary>
/// 获取长整形的ID
/// </summary>
/// <returns></returns>
public long GetId()
{
lock (syncRoot)
{
long timestamp = GetTimestamp();
if (Snowflake.lastTimestamp == timestamp)
{ //同一微妙中生成ID
sequence = (sequence + 1) & sequenceMask; //用&运算计算该微秒内产生的计数是否已经到达上限
if (sequence == 0)
{
//一微妙内产生的ID计数已达上限,等待下一微妙
timestamp = GetNextTimestamp(Snowflake.lastTimestamp);
}
}
else
{
//不同微秒生成ID
sequence = 0L;
}
if (timestamp < lastTimestamp)
{
throw new Exception("时间戳比上一次生成ID时时间戳还小,故异常");
}
Snowflake.lastTimestamp = timestamp; //把当前时间戳保存为最后生成ID的时间戳
long Id = ((timestamp - twepoch) << (int)timestampLeftShift)
| (datacenterId << (int)datacenterIdShift)
| (machineId << (int)machineIdShift)
| sequence;
return Id;
}
}
}
}
......@@ -35,29 +35,32 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Asa.CarerayImage">
<HintPath>..\..\CarerayImage\CarerayImage\bin\Debug\Asa.CarerayImage.dll</HintPath>
<HintPath>..\DLL\Asa.CarerayImage.dll</HintPath>
</Reference>
<Reference Include="Asa.PrintLabel">
<HintPath>..\..\PrintLabel\PrintLabel\bin\Debug\Asa.PrintLabel.dll</HintPath>
<HintPath>..\DLL\Asa.PrintLabel.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary">
<HintPath>..\..\GeneralClassLibrary\CodeLibraryProject\CodeLibrary\bin\Debug\CodeLibrary.dll</HintPath>
<HintPath>..\DLL\CodeLibrary.dll</HintPath>
</Reference>
<Reference Include="ConfigHelper">
<HintPath>..\..\ConfigHelper\ConfigHelper\bin\Debug\ConfigHelper.dll</HintPath>
<HintPath>..\DLL\ConfigHelper.dll</HintPath>
</Reference>
<Reference Include="Fleck, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Fleck.1.2.0\lib\net45\Fleck.dll</HintPath>
</Reference>
<Reference Include="halcondotnet">
<HintPath>..\..\RC1271-DUOStore\dll\halcondotnet.dll</HintPath>
<HintPath>..\DLL\halcondotnet.dll</HintPath>
</Reference>
<Reference Include="HuichuanLibrary">
<HintPath>..\..\HuichuanLibrary\HuichuanLibrary\bin\Debug\HuichuanLibrary.dll</HintPath>
<HintPath>..\DLL\HuichuanLibrary.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=x86">
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\HuichuanLibrary\HuichuanLibrary\bin\Debug\log4net.dll</HintPath>
<HintPath>..\DLL\log4net.dll</HintPath>
</Reference>
<Reference Include="Neotel.Rmaxis">
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\Neotel.Rmaxis.dll</HintPath>
<HintPath>..\DLL\Neotel.Rmaxis.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
......@@ -79,9 +82,8 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="X-Ray, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\X-Ray\X-Ray\bin\Debug\X-Ray.dll</HintPath>
<Reference Include="X-Ray">
<HintPath>..\DLL\X-Ray.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
......@@ -93,11 +95,14 @@
<Compile Include="AutoScan\common\OcrProcess.cs" />
<Compile Include="AutoScan\common\SensorDebounce.cs" />
<Compile Include="AutoScan\common\ServerConn.cs" />
<Compile Include="AutoScan\common\Snowflake.cs" />
<Compile Include="AutoScan\common\TextBlock.cs" />
<Compile Include="AutoScan\FilterMachine.partial.cs" />
<Compile Include="AutoScan\LabelMachine.partial.cs" />
<Compile Include="AutoScan\LabelMachine.Ledprocess.cs" />
<Compile Include="AutoScan\LabelMachine.claclabel.cs" />
<Compile Include="AutoScan\LabelMachine.Tmove.cs" />
<Compile Include="AutoScan\RemoteService.cs" />
<Compile Include="AutoScan\T1Machine.cs" />
<Compile Include="AutoScan\FilterMachine.cs" />
<Compile Include="AutoScan\LabelMachine.cs" />
......
......@@ -113,7 +113,7 @@ namespace DeviceLibrary
LogUtil.error("加载HIK相机出错:" + ex.ToString());
}
}
string[] names = Camera._cam.Name;
string[] names = Camera._cam?.Name;
if (names != null)
......
......@@ -35,75 +35,88 @@ namespace DeviceLibrary
}
public bool Clamp(MoveInfo moveInfo = null)
{
OpenPort();
GripperType = GripperTypeE.Gripper;
if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>(WaitAction),"夹爪夹紧"));
LogUtil.info($"ElectricGripper Clamp");
if (axis.ErrorCode > 0)
{
LogUtil.info("ElectricGripper Clamp error:" + axis.ErrorCode.ToString() + axis.ErrorString);
axis.ResetError();
}
if (IsBusy)
try
{
axis.StopAxis();
Thread.Sleep(500);
}
if (!IsBusy)
{
axis.Push(50, 5.5f, 50);
clampTimes++;
if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
OpenPort();
GripperType = GripperTypeE.Gripper;
return true;
if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>(WaitAction), "夹爪夹紧"));
LogUtil.info($"ElectricGripper Clamp");
if (axis.ErrorCode > 0)
{
LogUtil.info("ElectricGripper Clamp error:" + axis.ErrorCode.ToString() + axis.ErrorString);
axis.ResetError();
}
if (IsBusy)
{
axis.StopAxis();
Thread.Sleep(1000);
}
if (!IsBusy)
{
axis.Push(50, 5.5f, 50);
clampTimes++;
if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
return true;
}
else
{
LogUtil.info("ElectricGripper Clamp busy");
ClosePort();
return false;
}
}
else {
LogUtil.info("ElectricGripper Clamp busy");
catch (Exception ex)
{
LogUtil.error($"ElectricGripper Err:{ex}");
ClosePort();
Thread.Sleep(100);
OpenPort();
Thread.Sleep(100);
axis.ResetError();
axis.Push(50, 5.5f, 50);
return false;
}
}
public bool Release(MoveInfo moveInfo = null)
{
OpenPort();
GripperType = GripperTypeE.Release;
LogUtil.info($"ElectricGripper Release");
if (axis.ErrorCode > 0)
{
LogUtil.info("ElectricGripper Release error:" + axis.ErrorCode.ToString() + axis.ErrorString);
axis.ResetError();
}
if (IsBusy)
{
axis.StopAxis();
Thread.Sleep(500);
}
if (!IsBusy)
{
axis.MoveAbsolute(0.2f, 50, 150, 150, 1f);
clampTimes = 0;
if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
return true;
}
else
{
try
{
OpenPort();
GripperType = GripperTypeE.Release;
LogUtil.info($"ElectricGripper Release");
if (axis.ErrorCode > 0)
{
LogUtil.info($"ElectricGripper ErrCode:{axis.ErrorCode}");
LogUtil.info("ElectricGripper Release error:" + axis.ErrorCode.ToString() + axis.ErrorString);
axis.ResetError();
Thread.Sleep(100);
}
if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>(WaitAction), "夹爪放松"));
if (IsBusy)
{
axis.StopAxis();
Thread.Sleep(1000);
}
if (!IsBusy)
{
axis.MoveAbsolute(0.2f, 50, 150, 150, 1f);
clampTimes = 0;
if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
return true;
}
else
{
if (axis.ErrorCode > 0)
{
LogUtil.info($"ElectricGripper ErrCode:{axis.ErrorCode}");
axis.ResetError();
Thread.Sleep(100);
}
if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>(WaitAction), "夹爪放松"));
ClosePort();
return false;
}
}
catch(Exception ex) {
LogUtil.error($"ElectricGripper Err:{ex}");
ClosePort();
return false;
}
}
......
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="DeviceLibrary.Properties.Settings1" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
<section name="DeviceLibrary.Properties.Settings1" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.0.12.0" newVersion="2.0.12.0"/>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.12.0" newVersion="2.0.12.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
......@@ -26,4 +26,4 @@
</setting>
</DeviceLibrary.Properties.Settings1>
</userSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /></startup></configuration>
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Fleck" version="1.2.0" targetFramework="net48" />
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.114.0" targetFramework="net461" />
<package id="System.Data.SQLite.Core" version="1.0.114.3" targetFramework="net461" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
......
......@@ -33,9 +33,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
<HintPath>..\DLL\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
......

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31112.23
# Visual Studio Version 17
VisualStudioVersion = 17.12.35707.178
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SO853-AutoCountMachine", "SO853-AutoCountMachine\SO853-AutoCountMachine.csproj", "{9B1ED5AF-2A34-43FD-AA2B-5BFB529B848D}"
EndProject
......@@ -9,12 +9,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "LoadCVSLi
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "Common\Common.csproj", "{43CDD09E-FCF3-4960-A01D-3BBFE9933122}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceLibrary", "DeviceLibrary\DeviceLibrary.csproj", "{E6879E1B-9F25-427C-8E3B-A6E977036313}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceLibrary", "DeviceLibrary\DeviceLibrary.csproj", "{BB23296C-AA1D-45C6-9FA6-5A37B2ABFE9B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Description = 越南纬创主机
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9B1ED5AF-2A34-43FD-AA2B-5BFB529B848D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
......@@ -29,10 +30,10 @@ Global
{43CDD09E-FCF3-4960-A01D-3BBFE9933122}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43CDD09E-FCF3-4960-A01D-3BBFE9933122}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43CDD09E-FCF3-4960-A01D-3BBFE9933122}.Release|Any CPU.Build.0 = Release|Any CPU
{E6879E1B-9F25-427C-8E3B-A6E977036313}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E6879E1B-9F25-427C-8E3B-A6E977036313}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E6879E1B-9F25-427C-8E3B-A6E977036313}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E6879E1B-9F25-427C-8E3B-A6E977036313}.Release|Any CPU.Build.0 = Release|Any CPU
{BB23296C-AA1D-45C6-9FA6-5A37B2ABFE9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BB23296C-AA1D-45C6-9FA6-5A37B2ABFE9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BB23296C-AA1D-45C6-9FA6-5A37B2ABFE9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BB23296C-AA1D-45C6-9FA6-5A37B2ABFE9B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="AutoCountMachine.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
<section name="AutoCountMachine.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="AutoCountMachine.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
<section name="DeviceLibrary.Properties.Settings1" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
<section name="AutoCountMachine.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="DeviceLibrary.Properties.Settings1" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<appSettings>
<!--是否开机自动启动料仓-->
<add key="App_AutoRun" value="1"/>
<add key="Default_Language" value="zh-CN"/>
<add key="CodeType" value="QR Code#Data Matrix ECC 200#barcode"/>
<add key="App_AutoRun" value="1" />
<add key="Default_Language" value="zh-CN" />
<add key="CodeType" value="QR Code#Data Matrix ECC 200#barcode" />
<!--二维码参数文件所在路径,文件名与二维码类型名一样-->
<add key="CodeParamPath" value="Conifg\"/>
<add key="CodeCount" value="3"/>
<add key="Code_Block_Size_List" value="11"/>
<add key="inputCounterDataByXRayMachine" value="http://10.69.221.80/SCTAEXTERNAL001/api/inputCounterDataByXRayMachine"/>
<add key="DetermineReelStorageLocation" value="http://10.69.221.80/SCTARLC001/api/RLC/DetermineReelStorageLocation"/>
<add key="CodeParamPath" value="Conifg\" />
<add key="CodeCount" value="3" />
<add key="Code_Block_Size_List" value="11" />
<add key="inputCounterDataByXRayMachine" value="http://10.69.221.80/SCTAEXTERNAL001/api/inputCounterDataByXRayMachine" />
<add key="DetermineReelStorageLocation" value="http://10.69.221.80/SCTARLC001/api/RLC/DetermineReelStorageLocation" />
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/AutoScanAndLabel.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<file value="logs/AutoScanAndLabel.log" />
<param name="Encoding" value="UTF-8" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n"/>
<conversionPattern value="[%date][%t]%-5p %m%n" />
</layout>
</appender>
<appender name="LngResource" type="log4net.Appender.RollingFileAppender">
<file value="logs/LngResource.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<file value="logs/LngResource.log" />
<param name="Encoding" value="UTF-8" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n"/>
<conversionPattern value="[%date][%t]%-5p %m%n" />
</layout>
</appender>
<logger name="RollingLogFileAppender">
<level value="ALL"/>
<appender-ref ref="RollingLogFileAppender"/>
<level value="ALL" />
<appender-ref ref="RollingLogFileAppender" />
</logger>
<logger name="HCBOARD">
<level value="ALL"/>
<appender-ref ref="RollingLogFileAppender"/>
<level value="ALL" />
<appender-ref ref="RollingLogFileAppender" />
</logger>
<logger name="LngResource">
<level value="Info"/>
<appender-ref ref="LngResource"/>
<level value="Info" />
<appender-ref ref="LngResource" />
</logger>
<!--<root>
<level value="Info" />
......@@ -62,13 +62,13 @@
</root>-->
</log4net>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.0.12.0" newVersion="2.0.12.0"/>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.12.0" newVersion="2.0.12.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
......
......@@ -57,9 +57,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\ConfigHelper\ConfigHelper\bin\Debug\ConfigHelper.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
<HintPath>..\DLL\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!