Commit 8e9f5898 张东亮

存储机构-打印移栽升降轴日志

1 个父辈 0da9290e
...@@ -36,12 +36,12 @@ PRO,0,抽屉内行数,Rows_In_Drawer,4,,,,,,,,,,,, ...@@ -36,12 +36,12 @@ PRO,0,抽屉内行数,Rows_In_Drawer,4,,,,,,,,,,,,
PRO,0,抽屉内列数,Cols_In_Drawer,20,,,,,,,,,,,, PRO,0,抽屉内列数,Cols_In_Drawer,20,,,,,,,,,,,,
,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,
PRO,0,行走机构视觉对位速度,MoveAxis_FindPosSpeed,20,,,,,,,,,,,, PRO,0,行走机构视觉对位速度,MoveAxis_FindPosSpeed,20,,,,,,,,,,,,
PRO,0,升降轴视觉对位速度,UpdownAxis_FindPosSpeed,20,,,,,,,,,,,,
PRO,0,拉取升降轴视觉对位速度,PullAxis_Updown_FindPosSpeed,20,,,,,,,,,,,,
PRO,0,行走机构正极限位置,MoveAxis_PosLimit,20,,,,,,,,,,,, PRO,0,行走机构正极限位置,MoveAxis_PosLimit,20,,,,,,,,,,,,
PRO,0,行走机构负极限位置,MoveAxis_NegLimit,20,,,,,,,,,,,, PRO,0,行走机构负极限位置,MoveAxis_NegLimit,20,,,,,,,,,,,,
PRO,0,升降轴视觉对位速度,UpdownAxis_FindPosSpeed,20,,,,,,,,,,,,
PRO,0,升降轴正极限位置,UpdownAxis_PosLimit,20,,,,,,,,,,,, PRO,0,升降轴正极限位置,UpdownAxis_PosLimit,20,,,,,,,,,,,,
PRO,0,升降轴负极限位置,UpdownAxis_NegLimit,20,,,,,,,,,,,, PRO,0,升降轴负极限位置,UpdownAxis_NegLimit,20,,,,,,,,,,,,
PRO,0,拉取升降轴视觉对位速度,PullAxis_Updown_FindPosSpeed,20,,,,,,,,,,,,
PRO,0,拉取升降轴正极限位置,PullAxis_Updown_PosLimit,20,,,,,,,,,,,, PRO,0,拉取升降轴正极限位置,PullAxis_Updown_PosLimit,20,,,,,,,,,,,,
PRO,0,拉取升降轴负极限位置,PullAxis_Updown_NegLimit,20,,,,,,,,,,,, PRO,0,拉取升降轴负极限位置,PullAxis_Updown_NegLimit,20,,,,,,,,,,,,
PRO,0,抓手检测得分阈值,TongsDetectThreshold,20,,,,,,,,,,,, PRO,0,抓手检测得分阈值,TongsDetectThreshold,20,,,,,,,,,,,,
......
...@@ -97,6 +97,7 @@ ...@@ -97,6 +97,7 @@
<Compile Include="storeBean\boxBean\EyemLibDemo.cs" /> <Compile Include="storeBean\boxBean\EyemLibDemo.cs" />
<Compile Include="storeBean\boxBean\Humiture\HumitureBean.cs" /> <Compile Include="storeBean\boxBean\Humiture\HumitureBean.cs" />
<Compile Include="storeBean\boxBean\Humiture\HumitureController.cs" /> <Compile Include="storeBean\boxBean\Humiture\HumitureController.cs" />
<Compile Include="storeBean\boxBean\positionDebug\DrawerResult.cs" />
<Compile Include="storeBean\boxBean\positionDebug\PositionDebugManager.cs" /> <Compile Include="storeBean\boxBean\positionDebug\PositionDebugManager.cs" />
<Compile Include="storeBean\boxBean\positionDebug\PositionDebugResult.cs" /> <Compile Include="storeBean\boxBean\positionDebug\PositionDebugResult.cs" />
<Compile Include="storeBean\inputBean\BatchMoveBean.cs" /> <Compile Include="storeBean\inputBean\BatchMoveBean.cs" />
......
...@@ -303,6 +303,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -303,6 +303,13 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
if(wait.AxisInfo.DeviceName.Equals("移栽升降轴"))
{
string deviceName = wait.AxisInfo.DeviceName;
short axisNo = wait.AxisInfo.GetAxisValue();
int outCount = AxisManager.instance.GetActualtPosition(deviceName, axisNo);
LogInfo($"移栽升降轴 目标位置:{wait.TargetPosition},当前位置:{outCount}");
}
wait.IsEnd = AxisBean.ACAxisMoveIsEnd(moveInfo, wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg); wait.IsEnd = AxisBean.ACAxisMoveIsEnd(moveInfo, wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg);
} }
if (!msg.Equals("")) if (!msg.Equals(""))
......
...@@ -128,6 +128,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -128,6 +128,10 @@ namespace OnlineStore.DeviceLibrary
InitPosititionNumList(); InitPosititionNumList();
InitDrawInfos(); InitDrawInfos();
LoadCameraConfig(); LoadCameraConfig();
//库位测试
//InitPosDebugInfo();
//Test();
} }
void InitRowColumnSig() void InitRowColumnSig()
{ {
......
...@@ -162,7 +162,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -162,7 +162,7 @@ namespace OnlineStore.DeviceLibrary
case StepEnum.SI_02_ToBufferArea: case StepEnum.SI_02_ToBufferArea:
if (!InDoorCheck(MoveInfo.MoveParam)) if (!InDoorCheck(MoveInfo.MoveParam))
{ {
SetWarnMsg($" 存储机构-入库 {MoveInfo.SLog}:入口料盘无入库信息[barcode={MoveInfo.MoveParam.PosInfo.barcode},PosSide={MoveInfo.MoveParam.PosInfo.GetPosSide()}], 任务取消"); SetWarnMsg($"入库 {MoveInfo.SLog}:入口料盘无入库信息[barcode={MoveInfo.MoveParam.PosInfo.barcode},PosSide={MoveInfo.MoveParam.PosInfo.GetPosSide()}], 任务取消");
if (MoveInfo.MoveParam.PosInfoBack == null) if (MoveInfo.MoveParam.PosInfoBack == null)
{ {
LogInfo($"入库 {MoveInfo.SLog}:入口料盘因无入库信息且AB面料叉无料,结束入库"); LogInfo($"入库 {MoveInfo.SLog}:入口料盘因无入库信息且AB面料叉无料,结束入库");
......
using System; using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
...@@ -6,15 +7,37 @@ using System.Threading.Tasks; ...@@ -6,15 +7,37 @@ using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary namespace OnlineStore.DeviceLibrary
{ {
partial class BoxEquip public partial class BoxEquip
{ {
public bool isInitPosDebugInfo = false; public bool isInitPosDebugInfo = false;
PosDebugInfo posDebugInfo = null;
public void InitPosDebugInfo() public void InitPosDebugInfo()
{ {
PosDebugResultManager.Init(PositionNumList); PosDebugResultManager.Init(PositionNumList);
isInitPosDebugInfo = PosDebugResultManager.isInit; isInitPosDebugInfo = PosDebugResultManager.isInit;
posDebugInfo = new PosDebugInfo(this.CID, this.Config);
posDebugInfo.SetDrawerParam(1, 1, 15, 6);
posDebugInfo.SetGridParam(1, 1, 4, 20);
}
public void Test()
{
while(!posDebugInfo.IsLastDrawer())
{
while(!posDebugInfo.IsLastGrid())
{
posDebugInfo.NextGrid();
}
posDebugInfo.NextDrawer();
}
}
/// <summary>
/// 设置抽屉的结果代码
/// </summary>
/// <param name="code"></param>
private void SetDrawerResult(int code)
{
PosDebugResultManager.SetDrawerResult(posDebugInfo.CurDrawer, code);
} }
public void PosDebugProcess() public void PosDebugProcess()
{ {
if (MoveInfo.IsInWait) if (MoveInfo.IsInWait)
...@@ -25,42 +48,77 @@ namespace OnlineStore.DeviceLibrary ...@@ -25,42 +48,77 @@ namespace OnlineStore.DeviceLibrary
{ {
return; return;
} }
switch(MoveInfo.MoveStep) switch (MoveInfo.MoveStep)
{ {
case StepEnum.SP_00_1_StartPosDebug: case StepEnum.SP_00_1_StartPosDebug:
PullAxisToP1("库位调试"); PullAxisToP1("库位调试");
break; break;
case StepEnum.SP_00_2_PullAxisReady: case StepEnum.SP_00_2_PullAxisReady:
SetBoxStatus(DeviceStatus.Debugging, RunStatus.Busy); SetBoxStatus(DeviceStatus.Debugging, RunStatus.Busy);
MoveInfo.NextMoveStep(StepEnum.SP_02_VerifyBufferState); MoveInfo.NextMoveStep(StepEnum.SP_00_3_CheckMoveAxisSafe);
if (!IsMoveAxisInSafePos())
{
MoveAxisToP1();
LogInfo($"库位调试 行走机构不在安全位置,先到安全位置={Config.MoveAxis_SafePos}。当前位置{MoveAxis.GetAclPosition()}");
}
break; break;
case StepEnum.SP_00_3_CheckMoveAxisSafe: case StepEnum.SP_00_3_CheckMoveAxisSafe:
MoveInfo.NextMoveStep(StepEnum.SP_01_ToBufferArea);
LogInfo($"库位调试 {MoveInfo.SLog}:到暂存区入料口," +
$"行走机构到待机点P1,料屉升降轴到P1点,移栽升降轴到上暂存区取料低点P3/P9,移栽压紧轴到压紧前点P2,移栽旋转轴到取放料水平点P2,移栽X轴到P1,料屉升降轴到P1点[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
MoveAxisToP1();
PullAxis_UpdownToP1();
UpdownAxisTo_P3_P9();
ComAxis_To_P2();
MiddleAxis_To_P2();
XAxis_To_P1();
break; break;
case StepEnum.SP_01_ToBufferArea: case StepEnum.SP_01_ToBufferArea:
MoveInfo.NextMoveStep(StepEnum.SP_02_VerifyBufferState); if (!InDoorCheck(MoveInfo.MoveParam))
LogInfo($"库位调试 {MoveInfo.SLog}:[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); {
SetWarnMsg($"库位调试 {MoveInfo.SLog}:入口料盘无信息[barcode={MoveInfo.MoveParam.PosInfo.barcode},PosSide={MoveInfo.MoveParam.PosInfo.GetPosSide()}],结束调试");
SetBoxStatus(DeviceStatus.Debugging, RunStatus.Runing);
MoveInfo.EndMove();
}
else
{
MoveInfo.NextMoveStep(StepEnum.SP_02_VerifyBufferState);
LogInfo($"库位调试 {MoveInfo.SLog}:入料口料盘信息确认[barcode={MoveInfo.MoveParam.PosInfo.barcode}][posId={MoveInfo.MoveParam.PosInfo.PosId}][{MoveInfo.MoveParam.PosInfo.GetPosSide()}面],开始取料");
}
break; break;
case StepEnum.SP_02_VerifyBufferState: case StepEnum.SP_02_VerifyBufferState:
MoveInfo.NextMoveStep(StepEnum.SP_03_XAxisToBuff); if (!CheckInputMiddleAxisInBuff())
LogInfo($"库位调试 {MoveInfo.SLog}:[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); {
MoveInfo.NextMoveStep(StepEnum.SP_03_XAxisToBuff);
LogInfo($"库位调试 {MoveInfo.SLog}:移栽X轴到暂存区取放点P2,行走机构到取放点P2[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
XAxis_To_P2();
MoveAxisToP2();
}
else if (MoveInfo.IsTimeOut())
{
SetWarnMsg($"等待上料机构旋转轴离开{MoveInfo.MoveParam.PosInfo.GetPosSide()}面暂存区超时");
}
break; break;
case StepEnum.SP_03_XAxisToBuff: case StepEnum.SP_03_XAxisToBuff:
MoveInfo.NextMoveStep(StepEnum.SP_04_GetReel); MoveInfo.NextMoveStep(StepEnum.SP_04_GetReel);
LogInfo($"库位调试 {MoveInfo.SLog}:[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); LogInfo($"库位调试 {MoveInfo.SLog}:取料盘,移栽升降轴到上暂存区取料高点P2/P8,移栽压紧轴到压紧点P3[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
UpdownAxisTo_P2_P8();
ComAxis_To_P3();
break; break;
case StepEnum.SP_04_GetReel: case StepEnum.SP_04_GetReel:
MoveInfo.NextMoveStep(StepEnum.SP_05_XAxisBackToP1); MoveInfo.NextMoveStep(StepEnum.SP_05_XAxisBackToP1);
LogInfo($"库位调试 {MoveInfo.SLog}:[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); LogInfo($"库位调试 {MoveInfo.SLog}:移栽X轴到待机点P1[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
XAxis_To_P1();
break; break;
case StepEnum.SP_05_XAxisBackToP1: case StepEnum.SP_05_XAxisBackToP1:
MoveInfo.NextMoveStep(StepEnum.SP_06_ClearBuffInfo); MoveInfo.NextMoveStep(StepEnum.SP_06_ClearBuffInfo);
LogInfo($"库位调试 {MoveInfo.SLog}:[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); LogInfo($"库位调试 {MoveInfo.SLog}:[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
//清空暂存区料盘信息
ClearInDoorBuffer();
break; break;
case StepEnum.SP_06_ClearBuffInfo: case StepEnum.SP_06_ClearBuffInfo:
...@@ -69,57 +127,87 @@ namespace OnlineStore.DeviceLibrary ...@@ -69,57 +127,87 @@ namespace OnlineStore.DeviceLibrary
break; break;
case StepEnum.SP_07_MiddleToP3: case StepEnum.SP_07_MiddleToP3:
MoveInfo.NextMoveStep(StepEnum.SP_08_ToPosition); MoveInfo.NextMoveStep(StepEnum.SP_08_ToPosition);
LogInfo($"库位调试 {MoveInfo.SLog}:[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); LogInfo($"库位调试 {MoveInfo.SLog}:运行到库位,移栽升降轴到料屉上方过渡点P6/P12,行走机构到存储库位取放点位P3," +
$"料斗拉取升降轴到料屉提取低点P4,料屉拉取进出轴到拍照点,移栽旋转轴到料屉库位垂直取放料点P3,移栽X轴到料屉库位取放料点P3[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
XAxis_To_P3();
PullAxis_Inout_To_Cam();
MiddleAxis_To_P3();
MoveAxisToP3();
PullAxis_UpdownToLowP4();
UpdownAxisTo_P6_P12();
break; break;
case StepEnum.SP_08_ToPosition: case StepEnum.SP_08_ToPosition:
MoveInfo.NextMoveStep(StepEnum.SP_09_ToDrawer); if (CamCheckReelPosition())
LogInfo($"库位调试 {MoveInfo.SLog}:[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); {
MoveInfo.NextMoveStep(StepEnum.SP_09_ToDrawer);
LogInfo($"库位调试 {MoveInfo.SLog}:到抽屉提取点,料斗拉取进出轴到料屉提取点P2/P4[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
ToTray();
CamDetectError = false;
IgnoreCamDect = false;
}
else
{
MoveInfo.NextMoveStep(StepEnum.SP_25_ToNextGrid);
PosDebugResultManager.SetDrawerResult(posDebugInfo.CurDrawer, 0);
LogInfo($"库位调试 {MoveInfo.SLog}:视觉检查失败,抽屉[{posDebugInfo.CurDrawer}]NG [{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
}
break; break;
case StepEnum.SP_09_ToDrawer: case StepEnum.SP_09_ToDrawer:
MoveInfo.NextMoveStep(StepEnum.SP_10_LiftDrawer); MoveInfo.NextMoveStep(StepEnum.SP_10_LiftDrawer);
LogInfo($"库位调试 {MoveInfo.SLog}:[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); LogInfo($"库位调试 {MoveInfo.SLog}:提升抽屉,料斗拉取升降轴到料屉提取高点P3 [{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
PullAxis_UpdownToHighP3();
break; break;
case StepEnum.SP_10_LiftDrawer: case StepEnum.SP_10_LiftDrawer:
MoveInfo.NextMoveStep(StepEnum.SP_11_PullDrawer); MoveInfo.NextMoveStep(StepEnum.SP_11_PullDrawer);
LogInfo($"库位调试 {MoveInfo.SLog}:[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); LogInfo($"库位调试 {MoveInfo.SLog}:拉抽屉到库位点,料斗拉取进出轴到料屉库位点P3/P5[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
PullAxis_Inout_To_P3_P5();
break; break;
case StepEnum.SP_11_PullDrawer: case StepEnum.SP_11_PullDrawer:
MoveInfo.NextMoveStep(StepEnum.SP_12_DropDrawerToPos); MoveInfo.NextMoveStep(StepEnum.SP_12_DropDrawerToPos);
LogInfo($"库位调试 {MoveInfo.SLog}:[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); LogInfo($"库位调试 {MoveInfo.SLog}:将抽屉降到库位提取点,料斗拉取升降轴到P2料屉提取水平点P2,到位后检测{trayRows[GetPosRow()]}=1 [{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
PullAxis_UpdownToMiddleP2();
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(trayRows[GetPosRow()], IO_VALUE.HIGH));
break; break;
case StepEnum.SP_12_DropDrawerToPos: case StepEnum.SP_12_DropDrawerToPos:
MoveInfo.NextMoveStep(StepEnum.SP_13_PutReel); MoveInfo.NextMoveStep(StepEnum.SP_13_PutReel);
LogInfo($"库位调试 {MoveInfo.SLog}:[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); LogInfo($"库位调试 {MoveInfo.SLog}:进入库位中,移栽升降轴到料屉取放点P7/P13[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
UpdownAxisToP7_P13();
SaveSpecifiedImage();
break; break;
case StepEnum.SP_13_PutReel: case StepEnum.SP_13_PutReel:
MoveInfo.NextMoveStep(StepEnum.SP_14_ReleaseCompress); MoveInfo.NextMoveStep(StepEnum.SP_14_ReleaseCompress);
LogInfo($"库位调试 {MoveInfo.SLog}:[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); LogInfo($"库位调试 {MoveInfo.SLog}:压紧轴开始缓慢释放,移栽压紧轴到压紧前点P2[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
ComAxis_To_P2();
break; break;
case StepEnum.SP_14_ReleaseCompress: case StepEnum.SP_14_ReleaseCompress:
MoveInfo.NextMoveStep(StepEnum.SP_15_UpDownBack); MoveInfo.NextMoveStep(StepEnum.SP_15_UpDownBack);
LogInfo($"库位调试 {MoveInfo.SLog}:[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); LogInfo($"库位调试 {MoveInfo.SLog}:叉子从库位返回[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
UpdownAxisTo_P6_P12();
break; break;
case StepEnum.SP_15_UpDownBack: case StepEnum.SP_15_UpDownBack:
MoveInfo.NextMoveStep(StepEnum.SP_16_GetReel); MoveInfo.NextMoveStep(StepEnum.SP_16_GetReel);
LogInfo($"库位调试 {MoveInfo.SLog}:[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); LogInfo($"库位调试 {MoveInfo.SLog}:进入库位中,移栽升降轴到料屉取放点P7/P13[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
UpdownAxisToP7_P13();
break; break;
case StepEnum.SP_16_GetReel: case StepEnum.SP_16_GetReel:
MoveInfo.NextMoveStep(StepEnum.SP_17_StartCompress); MoveInfo.NextMoveStep(StepEnum.SP_17_StartCompress);
LogInfo($"库位调试 {MoveInfo.SLog}:[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); LogInfo($"库位调试 {MoveInfo.SLog}:压紧轴开始缓慢夹取,移栽压紧轴到压紧点P3[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
ComAxis_To_P3();
break; break;
case StepEnum.SP_17_StartCompress: case StepEnum.SP_17_StartCompress:
MoveInfo.NextMoveStep(StepEnum.SP_18_UpDownBack); MoveInfo.NextMoveStep(StepEnum.SP_18_UpDownBack);
LogInfo($"库位调试 {MoveInfo.SLog}:[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); LogInfo($"库位调试 {MoveInfo.SLog}:叉子从库位返回,移栽升降轴到料屉上方过度点P6/P12 [{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
UpdownAxisTo_P6_P12();
break; break;
case StepEnum.SP_18_UpDownBack: case StepEnum.SP_18_UpDownBack:
...@@ -159,21 +247,227 @@ namespace OnlineStore.DeviceLibrary ...@@ -159,21 +247,227 @@ namespace OnlineStore.DeviceLibrary
case StepEnum.SP_25_ToNextGrid: case StepEnum.SP_25_ToNextGrid:
SetBoxStatus(DeviceStatus.Debugging, RunStatus.Runing); SetBoxStatus(DeviceStatus.Debugging, RunStatus.Runing);
MoveInfo.EndMove(); MoveInfo.EndMove();
break; break;
} }
} }
} }
public class PosDebugInfo public class PosDebugInfo
{ {
public string PosSide { get; set; } public PosDebugInfo(string cid, BoxEquip_Config config)
public int StartDrawerRow { get; set; } {
public int StartDrawerCol { get; set; } CID = cid;
public int StartRowInDrawer { get; set; } this.config = config;
public int StartColInDrawer { get; set; } }
BoxEquip_Config config;
/// <summary>
/// 当前抽屉
/// </summary>
public string CurDrawer { get { return $"{CID}{PosSide}{CurDrawerRow.ToString("00")}{CurDrawerCol.ToString("00")}"; } }
/// <summary>
/// 当前料格
/// </summary>
public string CurGrid { get { return $"{CurDrawer}{CurRowInDrawer}{CurColInDrawer}"; } }
public string CID { get; private set; }
public string PosSide { get; set; } = "AA";
public int CurDrawerRow { get; set; }
public int CurDrawerCol { get; set; }
public int CurRowInDrawer { get; set; }
public int CurColInDrawer { get; set; }
public int PreDrawerRow { get; set; }
public int PreDrawerCol { get; set; }
public int PreRowInDrawer { get; set; }
public int PreColInDrawer { get; set; }
public int EndDrawerRow { get; set; } public int EndDrawerRow { get; set; }
public int EndDrawerCol { get; set; } public int EndDrawerCol { get; set; }
public int EndRowInDrawer { get; set; } public int EndRowInDrawer { get; set; }
public int EndColInDrawer { get; set; } public int EndColInDrawer { get; set; }
public void SetDrawerParam(int startrow,int startcol,int endrow,int endcol)
{
CurDrawerRow = startrow;
PreDrawerRow = startrow;
CurDrawerCol = startcol;
PreDrawerCol = startcol;
EndDrawerRow = endrow;
EndDrawerCol = endcol;
}
public void SetGridParam(int startrow, int startcol, int endrow, int endcol)
{
CurRowInDrawer = startrow;
PreRowInDrawer = startrow;
CurColInDrawer = startcol;
PreColInDrawer = startcol;
EndRowInDrawer = endrow;
EndColInDrawer = endcol;
}
/// <summary>
/// 是否是最后一个抽屉
/// </summary>
/// <returns></returns>
public bool IsLastDrawer()
{
if (CurDrawerRow >= EndDrawerRow && CurDrawerCol == EndDrawerCol)
return true;
return false;
}
/// <summary>
/// 是否是抽屉内的最后一个料格
/// </summary>
/// <returns></returns>
public bool IsLastGrid()
{
if (CurColInDrawer == EndColInDrawer && CurRowInDrawer >= EndRowInDrawer)
return true;
return false;
}
/// <summary>
/// 下一个料格
/// </summary>
public void NextGrid()
{
if ((CurColInDrawer == PreColInDrawer && CurRowInDrawer == PreRowInDrawer) || //第一个料格结束
(CurRowInDrawer == PreRowInDrawer && CurColInDrawer > PreColInDrawer))//同一层下一个,正向走
{
if (CurRowInDrawer < EndRowInDrawer)//轴未到目标层
{
if (CurColInDrawer < config.Cols_In_Drawer)
{
PreColInDrawer = CurColInDrawer;
CurColInDrawer++;
}
else
{
PreRowInDrawer = CurRowInDrawer;
PreColInDrawer = CurColInDrawer;
CurRowInDrawer++;
}
}
else//轴在目标层
{
if (CurColInDrawer < EndColInDrawer)
{
PreColInDrawer = CurColInDrawer;
CurColInDrawer++;
}
}
}
else if (CurColInDrawer == PreColInDrawer && CurRowInDrawer > PreRowInDrawer)//不同层,同一列
{
PreRowInDrawer = CurRowInDrawer;
if (CurColInDrawer == config.Drawer_Columns)
{
PreColInDrawer = CurColInDrawer;
CurColInDrawer--;
}
else if (CurColInDrawer == 1)
{
PreColInDrawer = CurColInDrawer;
CurColInDrawer++;
}
}
else if (CurRowInDrawer == PreRowInDrawer && CurColInDrawer < PreColInDrawer)//同一层,上一个。反向走
{
if (CurRowInDrawer < EndRowInDrawer)//轴未到目标层
{
if (CurColInDrawer > 1)
{
PreColInDrawer = CurColInDrawer;
CurColInDrawer--;
}
else
{
PreRowInDrawer = CurRowInDrawer;
PreColInDrawer = CurColInDrawer;
CurRowInDrawer++;
}
}
else//轴在目标层
{
if (CurColInDrawer > EndColInDrawer)
{
PreColInDrawer = CurColInDrawer;
CurColInDrawer--;
}
}
}
Common.LogUtil.info($"上一料格:{PreRowInDrawer},{PreColInDrawer}。当前料格:{CurRowInDrawer},{CurColInDrawer}");
}
/// <summary>
/// 下一个抽屉
/// </summary>
public void NextDrawer()
{
if ((CurDrawerCol == PreDrawerCol && CurDrawerRow == PreDrawerRow) || //第一个抽屉结束
(CurDrawerRow == PreDrawerRow && CurDrawerCol > PreDrawerCol))//同一层下一个,正向走
{
if (CurDrawerRow < EndDrawerRow)//轴未到目标层
{
if (CurDrawerCol < config.Drawer_Columns)
{
PreDrawerCol = CurDrawerCol;
CurDrawerCol++;
}
else
{
PreDrawerRow = CurDrawerRow;
CurDrawerRow++;
}
}
else//轴在目标层
{
if (CurDrawerCol < EndDrawerCol)
{
PreDrawerCol = CurDrawerCol;
CurDrawerCol++;
}
}
}
else if (CurDrawerCol == PreDrawerCol && CurDrawerRow > PreDrawerRow)//不同层,同一列
{
PreDrawerRow = CurDrawerRow;
if (CurDrawerCol == config.Drawer_Columns)
{
PreDrawerCol = CurDrawerCol;
CurDrawerCol--;
}
else if (CurDrawerCol == 1)
{
PreDrawerCol = CurDrawerCol;
CurDrawerCol++;
}
}
else if (CurDrawerRow == PreDrawerRow && CurDrawerCol < PreDrawerCol)//同一层,上一个。反向走
{
if (CurDrawerRow < EndDrawerRow)//轴未到目标层
{
if (CurDrawerCol >1)
{
PreDrawerCol = CurDrawerCol;
CurDrawerCol--;
}
else
{
PreDrawerRow = CurDrawerRow;
CurDrawerRow++;
}
}
else//轴在目标层
{
if (CurDrawerCol > EndDrawerCol)
{
PreDrawerCol = CurDrawerCol;
CurDrawerCol--;
}
}
}
Common.LogUtil.info($"上一抽屉:{PreDrawerRow},{PreDrawerCol}。当前抽屉:{CurDrawerRow},{CurDrawerCol}");
}
} }
} }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 抽屉调试结果
/// </summary>
public class DrawerResult
{
public string DrawerName { get; set; }
public int ResultCode { get; set; } = -1;
public List<PosDebugResult> PosResultList { get; set; }
public DrawerResult()
{
PosResultList = new List<PosDebugResult>();
}
}
}
...@@ -8,41 +8,105 @@ namespace OnlineStore.DeviceLibrary ...@@ -8,41 +8,105 @@ namespace OnlineStore.DeviceLibrary
{ {
public class PosDebugResultManager public class PosDebugResultManager
{ {
public static List<PosDebugResult> posResultList; public static List<DrawerResult> DrawerResults;
public static bool isInit = false; public static bool isInit = false;
static string filePath = Common.ConfigAppSettings.GetValue(Common.Setting_Init.ConfigPath_PosDebugInfo); static string filePath = Common.ConfigAppSettings.GetValue(Common.Setting_Init.ConfigPath_PosDebugInfo);
public static void Init(List<string> posNumList) public static void Init(List<string> posNumList)
{ {
if (!System.IO.File.Exists(filePath)) if (!System.IO.File.Exists(filePath))
{ {
posResultList = new List<PosDebugResult>(); DrawerResults = new List<DrawerResult>();
foreach (var item in posNumList) foreach (var item in posNumList)
{ {
posResultList.Add(new PosDebugResult() { Name = item }); DrawerResult res = DrawerResults.Find(s => s.DrawerName.Equals(item.Substring(0, 8)));
if (res == null)
{
res = new DrawerResult() { DrawerName = item.Substring(0, 8) };
res.PosResultList.Add(new PosDebugResult() { Name = item });
DrawerResults.Add(res);
}
else
{
res.PosResultList.Add(new PosDebugResult() { Name = item });
}
} }
} }
else else
{ {
string txt = System.IO.File.ReadAllText(filePath); string txt = System.IO.File.ReadAllText(filePath);
posResultList = Common.JsonHelper.DeserializeJsonToList<PosDebugResult>(txt); if (txt.Length == 0)
{
DrawerResults = new List<DrawerResult>();
foreach (var item in posNumList)
{
DrawerResult res = DrawerResults.Find(s => s.DrawerName.Equals(item.Substring(0, 8)));
if (res == null)
{
res = new DrawerResult() { DrawerName = item.Substring(0, 8) };
res.PosResultList.Add(new PosDebugResult() { Name = item });
}
else
{
res.PosResultList.Add(new PosDebugResult() { Name = item });
}
}
}
else
DrawerResults = Common.JsonHelper.DeserializeJsonToList<DrawerResult>(txt);
} }
isInit = true; isInit = true;
} }
/// <summary>
public static int GetResult(string name) /// 获取抽屉调试结果
/// </summary>
/// <param name="drawername"></param>
/// <returns></returns>
public static int GetDrawerResult(string drawername)
{ {
if (!isInit) if (!isInit)
return -1; return -1;
PosDebugResult debugResult = posResultList.Find(s => s.Name.Equals(name)); DrawerResult drawerResult = DrawerResults.Find(s => s.DrawerName.Equals(drawername));
return debugResult.ResCode; return drawerResult.ResultCode;
} }
public static void SetResult(string name,int code) public static void SetDrawerResult(string drawername, int code)
{ {
if (!isInit) if (!isInit)
return; return;
PosDebugResult debugResult = posResultList.Find(s => s.Name.Equals(name)); DrawerResult drawerResult = DrawerResults.Find(s => s.DrawerName.Equals(drawername));
debugResult.ResCode = code; drawerResult.ResultCode = code;
}
/// <summary>
/// 设置料格的状态
/// </summary>
/// <param name="drawername">抽屉名</param>
/// <param name="code">结果代码</param>
public static void SetGridResult(string name, int code)
{
DrawerResult drawerResult = DrawerResults.Find(s => s.DrawerName.Equals(name.Substring(0, 8)));
if (drawerResult != null)
{
PosDebugResult res = drawerResult.PosResultList.Find(s => s.Name.Equals(name));
if (res != null)
res.ResCode = code;
}
}
/// <summary>
/// 获取料格状态
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public static int GetGridResult(string name)
{
DrawerResult drawerResult = DrawerResults.Find(s => s.DrawerName.Equals(name.Substring(0, 8)));
if (drawerResult != null)
{
PosDebugResult res = drawerResult.PosResultList.Find(s => s.Name.Equals(name));
if (res != null)
return res.ResCode;
}
return -1;
} }
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!