Commit 10325c63 刘韬

20201115

1 个父辈 cbf46e83
正在显示 43 个修改的文件 包含 384 行增加113 行删除
{
"ExpandedNodes": [
""
"",
"\\RC1266-AutoCountMachine",
"\\Retrospect",
"\\X-Ray Controller"
],
"SelectedNode": "\\RC1266-AutoCountMachine\\RC1266-AutoCountMachine.sln",
"PreviewInSolutionExplorer": false
}
\ No newline at end of file
此文件类型无法预览
......@@ -47,6 +47,7 @@
<add key ="PrinterName" value ="ZDesigner GT800-300dpi EPL"/>
<!--是否启用打印标签-->
<add key ="NeedPrintLabel" value ="0"/>
<add key ="StickingPosJudgment" value ="0"/>
<!--XRay射线最后一次使用时间-->
<add key ="XRay_Data" value ="2020-6-2"/>
<add key ="ThresholdValue" value ="30"/>
......
......@@ -59,7 +59,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="AccImageBox">
<HintPath>..\..\..\..\..\TSAV-智能组装机\Line-Smart-Workstation\dll\AccImageBox.dll</HintPath>
<HintPath>..\..\dll\AccImageBox.dll</HintPath>
</Reference>
<Reference Include="Asa.CarerayImage, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
......
......@@ -110,7 +110,7 @@ namespace OnlineStore.AutoCountClient
{
return;
}
chbMoveStop.Checked = equipBean.MoveStop;
if (chbAutoRead.Checked && this.Visible)
{
ReadIOList();
......
......@@ -40,6 +40,7 @@ namespace OnlineStore.AutoCountClient
chbDebug.Checked = equipBean.IsDebug;
chbPrint.Checked = ConfigAppSettings.GetIntValue(Setting_Init.NeedPrintLabel).Equals(1);
chbStickingPos.Checked = ConfigAppSettings.GetIntValue(Setting_Init.StickingPosJudgment).Equals(1);
lblStoreStatus.Text = RobotBase.GetRunStr(equipBean.runStatus);
lblThisSta.Text = equipBean.WarnMsg;
lblName.Text = equipBean.Name;
......@@ -80,6 +81,8 @@ namespace OnlineStore.AutoCountClient
txtYP1.Text = equipBean.Config.LabelY_P1.ToString();
txtYP2.Text = equipBean.Config.LabelY_P2.ToString();
txtYP3.Text = equipBean.Config.LabelY_P3.ToString();
txtYP4.Text = equipBean.Config.LabelY_P4.ToString();
txtYP5.Text = equipBean.Config.LabelY_P5.ToString();
txtZP1.Text = equipBean.Config.LabelZ_P1.ToString();
txtZP2.Text = equipBean.Config.LabelZ_P2.ToString();
......@@ -89,6 +92,7 @@ namespace OnlineStore.AutoCountClient
txtRP1.Text = equipBean.Config.LabelR_P1.ToString();
txtRP2.Text = equipBean.Config.LabelR_P2.ToString();
txtRP3.Text = equipBean.Config.LabelR_P3.ToString();
txtRP4.Text = equipBean.Config.LabelR_P4.ToString();
}
private void LoadIOList()
......@@ -173,6 +177,7 @@ namespace OnlineStore.AutoCountClient
ReadIOList();
ReadBtnDO();
}
chbMoveStop.Checked = equipBean.MoveStop;
if (equipBean.runStatus > RobotRunStatus.Wait)
{
lblName.BackColor = Color.Green;
......@@ -526,7 +531,6 @@ namespace OnlineStore.AutoCountClient
{
AxisMove(equipBean.BatchAxis, txtBP3, equipBean.Config.BatchAxis_P3Speed);
}
private void btnBSave_Click(object sender, EventArgs e)
{
LogUtil.info(equipBean.Name + " 点击: " + btnBSave.Text);
......@@ -568,9 +572,13 @@ namespace OnlineStore.AutoCountClient
int YP1 = FormUtil.GetIntValue(txtYP1);
int YP2 = FormUtil.GetIntValue(txtYP2);
int YP3 = FormUtil.GetIntValue(txtYP3);
int YP4 = FormUtil.GetIntValue(txtYP4);
int YP5 = FormUtil.GetIntValue(txtYP5);
equipBean.Config.LabelY_P1 = YP1;
equipBean.Config.LabelY_P2 = YP2;
equipBean.Config.LabelY_P3 = YP3;
equipBean.Config.LabelY_P4 = YP4;
equipBean.Config.LabelY_P5 = YP5;
int ZP1 = FormUtil.GetIntValue(txtZP1);
int ZP2 = FormUtil.GetIntValue(txtZP2);
......@@ -584,9 +592,11 @@ namespace OnlineStore.AutoCountClient
int RP1 = FormUtil.GetIntValue(txtRP1);
int RP2 = FormUtil.GetIntValue(txtRP2);
int RP3 = FormUtil.GetIntValue(txtRP3);
int RP4 = FormUtil.GetIntValue(txtRP4);
equipBean.Config.LabelR_P1 = RP1;
equipBean.Config.LabelR_P2 = RP2;
equipBean.Config.LabelR_P3 = RP3;
equipBean.Config.LabelR_P4 = RP4;
RobotManager.SaveOutputConfig(equipBean.Config);
......@@ -679,6 +689,15 @@ namespace OnlineStore.AutoCountClient
{
AxisMove(equipBean.LabelYAxis, txtYP3, equipBean.Config.LabelY_P3Speed);
}
private void btnYP4_Click(object sender, EventArgs e)
{
AxisMove(equipBean.LabelYAxis, txtYP4, equipBean.Config.LabelY_P3Speed);
}
private void btnYP5_Click(object sender, EventArgs e)
{
AxisMove(equipBean.LabelYAxis, txtYP5, equipBean.Config.LabelY_P3Speed);
}
private void btnZP1_Click(object sender, EventArgs e)
{
......@@ -709,7 +728,10 @@ namespace OnlineStore.AutoCountClient
{
AxisMove(equipBean.LabelRAxis, txtRP3, equipBean.Config.LabelR_P3Speed);
}
private void btnRP4_Click(object sender, EventArgs e)
{
AxisMove(equipBean.LabelRAxis, txtRP4, equipBean.Config.LabelR_P3Speed);
}
private void comWidth_SelectedIndexChanged(object sender, EventArgs e)
{
if (comWidth.SelectedIndex < 0)
......@@ -773,7 +795,21 @@ namespace OnlineStore.AutoCountClient
LogUtil.info(equipBean.Name + "用户切换 启用标签打印 =" + v);
}
}
private void chbStickingPos_CheckedChanged(object sender, EventArgs e)
{
if (!IsLoad)
{
return;
}
bool isCheck = chbStickingPos.Checked;
string v = (isCheck ? 1 : 0).ToString();
if (ConfigAppSettings.GetValue(Setting_Init.StickingPosJudgment).Equals(v).Equals(false))
{
ConfigAppSettings.SaveValue(Setting_Init.StickingPosJudgment, v);
LogUtil.info(equipBean.Name + "用户切换 启用标签黏贴位置判断 =" + v);
}
}
private void btnZP4_Click(object sender, EventArgs e)
{
AxisMove(equipBean.LabelZAxis, txtZP4, equipBean.Config.LabelZ_P4Speed);
......@@ -804,6 +840,7 @@ namespace OnlineStore.AutoCountClient
equipBean.SecMoveReset();
}
}
}
}
......
......@@ -109,7 +109,7 @@ namespace OnlineStore.AutoCountClient
ReadBtnDO();
lblOpen.Visible =(! equipBean.OpenXLine);
lblLastS.Text = equipBean.LastXRayState;
if (equipBean.xRay.IsRayOpen)
if (equipBean.xRay!=null && equipBean.xRay.IsRayOpen)
{
lblXrOpen.Text = "XRay射线已打开";
}
......
......@@ -36,16 +36,16 @@
<ItemGroup>
<Reference Include="Basler.Pylon, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e389355f398382ab, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\dll\Basler.Pylon.dll</HintPath>
<HintPath>..\..\..\..\GeneralClassLibrary\CodeLibraryProject\CodeLibrary\bin\Debug\Basler.Pylon.dll</HintPath>
</Reference>
<Reference Include="halcondotnet">
<HintPath>..\dll\halcondotnet.dll</HintPath>
<HintPath>..\..\..\..\GeneralClassLibrary\CodeLibraryProject\CodeLibrary\bin\Debug\halcondotnet.dll</HintPath>
</Reference>
<Reference Include="log4net">
<HintPath>..\dll\log4net.dll</HintPath>
<HintPath>..\..\..\..\GeneralClassLibrary\CodeLibraryProject\CodeLibrary\bin\Debug\log4net.dll</HintPath>
</Reference>
<Reference Include="MvCameraControl.Net">
<HintPath>..\dll\MvCameraControl.Net.dll</HintPath>
<HintPath>..\..\..\..\GeneralClassLibrary\CodeLibraryProject\CodeLibrary\bin\Debug\MvCameraControl.Net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
......@@ -58,7 +58,7 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="zxing">
<HintPath>..\dll\zxing.dll</HintPath>
<HintPath>..\..\..\..\GeneralClassLibrary\CodeLibraryProject\CodeLibrary\bin\Debug\zxing.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
......
......@@ -79,7 +79,7 @@ namespace OnlineStore.Common
public static string LabelName = "LabelName";
public static string PrinterName = "PrinterName";
public static string NeedPrintLabel = "NeedPrintLabel";
public static string StickingPosJudgment = "StickingPosJudgment";
public static string XRay_Data = "XRay_Data";
public static string ThresholdValue = "ThresholdValue";
......
......@@ -18,6 +18,8 @@ namespace OnlineStore.Common
public delegate void ShowLog(string msg, Color color);
public static readonly ILog LOGGER = LogManager.GetLogger("RollingLogFileAppender");
public static readonly ILog rfidLog = LogManager.GetLogger("RfidLog");
public static readonly ILog timeCount = LogManager.GetLogger("Count");
public static ConcurrentDictionary<int, DateTime> lastErrorLogTime = new ConcurrentDictionary<int, DateTime>();
public static System.Windows.Forms.RichTextBox logBox = null;
......@@ -26,7 +28,10 @@ namespace OnlineStore.Common
public static bool debug_opened = false;
public static void ticklog(string id,string reelid, double tick,string steppos)
{
timeCount.Info("\t" + id + "\t" +reelid+ "\t" +steppos+"\t"+ tick.ToString());
}
public static void info(ILog log, string msg)
{
if (log == null)
......
......@@ -9,20 +9,20 @@ PRO,0,右侧上料口AGV站号名称,RightAgvName,D3,,,,,
,,,,,,,,,
PRO,0,左侧提升轴待机点 P1,L_BatchAxisP1,100,,,,,
,0,左侧提升轴下降位置P2,L_BatchAxisP2,-48000,,,,,
PRO,0,左侧提升轴缓慢上升目标位置P3,L_BatchAxisP3,5860000,,,,,
PRO,0,左侧提升轴缓慢上升目标位置P3,L_BatchAxisP3,5856000,,,,,
,,,,,,,,,
PRO,0,右侧提升轴待机点 P1,R_BatchAxisP1,100,,,,,
,0,右侧提升轴下降位置P2,R_BatchAxisP2,-48000,,,,,
PRO,0,右侧提升轴缓慢上升目标位置P3,R_BatchAxisP3,5870000,,,,,
,,,,,,,,,
PRO,0,提升轴P1速度,BatchAxis_P1Speed,3000,,,,,
,0,提升轴P2速度,BatchAxis_P2Speed,3000,,,,,
PRO,0,提升轴P3速度,BatchAxis_P3Speed,1000,,,,,
PRO,0,提升轴P1速度,BatchAxis_P1Speed,1500,,,,,
,0,提升轴P2速度,BatchAxis_P2Speed,1500,,,,,
PRO,0,提升轴P3速度,BatchAxis_P3Speed,600,,,,,
PRO,0,提升轴高度转换系数(1mm对应的脉冲),Height_ChangeValue,10446,,,,,
,,,,,,,,,
PRO,0,取料升降轴待机点P1,UpdownAxis_P1,72000,,,,,
PRO,0,取料升降轴取料点P2_左侧,UpdownAxis_P2_L,198000,,,,,
PRO,0,取料升降轴取料点P2_右侧,UpdownAxis_P2_R,197500,,,,,
PRO,0,取料升降轴取料点P2_左侧,UpdownAxis_P2_L,206500,,,,,
PRO,0,取料升降轴取料点P2_右侧,UpdownAxis_P2_R,204000,,,,,
PRO,0,取料升降轴XRay入库放料点P3,UpdownAxis_P3,324990,,,,,
PRO,0,取料升降轴工位放料点P4_高,UpdownAxis_P4_H,187900,,,,,
PRO,0,取料升降轴工位放料点P4_低,UpdownAxis_P4_L,512090,,,,,
......@@ -34,19 +34,19 @@ PRO,0,取料升降轴P4/P5速度,UpdownAxis_P4Speed,1550,,,,,
,,,,,,,,,
,,,,,,,,,
PRO,0,取料旋转轴待机点P1,MiddleAxis_P1,1000,,,,,
PRO,0,取料旋转轴取料点P2_左侧 ,MiddleAxis_P2_L,251300,,,,,
PRO,0,取料旋转轴取料点P2_右侧 ,MiddleAxis_P2_R,155700,,,,,
PRO,0,取料旋转轴取料点P2_左侧 ,MiddleAxis_P2_L,252000,,,,,
PRO,0,取料旋转轴取料点P2_右侧 ,MiddleAxis_P2_R,156000,,,,,
PRO,0,取料旋转轴XRay入口放料点P3,MiddleAxis_P3,4220,,,,,
PRO,0,取料旋转轴工位放料点P4,MiddleAxis_P4,397740,,,,,
,,,,,,,,,
PRO,0,取料旋转轴P1速度,MiddleAxis_P1Speed,1550,,,,,
PRO,0,取料旋转轴P2速度,MiddleAxis_P2Speed,1550,,,,,
PRO,0,取料旋转轴P3速度,MiddleAxis_P3Speed,1550,,,,,
PRO,0,取料旋转轴P4速度,MiddleAxis_P4Speed,1550,,,,,
PRO,0,取料旋转轴P1速度,MiddleAxis_P1Speed,500,,,,,
PRO,0,取料旋转轴P2速度,MiddleAxis_P2Speed,500,,,,,
PRO,0,取料旋转轴P3速度,MiddleAxis_P3Speed,500,,,,,
PRO,0,取料旋转轴P4速度,MiddleAxis_P4Speed,500,,,,,
,,,,,,,,,
PRO,0,取料进出轴待机点P1,InoutAxis_P1,0,,,,,
PRO,0,取料进出轴取料点P2_左侧 ,InoutAxis_P2_L,118600,,,,,
PRO,0,取料进出轴取料点P2_右侧 ,InoutAxis_P2_R,118200,,,,,
PRO,0,取料进出轴取料点P2_左侧 ,InoutAxis_P2_L,116600,,,,,
PRO,0,取料进出轴取料点P2_右侧 ,InoutAxis_P2_R,117400,,,,,
PRO,0,取料进出轴XRay入口放料点P3,InoutAxis_P3,118600,,,,,
PRO,0,取料进出轴工位放料点P4,InoutAxis_P4,116250,,,,,
,,,,,,,,,
......
......@@ -10,20 +10,20 @@ PRO,0,出料提升轴上升待机点 P1,BatchAxisP1,6332000,,,,,
PRO,0,出料提升轴下降位置P2,BatchAxisP2,-80000,,,,,
PRO,0,出料提升轴缓慢上升目标位置P3,BatchAxisP3,5610528,,,,,
,,,,,,,,,
PRO,0,出料提升轴P1速度,BatchAxis_P1Speed,3000,,,,,
PRO,0,出料提升轴P2速度,BatchAxis_P2Speed,3000,,,,,
PRO,0,出料提升轴P3速度,BatchAxis_P3Speed,1700,,,,,
PRO,0,出料提升轴P1速度,BatchAxis_P1Speed,2000,,,,,
PRO,0,出料提升轴P2速度,BatchAxis_P2Speed,2000,,,,,
PRO,0,出料提升轴P3速度,BatchAxis_P3Speed,800,,,,,
PRO,0,出料提升轴高度转换系数(1mm对应的脉冲),Height_ChangeValue,10446,,,,,
,,,,,,,,,
PRO,0,取料X轴待机点-P1,MoveX_P1,2001,,,,,
PRO,0,取料X轴-取料点-P2集合,MoveX_P2List,0=16000;8=150000;12=150000;16=150000;24=150000;32=140000;44=120000;56=100000;13=5150;15=1750;11=10520;7=16250,,,,,
PRO,0,取料X轴-放料点-P3,MoveX_P3,77300,,,,,
PRO,0,取料X轴-取料点-P2集合,MoveX_P2List,0=16800;8=150000;12=150000;16=150000;24=150000;32=140000;44=120000;56=100000;13=5150;15=1750;11=10520;7=16250,,,,,
PRO,0,取料X轴-放料点-P3,MoveX_P3,77000,,,,,
PRO,0,取料X轴P1速度,MoveX_P1Speed,700,,,,,
PRO,0,取料X轴P2速度,MoveX_P2Speed,700,,,,,
PRO,0,取料X轴P3速度,MoveX_P3Speed,700,,,,,
,,,,,,,,,
PRO,0,取料Z轴待机点-P1,MoveZ_P1,2000,,,,,
PRO,0,取料Z轴-取料点-P2集合,MoveZ_P2List,0=443700;8=443700;12=441900;16=438000;24=427900;32=418100;44=407000;56=397620,,,,,
PRO,0,取料Z轴-取料点-P2集合,MoveZ_P2List,0=438000;8=443700;12=441900;16=438000;24=427900;32=418100;44=407000;56=397620,,,,,
PRO,0,取料Z轴-放料点-P3集合,MoveZ_P3List,0=500000;8=102000;12=98600;16=96600;24=90000;32=82000;44=70000;56=62000,,,,,
PRO,0,取料Z轴P1速度,MoveZ_P1Speed,4000,,,,,
PRO,0,取料Z轴P2速度,MoveZ_P2Speed,4000,,,,,
......@@ -37,15 +37,17 @@ PRO,0,贴标机构X轴P2速度,LabelX_P2Speed,3500,,,,,
PRO,0,贴标机构X轴P3速度,LabelX_P3Speed,3500,,,,,
,,,,,,,,,
PRO,0,贴标机构Y轴待机点-P1,LabelY_P1,72406,,,,,
PRO,0,贴标机构Y轴取标签点P2,LabelY_P2,186435,,,,,
PRO,0,贴标机构Y轴取标签点P2,LabelY_P2,191000,,,,,
PRO,0,贴标机构Y轴贴标点P3,LabelY_P3,95430,,,,,
PRO,0,贴标机构Y轴贴标点P4,LabelY_P4,95430,,,,,
PRO,0,贴标机构Y轴侧方位贴标点P5,LabelY_P5,95430,,,,,
PRO,0,贴标机构Y轴P1速度,LabelY_P1Speed,4000,,,,,
PRO,0,贴标机构Y轴P2速度,LabelY_P2Speed,4000,,,,,
PRO,0,贴标机构Y轴P3速度,LabelY_P3Speed,4000,,,,,
,,,,,,,,,
PRO,0,贴标机构Z轴待机点-P1,LabelZ_P1,25481,,,,,
PRO,0,贴标机构Z轴取标签点P2,LabelZ_P2,33850,,,,,
PRO,0,贴标机构Z轴贴标点P3,LabelZ_P3,185706,,,,,
PRO,0,贴标机构Z轴取标签点P2,LabelZ_P2,160800,,,,,
PRO,0,贴标机构Z轴贴标点P3,LabelZ_P3,184000,,,,,
PRO,0,贴标机构Z轴旋转点P4,LabelZ_P4,164000,,,,,
PRO,0,贴标机构Z轴P1速度,LabelZ_P1Speed,4500,,,,,
PRO,0,贴标机构Z轴P2速度,LabelZ_P2Speed,4500,,,,,
......@@ -55,6 +57,7 @@ PRO,0,贴标机构Z轴P4速度,LabelZ_P4Speed,4500,,,,,
PRO,0,贴标机构R轴待机点-P1,LabelR_P1,7400,,,,,
PRO,0,贴标机构R轴取标签点P2,LabelR_P2,7400,,,,,
PRO,0,贴标机构R轴贴标点P3,LabelR_P3,7400,,,,,
PRO,0,贴标机构R轴侧方位贴标点P4,LabelR_P4,3700,,,,,
PRO,0,贴标机构R轴P1速度,LabelR_P1Speed,20,,,,,
PRO,0,贴标机构R轴P2速度,LabelR_P2Speed,20,,,,,
PRO,0,贴标机构R轴P3速度,LabelR_P3Speed,20,,,,,
类型,分类编号,说明,名称,属性值,设备名称,电器定义,目标速度,加速时间,减速时间,原点低速度,原点高速,原点加速度,脉冲最小误差,脉冲最大误差,脉冲最小限位,脉冲最大限位
PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
AXIS,,取料机构旋转轴_SVD01,Take_Middle_Axis,1,COM2,,250,500,500,100,200,1000,10,1000,0,0
AXIS,,取料机构旋转轴_SVD01,Take_Middle_Axis,1,COM2,,500,1000,1000,100,200,1000,10,1000,0,0
AXIS,,取料机构上下轴_SVD02,Take_UpDown_Axis,2,COM2,,1000,1000,1000,200,500,500,10,1000,0,0
AXIS,,取料机构进出轴_SVD03,Take_InOut_Axis,3,COM2,,800,1000,1000,200,500,500,10,1000,0,0
AXIS,,左轨道提升轴_SVD04,Left_Batch_Axis,4,COM2,,3000,1000,1000,200,1000,200,10,1000,0,0
AXIS,,右轨道提升轴_SVD05,Right_Batch_Axis,5,COM2,,3000,1000,1000,200,1000,200,10,1000,0,0
AXIS,,取料移栽机构X轴_SVD06,Move_X_Axis,6,COM4,,100,1400,1400,30,100,1000,10,1000,0,0
AXIS,,取料移栽机构Z轴_SVD07,Move_Z_Axis,7,COM4,,100,700,700,50,250,1000,10,1000,0,0
AXIS,,贴标移栽机构X轴_SVD08,Label_X_Axis,8,COM4,,100,700,700,50,250,500,10,1000,0,0
AXIS,,贴标移栽机构Y轴_SVD09,Label_Y_Axis,9,COM4,,100,700,700,50,150,500,10,1000,0,0
AXIS,,贴标移栽机构Z轴_SVD10,Label_Z_Axis,10,COM4,,100,800,800,50,150,500,10,1000,0,0
AXIS,,贴标移栽机构R轴_SVD11,Label_R_Axis,11,COM4,,10,2000,2000,1,5,200,500,1000,0,0
AXIS,,出料工位提升轴_SVD12,Out_Batch_Axis,12,COM4,,2000,1000,1000,200,1000,500,10,1000,0,0
AXIS,,贴标移栽机构X轴_SVD08,Label_X_Axis,8,COM1,,100,700,700,50,250,500,10,1000,0,0
AXIS,,贴标移栽机构Y轴_SVD09,Label_Y_Axis,9,COM1,,100,700,700,50,150,500,10,1000,0,0
AXIS,,贴标移栽机构Z轴_SVD10,Label_Z_Axis,10,COM1,,100,800,800,50,150,500,10,1000,0,0
AXIS,,贴标移栽机构R轴_SVD11,Label_R_Axis,11,COM1,,10,2000,2000,1,5,200,500,1000,0,0
AXIS,,出料工位提升轴_SVD12,Out_Batch_Axis,12,COM1,,2000,1000,1000,200,1000,500,10,1000,0,0
,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
......@@ -95,7 +95,7 @@ DI,1,右入料线体定位1下降端,R_LocationDown_1,7,PRO_AOI_IP_3,X38,,,,,,,,,,
DI,1,右入料线体定位2上升端,R_LocationUp_2,8,PRO_AOI_IP_3,X39,,,,,,,,,,
DI,1,右入料线体定位2下降端,R_LocationDown_2,9,PRO_AOI_IP_3,X40,,,,,,,,,,
,1,,,10,PRO_AOI_IP_3,X41,,,,,,,,,,
,1,,,11,PRO_AOI_IP_3,X42,,,,,,,,,,
DI,1,取料机构旋转轴到位端,TakeAxis_Location_1,11,PRO_AOI_IP_3,X42,,,,,,,,,,
,1,,,12,PRO_AOI_IP_3,X43,,,,,,,,,,
,1,,,13,PRO_AOI_IP_3,X44,,,,,,,,,,
DI,3,下料机构入口线体顶升上升端,O_ELine_TopUp,14,PRO_AOI_IP_3,X45,,,,,,,,,,
......
......@@ -83,27 +83,48 @@ namespace OnlineStore.DeviceLibrary
}
agvClient.SetStatus(id,mark, shelfId, action, level);
UpdateAction(id, action);
LogUtil.info("AgvClient SetStatus id:"+id+ ",mark:"+ mark + ",shelfId:"+ shelfId+ ",action:"+ action.ToString() + ",level:"+ level.ToString());
}
private static void AgvClient_Ready(string id, string rfid)
{
try
{
UpdateAction(id, ClientAction.Ready);
LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + rfid + "] ");
//UpdateAction(id, ClientAction.Ready);
LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + rfid + "] "+ GetAction(id).ToString());
if (GetAction(id) == ClientAction.NeedEnter)
{
SetStatus(id, "", ClientAction.MayEnter);
}
else if (GetAction(id) == ClientAction.NeedLeave)
{
SetStatus(id, "", ClientAction.MayLeave);
}
if (RobotManager.robot.inputEquip.Config.LeftAgvName.Equals(id))
{
RobotManager.robot.inputEquip.LeftBatchMove.AgvReady(id, rfid);
RobotManager.robot.inputEquip.LeftBatchMove.AgvReady(id, rfid, GetAction(id));
}
else if (RobotManager.robot.inputEquip.Config.RightAgvName.Equals(id))
{
RobotManager.robot.inputEquip.LeftBatchMove.AgvReady(id, rfid);
RobotManager.robot.inputEquip.RightBatchMove.AgvReady(id, rfid, GetAction(id));
}
else if (RobotManager.robot.outputEquip.Config.AgvInName.Equals(id) || RobotManager.robot.outputEquip.Config.AgvOutName.Equals(id))
{
RobotManager.robot.outputEquip.AgvReady(id, rfid);
if (!rfid.StartsWith("B"))
{
//SetStatus(id, "", ClientAction.MayLeave);
}
else
{
//SetStatus(id, "", ClientAction.MayEnter);
}
}
else
{
LogUtil.error("收到 AgvClient_Arrive [" + id + "] [" + rfid + "] 未找到对应的设备 ,暂不处理");
......
......@@ -100,15 +100,16 @@ namespace OnlineStore.DeviceLibrary
&& Robot.CylinderIsOk(IO_LocationUp_1, IO_LocationDown_1)
&& Robot.CylinderIsOk(IO_LocationUp_2, IO_LocationDown_2))
{
if (RobotManager.checkWatch(shelfWatch, 3000, true))
if (RobotManager.checkWatch(shelfWatch, 10000, true))
{
AgvClient.NeedEnter(AgvName, "", Asa.ClientLevel.High);
var agvcallresult=AgvClient.NeedEnter(AgvName, "", Asa.ClientLevel.High);
WorkLog("无料串,:通知agv来送料串AgvName:" + AgvName + ",agvcallresult:" + agvcallresult.ToString());
}
}
else
else// if(AgvClient.GetAction(AgvName)!=Asa.ClientAction.NeedLeave && AgvClient.GetAction(AgvName)!=Asa.ClientAction.MayLeave)
{
shelfWatch.Stop();
AgvClient.SetToNone(AgvName);
//AgvClient.SetToNone(AgvName);
}
}
......@@ -431,7 +432,7 @@ namespace OnlineStore.DeviceLibrary
//等待信号亮或者走到绝对位置才停止
if (Robot.IOValue(BatchAxis.TargetIoType).Equals(BatchAxis.TargetIoValue))
{
LogUtil.debug(Name + "CheckWaitResult 检测到" + BatchAxis.TargetIoType + "=" + BatchAxis.TargetIoValue + ",停止运行");
WorkLog(Name + "CheckWaitResult 检测到" + BatchAxis.TargetIoType + "=" + BatchAxis.TargetIoValue + ",停止运行");
BatchAxis.AxisStopCheckMove();
if (ACServerManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(1))
{
......
......@@ -29,6 +29,11 @@ namespace OnlineStore.DeviceLibrary
{
return false;
}
if (AgvClient.GetAction(AgvName) == ClientAction.NeedLeave || AgvClient.GetAction(AgvName) == ClientAction.MayLeave)
{
//WorkLog("料串入料 :等待AGV来取空料串1");
return false; ;
}
if (Robot.IOValue(IO_LineEnd_Check).Equals(IO_VALUE.HIGH) && Robot.IOValue(IO_LineIn_Check).Equals(IO_VALUE.HIGH))
{
//runStatus = RobotRunStatus.Busy;
......@@ -116,6 +121,10 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsStep(StepEnum.IB04_LineStart))
{
if (AgvClient.GetAction(AgvName) == ClientAction.NeedLeave || AgvClient.GetAction(AgvName) == ClientAction.MayLeave) {
WorkLog("料串入料 :等待AGV来取空料串0");
//return;
}
if (Robot.IOValue(IO_LineIn_Check).Equals(IO_VALUE.HIGH) && Robot.IOValue(IO_LineEnd_Check).Equals(IO_VALUE.HIGH))
{
IB05_WaitTime();
......@@ -147,6 +156,7 @@ namespace OnlineStore.DeviceLibrary
//定位工位有料串,直接开始入料
MoveInfo.NextMoveStep(StepEnum.IB06_LocationUp);
WorkLog("检测到料串:链条停止转动,定位气缸上升");
AgvClient.SetToNone(AgvName);
LocationUp(MoveInfo);
// }
}
......@@ -165,32 +175,36 @@ namespace OnlineStore.DeviceLibrary
LastCodeList = new List<string>();
NextCodeList = new List<string>();
MoveInfo.ShelfNoTray = false;
BatchAxisToP3();
BatchAxisToP3(true);
}
#endregion
#region 检测到托盘,扫码,取料并放入托盘
else if (MoveInfo.IsStep(StepEnum.IB07_AxisUpMove))
{
CheckHasTray();
{
CheckHasTray();//==>StepEnum.IB09_ScanCode
}
else if (MoveInfo.IsStep(StepEnum.IB09_ScanCode))
{
MoveInfo.NextMoveStep(StepEnum.IB10_ScanOK);
MoveInfo.MoveParam.WareCode = CodeManager.GetValidCode(LastCodeList);
WorkLog("料串入料 :扫码结束【" + MoveInfo.MoveParam.WareCode + "】,等待取料机构来取料");
var span = DateTime.Now - MoveInfo.LastSetpTime;
LogUtil.ticklog("", MoveInfo.MoveParam.WareCode, span.TotalSeconds, "拍照扫码结束");
WorkLog("料串入料 :扫码结束【" + MoveInfo.MoveParam.WareCode + "】,等待取料机构来取料,拍照识别耗时:" + span.TotalSeconds.ToString());
}
else if (MoveInfo.IsStep(StepEnum.IB11_TrayLeave))
{
MoveInfo.NextMoveStep(StepEnum.IB12_BatchAxisToP3);
WorkLog("料串入料 :料盘已拿走,批量轴到P3,测盘高 ");
//可删除WaitTime
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
BatchAxisToP3();
}
else if (MoveInfo.IsStep(StepEnum.IB12_BatchAxisToP3))
{
MoveInfo.NextMoveStep(StepEnum.IB13_SaveHight);
//可删除WaitTime
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
LastHeight = GetHeight();
CheckHasTray();
......@@ -211,8 +225,9 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StepEnum.IB23_ShelfOut);
MoveInfo.TimeOutSeconds = 40;
MoveInfo.OneWaitCanEndStep = true;
WorkLog("上料完成 :通知agv来取料串,等待料串离开");
AgvClient.NeedLeave(AgvName, CurrShelfId, ClientLevel.High);
bool agvcallresult = AgvClient.NeedLeave(AgvName, CurrShelfId, ClientLevel.High);
WorkLog("上料完成 :通知agv来取料串,等待料串离开AgvName:" + AgvName + ",CurrShelfId:" + CurrShelfId+ ",agvcallresult:"+ agvcallresult.ToString());
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(60000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_LineIn_Check, IO_VALUE.LOW));
}
......@@ -361,7 +376,7 @@ namespace OnlineStore.DeviceLibrary
if (chaz > BatchAxis.Config.CanErrorCountMax)
{
MoveInfo.NextMoveStep(StepEnum.IB07_AxisUpMove);
WorkLog("料串入料 :CheckHasTray:上料轴开始慢速上升到P3点,等待检测到料盘");
WorkLog("料串入料 :CheckHasTray:上料轴开始慢速上升到P3点,等待检测到料盘。currP"+ currP.ToString());
MoveInfo.ShelfNoTray = false;
BatchAxisToP3();
return;
......@@ -380,7 +395,11 @@ namespace OnlineStore.DeviceLibrary
BatchAxis.SuddenStop(true);
BatchAxis.AbsMove(MoveInfo, BatchAxisP1, Robot.Config.BatchAxis_P1Speed);
}
private void BatchAxisToP3()
/// <summary>
/// 料串往P3提升,直到检测到料盘
/// </summary>
/// <param name="first">是否是第一次测试料窜是否有盘</param>
private void BatchAxisToP3(bool first=false)
{
int targetP3 = BatchAxisP3;
int targetSpeed = Robot.Config.BatchAxis_P3Speed;
......@@ -389,6 +408,13 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.CanWhileCount = 0;
// 需要增加定时器,获取验证信号并停止伺服
StartMovePosition = BatchAxis.GetAclPosition();
if (!first)
{
//如果不是第一次取盘,则每次最多上升16mm
targetP3 = StartMovePosition+Robot.Config.Height_ChangeValue*80;
if (targetP3 > BatchAxisP3)
targetP3 = BatchAxisP3;
}
MoveInfo.WaitList.Add(WaitResultInfo.WaitBatchAxis(BatchAxis.Config, targetP3, targetSpeed));
BatchAxis.Config.TargetPosition = targetP3;
BatchAxis.AbsMove(null, targetP3, targetSpeed);
......@@ -455,9 +481,9 @@ namespace OnlineStore.DeviceLibrary
#region AGV 处理
internal bool ProcessShelfOut = false;
internal bool ProcessShelfEnter = false;
internal void AgvReady(string nodeId, string rfid)
internal void AgvReady(string nodeId, string rfid, ClientAction clientaction)
{
if (string.IsNullOrEmpty(rfid))
if (clientaction== ClientAction.MayLeave)
{
ShelfOutProcess(nodeId, rfid);
}
......@@ -545,9 +571,10 @@ namespace OnlineStore.DeviceLibrary
string logName = Name + "料串" + rfid + "[" + AgvName + "->AGV ] ";
try
{
AgvClient.SetStatus(AgvName, CurrShelfId, ClientAction.None, ClientLevel.High, true);
//AgvClient.SetStatus(AgvName, CurrShelfId, ClientAction.None, ClientLevel.High, true);
if (Robot.IOValue(IO_LineIn_Check).Equals(IO_VALUE.HIGH) || Robot.IOValue(IO_LineEnd_Check).Equals(IO_VALUE.HIGH))
{
LocationDown();
ProcessShelfOut = true;
LineBack();
bool result = Robot.WaitIo(IO_LineIn_Check, IO_VALUE.LOW, 60000);
......@@ -594,6 +621,7 @@ namespace OnlineStore.DeviceLibrary
#endregion
protected void WorkLog(string msg)
{
LogUtil.info(Name + " [" + MoveInfo.MoveStep + "]" + msg);
......
......@@ -61,6 +61,7 @@ namespace OnlineStore.DeviceLibrary
}
}
object worklock = new object();
protected override void BusyMoveProcess()
{
......@@ -80,7 +81,19 @@ namespace OnlineStore.DeviceLibrary
}
if (MoveInfo.MoveType.Equals(RobotMoveType.Working) || this.SecMoveInfo.MoveType.Equals(RobotMoveType.Working))
{
WorkingProcess();
if (Monitor.TryEnter(worklock))
{
try
{
WorkingProcess();
}
catch (Exception ex) {
LogUtil.error(Name + "WorkingProcess出错:", ex);
}
finally {
Monitor.Exit(worklock);
}
}
}
if (MoveInfo.MoveType.Equals(RobotMoveType.Labelling) || SecMoveInfo.MoveType.Equals(RobotMoveType.Labelling))
{
......@@ -293,6 +306,7 @@ namespace OnlineStore.DeviceLibrary
try
{
List<WaitResultInfo> list = moveInfo.WaitList;
int cutWLcount = list.Count;
if (list.Count <= 0)
{
moveInfo.EndStepWait();
......@@ -413,7 +427,12 @@ namespace OnlineStore.DeviceLibrary
}
if (isOk)
{
moveInfo.EndStepWait();
if (moveInfo.WaitList.Count > cutWLcount && !moveInfo.OneWaitCanEndStep)
{
LogUtil.info(moveInfo.Name+" moveInfo.WaitList.Count:" + moveInfo.WaitList.Count.ToString()+ ",cutWLcount:"+ cutWLcount.ToString()); ;
}
moveInfo.EndStepWait();
}
else if (span.TotalSeconds > moveInfo.TimeOutSeconds)
{
......@@ -478,7 +497,7 @@ namespace OnlineStore.DeviceLibrary
}
}
protected void SecWorkLog(string msg,int level=-1)
protected void SecWorkLog(string msg,int level=1)
{
if (level < 0)
{
......@@ -498,7 +517,13 @@ namespace OnlineStore.DeviceLibrary
LogUtil.debug(SecMoveInfo.Name + "[" + code + "]" + "[" + SecMoveInfo.MoveStep + "] " + msg);
}
}
protected void TickLog(string stepname,bool steptime=false)
{
TimeSpan span = DateTime.Now - MoveInfo.MoveStartTime;
if (steptime)
span = DateTime.Now - MoveInfo.LastSetpTime; ;
LogUtil.ticklog(MoveInfo.Name, MoveInfo.MoveParam.WareCode, span.TotalSeconds, stepname);
}
public virtual string GetMoveStr()
{
string msg = "";
......
......@@ -246,6 +246,7 @@ namespace OnlineStore.DeviceLibrary
if (MoveInfo.MoveType.Equals(RobotMoveType.None) && NoErrorAlarm())
{
//若左侧或右侧在等待扫码结束的状态,需要开始去取料
if (LeftBatchMove.MoveInfo.MoveType.Equals(RobotMoveType.Working) && LeftBatchMove.MoveInfo.IsStep(StepEnum.IB10_ScanOK))
{
string code = LeftBatchMove.MoveInfo.MoveParam.WareCode;
......@@ -309,7 +310,7 @@ namespace OnlineStore.DeviceLibrary
//在回原点,复位,出入库时,检测报警间隔减小
if (MoveInfo.MoveType.Equals(RobotMoveType.None))
{
if (span.TotalSeconds < 3)
if (span.TotalSeconds < 5)
{
return;
}
......
......@@ -116,14 +116,14 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.IW04_InoutToP2))
{
MoveInfo.NextMoveStep(StepEnum.IW05_UpdownToP2);
WorkLog("取料: 升降轴下降到P2",0);
WorkLog("取料: 升降轴下降到P2",1);
UpdownAxis.AbsMove(MoveInfo, MoveInfo.MoveParam.Get_Updown_P2(Config), Config.UpdownAxis_P2Speed);
}
else if (MoveInfo.IsStep(StepEnum.IW05_UpdownToP2))
{
MoveInfo.NextMoveStep(StepEnum.IW06_Clamping_Work);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
WorkLog("取料: 夹料气缸夹紧",0);
WorkLog("取料: 夹料气缸夹紧1",0);
CylinderMove(MoveInfo, IO_Type.Clamping_Relax, IO_Type.Clamping_Work);
}
else if (MoveInfo.IsStep(StepEnum.IW06_Clamping_Work))
......@@ -138,7 +138,7 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo.NextMoveStep(StepEnum.IW06_Clamping_Work);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
WorkLog("取料: 夹料气缸夹紧",0);
WorkLog("取料: 夹料气缸夹紧2",0);
CylinderMove(MoveInfo, IO_Type.Clamping_Relax, IO_Type.Clamping_Work);
}
}
......@@ -158,7 +158,7 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.IW08_WaitAxisCheck))
{
MoveInfo.NextMoveStep(StepEnum.IW09_InoutToP1);
WorkLog("取料: 进出轴返回P1");
WorkLog("取料: 进出轴返回P1",1);
if (MoveInfo.MoveParam.InPosType.Equals(1))
{
LeftBatchMove.GetTrayOK();
......@@ -273,6 +273,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StepEnum.IW21_MiddleToP3);
WorkLog(" 开始放料到XRay入口,旋转轴到P3", 1);
MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P3, Config.MiddleAxis_P3Speed);
}
else
{
......@@ -291,20 +292,31 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.IW21_MiddleToP3))
{
MoveInfo.NextMoveStep(StepEnum.IW22_UpdownToP3);
WorkLog("->XRay: 升降轴到P3");
UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P3, Config.UpdownAxis_P3Speed);
if (IOValue(IO_Type.TakeAxis_Location_1).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(StepEnum.IW22_UpdownToP3);
WorkLog("->XRay: 升降轴到P3", 1);
UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P3, Config.UpdownAxis_P3Speed);
}
else if (MiddleAxis.IsInPosition(Config.MiddleAxis_P3))
{
WorkLog("旋转轴已经到P3,但X42传感器没有检测到。");
}
else {
WorkLog("旋转轴没有到位。");
}
}
else if (MoveInfo.IsStep(StepEnum.IW22_UpdownToP3))
{
//向上合并
MoveInfo.NextMoveStep(StepEnum.IW23_InoutToP3);
WorkLog("->XRay:进出轴到P3");
WorkLog("->XRay:进出轴到P3",1);
InOutAxis.AbsMove(MoveInfo, Config.InoutAxis_P3, Config.InoutAxis_P3Speed);
}
else if (MoveInfo.IsStep(StepEnum.IW23_InoutToP3))
{
MoveInfo.NextMoveStep(StepEnum.IW24_WaitCanPut);
WorkLog("->XRay:等待XRay可放料");
WorkLog("->XRay:等待XRay可放料",1);
MoveInfo.TimeOutSeconds = 120;
//TODO
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
......@@ -313,6 +325,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsStep(StepEnum.IW24_WaitCanPut))
{
TickLog("等待XRay可放料",true);
MoveInfo.NextMoveStep(StepEnum.IW41_Clamping_Relax);
RobotManager.robot.XrayBean.In_ReelInfo = MoveInfo.MoveParam.GetReelInfo();
WorkLog("->XRay:夹料气缸放松,更新XRay入口料盘:" + RobotManager.robot.XrayBean.In_ReelInfo.ToStr(),1);
......@@ -339,18 +352,21 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsStep(StepEnum.IW41_Clamping_Relax))
{
//可下合并
MoveInfo.NextMoveStep(StepEnum.IW42_InoutToP1);
WorkLog("放料完成:进出轴返回P1");
InOutAxis.AbsMove(MoveInfo, Config.InoutAxis_P1, Config.InoutAxis_P1Speed);
}
else if (MoveInfo.IsStep(StepEnum.IW42_InoutToP1))
{
//可上合并
MoveInfo.NextMoveStep(StepEnum.IW43_UpdownToP1);
WorkLog("放料完成:升降轴返回P1");
UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P1, Config.UpdownAxis_P1Speed);
}
else if (MoveInfo.IsStep(StepEnum.IW43_UpdownToP1))
{
MoveInfo.NextMoveStep(StepEnum.IW44_MiddleToP2);
WorkLog("放料完成:旋转轴返回P2");
MiddleAxis.AbsMove(MoveInfo, MoveInfo.MoveParam.Get_Middle_P2(Config), Config.MiddleAxis_P2Speed);
......@@ -358,8 +374,10 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.IW44_MiddleToP2))
{
TimeSpan span = DateTime.Now - MoveInfo.MoveStartTime;
MoveInfo.EndMove();
TickLog("放料完成", true);
WorkLog("放料完成,耗时(" + FormUtil.GetSpanStr(span) + ")");
MoveInfo.EndMove();
}
}
......@@ -421,9 +439,15 @@ namespace OnlineStore.DeviceLibrary
if (IOValue(IO_Type.LineIn_GratingSignal).Equals(IO_VALUE.LOW))
{
LogUtil.error(Name+ "未检测到上料线体光栅信号,报警急停");
SetWarnMsg("未检测到上料线体光栅信号,报警急停");
Alarm(AlarmType.SuddenStop);
//LogUtil.error(Name+ "未检测到上料线体光栅信号,报警急停");
//SetWarnMsg("未检测到上料线体光栅信号,报警急停");
//Alarm(AlarmType.SuddenStop);
if (!this.MoveStop)
{
LogUtil.error(Name + "未检测到上料线体光栅信号,暂停运行");
SetWarnMsg("未检测到上料线体光栅信号,暂停运行");
this.MoveStop = true;
}
}
}
......
......@@ -399,7 +399,7 @@ namespace OnlineStore.DeviceLibrary
private DateTime moveLastTime = DateTime.Now;
private DateTime secLastTime = DateTime.Now;
private DateTime shelfLastTime = DateTime.Now;
object worklock = new object();
protected override void OnTimerProcess()
{
if (MoveStop)
......@@ -467,7 +467,21 @@ namespace OnlineStore.DeviceLibrary
{
if (MoveInfo.MoveType.Equals(RobotMoveType.Working))
{
WorkingProcess();
if (Monitor.TryEnter(worklock))
{
try
{
WorkingProcess();
}
catch (Exception ex)
{
LogUtil.error(Name + "WorkingProcess出错:", ex);
}
finally
{
Monitor.Exit(worklock);
}
}
}
else if (MoveInfo.MoveType.Equals(RobotMoveType.Reset) || MoveInfo.MoveType.Equals(RobotMoveType.RHome))
{
......@@ -563,10 +577,11 @@ namespace OnlineStore.DeviceLibrary
AgvClient.NeedEnter(Config.AgvInName, "", Asa.ClientLevel.High);
}
}
else
else if (AgvClient.GetAction(Config.AgvInName) != Asa.ClientAction.MayEnter)
{
needEnterWatch.Stop();
AgvClient.SetToNone(Config.AgvInName);
WorkLog(Config.AgvInName+" " +string.Format("O_ELine_InCheck:{0},O_WLine_InCheck:{1},O_ELine_TopUp{2}", IOValue(IO_Type.O_ELine_InCheck), IOValue(IO_Type.O_WLine_InCheck), IOValue(IO_Type.O_ELine_TopUp)), 1);
}
//出口有信号NeedLeave
......@@ -577,13 +592,13 @@ namespace OnlineStore.DeviceLibrary
AgvClient.NeedLeave(Config.AgvOutName, "", Asa.ClientLevel.High);
}
}
else
else if (AgvClient.GetAction(Config.AgvOutName) != Asa.ClientAction.MayLeave)
{
needLeaveWatch.Stop();
AgvClient.SetToNone(Config.AgvOutName);
WorkLog(Config.AgvOutName+" "+string.Format("O_WLine_OutCheck:{0}", IOValue(IO_Type.O_WLine_OutCheck)), 1);
}
if (NoErrorAlarm())
{
CheckAxisAlarm();
......@@ -692,7 +707,7 @@ namespace OnlineStore.DeviceLibrary
//在回原点,复位,出入库时,检测报警间隔减小
if (MoveInfo.MoveType.Equals(RobotMoveType.None))
{
if (span.TotalSeconds < 3)
if (span.TotalSeconds < 5)
{
return;
}
......
......@@ -304,7 +304,6 @@ namespace OnlineStore.DeviceLibrary
ShelfMoveInfo.NextMoveStep(StepEnum.OS_32_BatchToP2);
ShelfWorkLog("批量轴下降到P2");
BatchAxis.AbsMove(ShelfMoveInfo, Config.BatchAxisP2, Config.BatchAxis_P2Speed);
}
else if (ShelfMoveInfo.IsStep(StepEnum.OS_32_BatchToP2))
{
......@@ -477,6 +476,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
AgvClient.SetStatus(Config.AgvInName, "", ClientAction.None, ClientLevel.High, true);
LogUtil.info(logName + " 入口有料架,暂不处理");
}
}
......@@ -503,8 +503,8 @@ namespace OnlineStore.DeviceLibrary
{
try
{
AgvClient.SetStatus(Config.AgvOutName, "", ClientAction.None, ClientLevel.High, true);
if (IOValue(IO_Type.O_WLine_OutCheck).Equals(IO_VALUE.HIGH))
//AgvClient.SetStatus(Config.AgvOutName, "", ClientAction.None, ClientLevel.High, true);
if (true || IOValue(IO_Type.O_WLine_OutCheck).Equals(IO_VALUE.HIGH))
{
LogUtil.info(logName + " 出口阻挡下降,转动线体");
ProcessShelfOut = true;
......@@ -529,7 +529,7 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.O_WLine_Run, IO_VALUE.LOW);
AgvClient.SetStatus(Config.AgvOutName, "", ClientAction.FinishLeave, ClientLevel.High, true);
Thread.Sleep(2000);
Thread.Sleep(3000);
AgvClient.SetStatus(Config.AgvOutName, "", ClientAction.None, ClientLevel.High, true);
ProcessShelfOut = false;
......@@ -537,6 +537,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
AgvClient.SetStatus(Config.AgvOutName, "", ClientAction.None, ClientLevel.High, true);
LogUtil.info(logName + " 未检测到出口料串,暂不处理");
}
}
......@@ -574,9 +575,15 @@ namespace OnlineStore.DeviceLibrary
}
else if (IOValue(IO_Type.O_ELine_GratingSignal).Equals(IO_VALUE.LOW))
{
LogUtil.error (Name + "未检测到入空料串线体光栅信号,报警急停");
SetWarnMsg("未检测到入空料串线体光栅信号,报警急停");
Alarm(AlarmType.SuddenStop);
//LogUtil.error (Name + "未检测到入空料串线体光栅信号,报警急停");
//SetWarnMsg("未检测到入空料串线体光栅信号,报警急停");
//Alarm(AlarmType.SuddenStop);
if (!this.MoveStop)
{
LogUtil.error(Name + "未检测到入空料串线体光栅信号,暂停运行");
SetWarnMsg("未检测到入空料串线体光栅信号,暂停运行");
this.MoveStop = true;
}
}
if (ProcessShelfOut)
......@@ -585,9 +592,15 @@ namespace OnlineStore.DeviceLibrary
}
else if (IOValue(IO_Type.O_OLine_GratingSignal).Equals(IO_VALUE.LOW))
{
LogUtil.error(Name + "未检测到出料串线体光栅信号,报警急停");
SetWarnMsg("未检测到出料串线体光栅信号,报警急停");
Alarm(AlarmType.SuddenStop);
//LogUtil.error(Name + "未检测到出料串线体光栅信号,报警急停");
//SetWarnMsg("未检测到出料串线体光栅信号,报警急停");
//Alarm(AlarmType.SuddenStop);
if (!this.MoveStop)
{
LogUtil.error(Name + "未检测到出料串线体光栅信号,暂停运行");
SetWarnMsg("未检测到出料串线体光栅信号,暂停运行");
this.MoveStop = true;
}
}
}
......
......@@ -343,7 +343,7 @@ namespace OnlineStore.DeviceLibrary
{
mainTimer.Enabled = false;
StopMove();
AgvClient.SetCancelState(true);
AgvClient.SetCancelState(false);
RFIDManager.Close();
runStatus = RobotRunStatus.Wait;
TimeSpan span = DateTime.Now - StartTime;
......
......@@ -32,7 +32,7 @@ namespace OnlineStore.DeviceLibrary
public bool InXWork = false;
public int ThresholdValue = ConfigAppSettings.GetIntValue(Setting_Init.ThresholdValue);
private int ResultMinCount = 100;
private int ResultMinCount = -1;
private string path_XRAY = Application.StartupPath + @"\XRAY\";
private string path1_tif = Application.StartupPath + @"\XRAY\tif";
......@@ -94,7 +94,7 @@ namespace OnlineStore.DeviceLibrary
}
ParamManager.Init();
ResultMinCount = ConfigAppSettings.GetIntValue(Setting_Init.ResultMinCount);
if (ResultMinCount <= 0)
if (ResultMinCount == -1)
{
ResultMinCount = 100;
}
......@@ -109,12 +109,12 @@ namespace OnlineStore.DeviceLibrary
{
try
{
if (xRay.IsRayOpen)
if (xRay!=null && xRay.IsRayOpen)
{
xRay.Stop();
}
xRay.Close();
if (xRay != null)
xRay.Close();
carerayImage.Close();
}
catch (Exception ex)
......
......@@ -356,8 +356,10 @@ namespace OnlineStore.DeviceLibrary
//{
TimeSpan span = DateTime.Now - MoveInfo.MoveStartTime;
runStatus = RobotRunStatus.Runing;
MoveInfo.EndMove();
TickLog("点料完成");
WorkLog("料盘处理:料盘处理结束,耗时(" + FormUtil.GetSpanStr(span) + ")");
MoveInfo.EndMove();
}
}
......@@ -521,7 +523,10 @@ namespace OnlineStore.DeviceLibrary
lastFileName = Work_ReelInfo.GetImgName();
string fileP = path1_tif + @"\" + lastFileName;
bmp.Save(fileP, System.Drawing.Imaging.ImageFormat.Png);
string backFile = path_XRAY + @"back\" + lastFileName;
var n = DateTime.Now;
string backDir = Path.Combine(path_XRAY, "back", n.Year.ToString() + "-" + n.Month.ToString(), n.Day.ToString(), n.Hour.ToString());
Directory.CreateDirectory(backDir);
string backFile = Path.Combine(backDir, lastFileName);
try
{
bmp.Save(backFile, System.Drawing.Imaging.ImageFormat.Png);
......@@ -630,6 +635,7 @@ namespace OnlineStore.DeviceLibrary
int type = param.Sign;
int threshold = param.Threshold;
int windowsize = param.WindowSize;
/*
if (param.Sign.Equals(0))
{
result = carerayImage.GetLocalCount(fileP, threshold, windowsize, out countStr, out tpDstImg);
......@@ -645,7 +651,17 @@ namespace OnlineStore.DeviceLibrary
if (array.Length > 0)
{
count= Convert.ToInt32(array[0]);
}
}*/
result = carerayImage.GetLocalCount(fileP, threshold, windowsize, out countStr, out tpDstImg);
LogUtil.info("GetCountResult " + type + " 调用 GetLocalCount 【" + fileP + "】【" + threshold + "】【" + windowsize + "】,返回【" + result + "】,结果【" + countStr + "】");
string[] array = countStr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
count = (from a in array where int.TryParse(a, out _) && int.Parse(a) > 0 select int.Parse(a)).FirstOrDefault();
string resfilename = Path.GetFileNameWithoutExtension(fileP)+ "-Mark.png";
string root = Path.Combine(Application.StartupPath, "ResOut");
var n = DateTime.Now;
string destdir = Path.Combine(root, n.Year.ToString() + "-" + n.Month.ToString(), n.Day.ToString(), n.Hour.ToString());
Directory.CreateDirectory(destdir);
Directory.Move(Path.Combine(root, resfilename), Path.Combine(destdir, resfilename));
}
catch (Exception ex)
{
......
using CodeLibrary;
using CodeLibrary;
using HalconDotNet;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
......@@ -7,6 +8,7 @@ using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Windows.Forms;
......@@ -97,10 +99,15 @@ namespace OnlineStore.DeviceLibrary
}
private static int ScanCount = 0;
private static int codeCount = ConfigAppSettings.GetIntValue(Setting_Init.CodeCount);
public static List<string> CameraScan(string deviceName, params string[] cameraList) {
return CameraScan(deviceName, out _, false, cameraList);
}
[HandleProcessCorruptedStateExceptions]
public static List<string> CameraScan(string deviceName, params string[] cameraList)
public static List<string> CameraScan(string deviceName, out List<CodeInfo> ccall, bool nosave,params string[] cameraList)
{
List<string> codeList = new List<string>();
List<CodeInfo> cc;
ccall = new List<CodeInfo>();
if (cameraList == null || cameraList.Length <= 0)
{
return codeList;
......@@ -132,7 +139,7 @@ namespace OnlineStore.DeviceLibrary
}
LogUtil.debug(deviceName + " 【" + cameraName + "】取图片完成,开始扫码");
List<CodeInfo> cc = new List<CodeInfo>();
//cc = new List<CodeInfo>();
string r = "";
foreach (string codeType in codeTypeList)
{
......@@ -145,6 +152,7 @@ namespace OnlineStore.DeviceLibrary
{
cc = HDCodeHelper.DecodeCode(ho_Image, codeType, GetCodeParamFilePath(codeType), codeCount, 1500);
}
foreach (CodeInfo c in cc)
{
string str = CodeManager.ReplaceCode(c.CodeStr);
......@@ -155,11 +163,13 @@ namespace OnlineStore.DeviceLibrary
if (!findRightCode)
{
findRightCode = HasRightCode(str);
if (findRightCode)
ccall.Add(c);
}
}
}
}
if (!findRightCode)
if (!findRightCode && !nosave)
{
SaveImageToFile(deviceName, cameraName, ho_Image);
}
......@@ -199,7 +209,7 @@ namespace OnlineStore.DeviceLibrary
}
return codeList;
}
private static void SaveImageToFile(string deviceName, string cameraName, HalconDotNet.HObject bitmap)
private static string SaveImageToFile(string deviceName, string cameraName, HalconDotNet.HObject bitmap)
{
string date = deviceName.Trim().Replace('_', '-') + "-" + DateTime.Now.ToString("yyyyMMdd-HHmmss") + "-" + DateTime.Now.Millisecond.ToString().PadLeft(4, '0');
string dire = @"D:\image\" + deviceName.Trim().Replace('_', '-') + @"\" + cameraName.Trim().Replace('_', '-').Replace(':', '-') + @"\";
......@@ -218,6 +228,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error("保存" + deviceName + " 【" + cameraName + "】的图片到【" + dire + iamgeName + "】出错" + ex.ToString());
}
return dire + iamgeName;
}
private static void SaveImageToFile(string deviceName, string cameraName, Bitmap bitmap)
{
......@@ -377,5 +388,43 @@ namespace OnlineStore.DeviceLibrary
}
return "";
}
[DllImport("Kernel32.dll")]
private static extern void CopyMemory(IntPtr dest, IntPtr source, int size);
public static void HObject2Bpp8(HObject image, out Bitmap res)
{
HTuple hpoint, type, width, height;
const int Alpha = 255;
int[] ptr = new int[2];
HOperatorSet.GetImagePointer1(image, out hpoint, out type, out width, out height);
res = new Bitmap(width, height, PixelFormat.Format8bppIndexed);
ColorPalette pal = res.Palette;
for (int i = 0; i <= 255; i++)
{
pal.Entries[i] = Color.FromArgb(Alpha, i, i, i);
}
res.Palette = pal;
Rectangle rect = new Rectangle(0, 0, width, height);
BitmapData bitmapData = res.LockBits(rect, ImageLockMode.WriteOnly, PixelFormat.Format8bppIndexed);
int PixelSize = Bitmap.GetPixelFormatSize(bitmapData.PixelFormat) / 8;
ptr[0] = bitmapData.Scan0.ToInt32();
ptr[1] = hpoint.I;
if (width % 4 == 0)
CopyMemory((IntPtr)ptr[0], (IntPtr)ptr[1], width * height * PixelSize);
else
{
for (int i = 0; i < height - 1; i++)
{
ptr[1] += width;
CopyMemory((IntPtr)ptr[0], (IntPtr)ptr[1], width * PixelSize);
ptr[0] += bitmapData.Stride;
}
}
res.UnlockBits(bitmapData);
}
}
}
......@@ -358,6 +358,13 @@ namespace OnlineStore.DeviceLibrary
}
return false;
}
/// <summary>
/// 气缸运动
/// </summary>
/// <param name="moveInfo"></param>
/// <param name="IoLowType"></param>
/// <param name="IoHighType"></param>
/// <param name="isCheckMove"></param>
public void CylinderMove(RobotMoveInfo moveInfo, string IoLowType, string IoHighType, bool isCheckMove = false)
{
try
......
......@@ -25,6 +25,7 @@ namespace OnlineStore.DeviceLibrary
this.PlateW = plateW;
this.PlateH = plateH;
this.IsTest = test;
this.codePointer = new System.Drawing.Point(0, 0);
}
public string WareCode = "";
......@@ -60,6 +61,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public bool IsTest = false;
public System.Drawing.Point codePointer;
public string ToStr()
{
string tP = "";
......
......@@ -212,6 +212,10 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
public static string R_LocationDown_2 = "R_LocationDown_2";
/// <summary>
/// DI,1,取料机构旋转轴到位端,TakeAxis_Location_1,11,PRO_AOI_IP_3,X42,,,,,,,,,,
/// </summary>
public static string TakeAxis_Location_1 = "TakeAxis_Location_1";
/// <summary>
/// DI,3,下料机构入口线体顶升上升端,O_ELine_TopUp,14,PRO_AOI_IP_3,X45,,,,,,,,,,
/// </summary>
public static string O_ELine_TopUp = "O_ELine_TopUp";
......
......@@ -29,12 +29,12 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// PRO,0,空料串入口AGV站号名称,AgvInName,F3,,,,,
/// PRO,0,空料串入口AGV站号名称,AgvInName,D1,,,,,
/// </summary>
[ConfigProAttribute("AgvInName")]
public string AgvInName { get; set; }
/// <summary>
/// PRO,0,料串出口AGV站号名称,AgvOutName,F4,,,,,
/// PRO,0,料串出口AGV站号名称,AgvOutName,D2,,,,,
/// </summary>
[ConfigProAttribute("AgvOutName")]
public string AgvOutName { get; set; }
......@@ -194,6 +194,16 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("LabelY_P3")]
public int LabelY_P3 { get; set; }
/// <summary>
/// PRO,0,贴标机构Y轴贴标点P4,LabelY_P4,95430,,,,,
/// </summary>
[ConfigProAttribute("LabelY_P4")]
public int LabelY_P4 { get; set; }
/// <summary>
/// PRO,0,贴标机构Y轴侧方位贴标点P5,LabelY_P5,95430,,,,,
/// </summary>
[ConfigProAttribute("LabelY_P5")]
public int LabelY_P5 { get; set; }
/// <summary>
/// PRO,0,贴标机构Y轴P1速度,LabelY_P1Speed,500,,,,,
/// </summary>
[ConfigProAttribute("LabelY_P1Speed")]
......@@ -258,6 +268,11 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("LabelR_P3")]
public int LabelR_P3 { get; set; }
/// <summary>
/// PRO,0,贴标机构R轴侧方位贴标点P4,LabelR_P4,3700,,,,,
/// </summary>
[ConfigProAttribute("LabelR_P4")]
public int LabelR_P4 { get; set; }
/// <summary>
/// PRO,0,贴标机构R轴P1速度,LabelR_P1Speed,500,,,,,
/// </summary>
[ConfigProAttribute("LabelR_P1Speed")]
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!