Commit 738813b5 张东亮

存储机构-库位调试功能-待调试

1 个父辈 9b6571e1
...@@ -20,6 +20,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -20,6 +20,7 @@ namespace OnlineStore.DeviceLibrary
//public static bool DisSecurityAccess = ConfigAppSettings.GetIntValue(Setting_Init.DisSecurityAccess).Equals(1); //public static bool DisSecurityAccess = ConfigAppSettings.GetIntValue(Setting_Init.DisSecurityAccess).Equals(1);
public static bool DisSecurityAccess = false; public static bool DisSecurityAccess = false;
public static bool DisBoxSecurityAccess = false;
public static bool DisGetWare = false; public static bool DisGetWare = false;
public static bool UseBuzzer = ConfigAppSettings.GetIntValue(Setting_Init.UseBuzzer).Equals(1); public static bool UseBuzzer = ConfigAppSettings.GetIntValue(Setting_Init.UseBuzzer).Equals(1);
......
...@@ -67,45 +67,63 @@ namespace OnlineStore.DeviceLibrary ...@@ -67,45 +67,63 @@ namespace OnlineStore.DeviceLibrary
/// <returns>匹配分值 -1:匹配失败 >=0:匹配成功</returns> /// <returns>匹配分值 -1:匹配失败 >=0:匹配成功</returns>
unsafe float match(string filename, out string pn, out Bitmap bitmap) unsafe float match(string filename, out string pn, out Bitmap bitmap)
{ {
Directory.CreateDirectory(input_path);
Directory.CreateDirectory(output_path);
Directory.CreateDirectory(temp_path);
bitmap = null; bitmap = null;
pn = ""; pn = "";
Bitmap a = new Bitmap(filename); try
Bitmap b = new Bitmap(224, 224, PixelFormat.Format32bppArgb); {
Directory.CreateDirectory(input_path);
Graphics g = Graphics.FromImage(b); Directory.CreateDirectory(output_path);
Directory.CreateDirectory(temp_path);
g.DrawImage(a, new Rectangle(0, 0, 224, 224), rectangle, GraphicsUnit.Pixel); Bitmap a = new Bitmap(filename);
g.Save(); Bitmap b = new Bitmap(224, 224, PixelFormat.Format32bppArgb);
EyemImage eyemImage1 = new EyemImage(); Graphics g = Graphics.FromImage(b);
eyemImage1.iWidth = 224;
eyemImage1.iHeight = 224; g.DrawImage(a, new Rectangle(0, 0, 224, 224), rectangle, GraphicsUnit.Pixel);
eyemImage1.iChannels = 4; g.Save();
eyemImage1.iDepth = 0;
BitmapData bitmapData = b.LockBits(new Rectangle(0, 0, 224, 224), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); EyemImage eyemImage1 = new EyemImage();
eyemImage1.ucpImage = bitmapData.Scan0; eyemImage1.iWidth = 224;
char* p = (char*)Marshal.AllocHGlobal(100); eyemImage1.iHeight = 224;
match_feature(output_path, eyemImage1, (char*)p, false, out float score); eyemImage1.iChannels = 4;
b.UnlockBits(bitmapData); eyemImage1.iDepth = 0;
pn = Marshal.PtrToStringAnsi((IntPtr)p); BitmapData bitmapData = b.LockBits(new Rectangle(0, 0, 224, 224), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
Marshal.FreeHGlobal((IntPtr)p); eyemImage1.ucpImage = bitmapData.Scan0;
bitmap = b; char* p = (char*)Marshal.AllocHGlobal(100);
score = score * 100; match_feature(output_path, eyemImage1, (char*)p, false, out float score);
return score; b.UnlockBits(bitmapData);
pn = Marshal.PtrToStringAnsi((IntPtr)p);
Marshal.FreeHGlobal((IntPtr)p);
bitmap = b;
score = score * 100;
return score;
}
catch(Exception e)
{
Common.LogUtil.error("match",e);
}
return 0;
} }
public bool MatchAndSaveImg(Bitmap bitmap,string imgname) public bool MatchAndSaveImg(Bitmap bitmap,string imgname)
{ {
var score = match(bitmap, out string pn, out Bitmap bitmap1); if (bitmap == null)
var pnpath = Path.Combine($"{temp_path}/{DateTime.Now.ToString("yyyyMMdd")}/", score > Config.TongsDetectThreshold ? "OK" : "NG"); return false;
Directory.CreateDirectory(pnpath); try
var simpletemp = Path.Combine(pnpath, $"{imgname}-{score.ToString("##.##")}-{pn}.png"); {
bitmap.Save(simpletemp, ImageFormat.Png); var score = match(bitmap, out string pn, out Bitmap bitmap1);
bitmap.Dispose(); var pnpath = Path.Combine($"{temp_path}/{DateTime.Now.ToString("yyyyMMdd")}/", score > Config.TongsDetectThreshold ? "OK" : "NG");
return score > Config.TongsDetectThreshold; Directory.CreateDirectory(pnpath);
var simpletemp = Path.Combine(pnpath, $"{imgname}-{score.ToString("##.##")}-{pn}.png");
bitmap.Save(simpletemp, ImageFormat.Png);
bitmap.Dispose();
return score > Config.TongsDetectThreshold;
}
catch(Exception e)
{
Common.LogUtil.error("MatchAndSaveImg", e);
}
return false;
} }
/// <summary> /// <summary>
/// 匹配抓手外观类型 /// 匹配抓手外观类型
...@@ -120,28 +138,38 @@ namespace OnlineStore.DeviceLibrary ...@@ -120,28 +138,38 @@ namespace OnlineStore.DeviceLibrary
Directory.CreateDirectory(temp_path); Directory.CreateDirectory(temp_path);
bitmap = null; bitmap = null;
pn = ""; pn = "";
Bitmap b = new Bitmap(224, 224, PixelFormat.Format32bppArgb); if (inputImg == null)
return 0;
Graphics g = Graphics.FromImage(b); try
{
g.DrawImage(inputImg, new Rectangle(0, 0, 224, 224), rectangle, GraphicsUnit.Pixel); Bitmap b = new Bitmap(224, 224, PixelFormat.Format32bppArgb);
g.Save();
Graphics g = Graphics.FromImage(b);
EyemImage eyemImage1 = new EyemImage();
eyemImage1.iWidth = 224; g.DrawImage(inputImg, new Rectangle(0, 0, 224, 224), rectangle, GraphicsUnit.Pixel);
eyemImage1.iHeight = 224; g.Save();
eyemImage1.iChannels = 4;
eyemImage1.iDepth = 0; EyemImage eyemImage1 = new EyemImage();
BitmapData bitmapData = b.LockBits(new Rectangle(0, 0, 224, 224), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); eyemImage1.iWidth = 224;
eyemImage1.ucpImage = bitmapData.Scan0; eyemImage1.iHeight = 224;
char* p = (char*)Marshal.AllocHGlobal(100); eyemImage1.iChannels = 4;
match_feature(output_path, eyemImage1, (char*)p, false, out float score); eyemImage1.iDepth = 0;
b.UnlockBits(bitmapData); BitmapData bitmapData = b.LockBits(new Rectangle(0, 0, 224, 224), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
pn = Marshal.PtrToStringAnsi((IntPtr)p); eyemImage1.ucpImage = bitmapData.Scan0;
Marshal.FreeHGlobal((IntPtr)p); char* p = (char*)Marshal.AllocHGlobal(100);
bitmap = b; match_feature(output_path, eyemImage1, (char*)p, false, out float score);
score = score * 100; b.UnlockBits(bitmapData);
return score; pn = Marshal.PtrToStringAnsi((IntPtr)p);
Marshal.FreeHGlobal((IntPtr)p);
bitmap = b;
score = score * 100;
return score;
}
catch(Exception e)
{
Common.LogUtil.error("match", e);
}
return 0;
} }
/// <summary> /// <summary>
/// 学习抓手外观 /// 学习抓手外观
...@@ -150,29 +178,36 @@ namespace OnlineStore.DeviceLibrary ...@@ -150,29 +178,36 @@ namespace OnlineStore.DeviceLibrary
/// <param name="pn">标识符</param> /// <param name="pn">标识符</param>
public unsafe void learn(string filename, string pn) public unsafe void learn(string filename, string pn)
{ {
Directory.CreateDirectory(input_path); try
Directory.CreateDirectory(output_path); {
Directory.CreateDirectory(temp_path); Directory.CreateDirectory(input_path);
Bitmap a = new Bitmap(filename); Directory.CreateDirectory(output_path);
Bitmap b = new Bitmap(224, 224, PixelFormat.Format32bppRgb); Directory.CreateDirectory(temp_path);
Bitmap a = new Bitmap(filename);
Graphics g = Graphics.FromImage(b); Bitmap b = new Bitmap(224, 224, PixelFormat.Format32bppRgb);
g.DrawImage(a, new Rectangle(0, 0, 224, 224), rectangle, GraphicsUnit.Pixel); Graphics g = Graphics.FromImage(b);
g.Save();
g.DrawImage(a, new Rectangle(0, 0, 224, 224), rectangle, GraphicsUnit.Pixel);
EyemImage eyemImage1 = new EyemImage(); g.Save();
eyemImage1.iWidth = 224;
eyemImage1.iHeight = 224; EyemImage eyemImage1 = new EyemImage();
eyemImage1.iChannels = 3; eyemImage1.iWidth = 224;
eyemImage1.iDepth = 0; eyemImage1.iHeight = 224;
BitmapData bitmapData = b.LockBits(new Rectangle(0, 0, 224, 224), ImageLockMode.ReadWrite, PixelFormat.Format32bppRgb); eyemImage1.iChannels = 3;
eyemImage1.ucpImage = bitmapData.Scan0; eyemImage1.iDepth = 0;
BitmapData bitmapData = b.LockBits(new Rectangle(0, 0, 224, 224), ImageLockMode.ReadWrite, PixelFormat.Format32bppRgb);
char* p = (char*)Marshal.StringToHGlobalAnsi(pn).ToPointer(); eyemImage1.ucpImage = bitmapData.Scan0;
match_feature(output_path, eyemImage1, (char*)p, true, out _);
b.UnlockBits(bitmapData); char* p = (char*)Marshal.StringToHGlobalAnsi(pn).ToPointer();
b.Dispose(); match_feature(output_path, eyemImage1, (char*)p, true, out _);
b.UnlockBits(bitmapData);
b.Dispose();
}
catch(Exception e)
{
Common.LogUtil.error("learn",e);
}
} }
/// <summary> /// <summary>
/// 学习抓手外观 /// 学习抓手外观
...@@ -181,28 +216,37 @@ namespace OnlineStore.DeviceLibrary ...@@ -181,28 +216,37 @@ namespace OnlineStore.DeviceLibrary
/// <param name="pn">标识符</param> /// <param name="pn">标识符</param>
public unsafe void learn(Bitmap inputimg, string pn) public unsafe void learn(Bitmap inputimg, string pn)
{ {
Directory.CreateDirectory(input_path); if (inputimg == null)
Directory.CreateDirectory(output_path); return;
Directory.CreateDirectory(temp_path); try
Bitmap b = new Bitmap(224, 224, PixelFormat.Format32bppRgb); {
Directory.CreateDirectory(input_path);
Graphics g = Graphics.FromImage(b); Directory.CreateDirectory(output_path);
Directory.CreateDirectory(temp_path);
g.DrawImage(inputimg, new Rectangle(0, 0, 224, 224), rectangle, GraphicsUnit.Pixel); Bitmap b = new Bitmap(224, 224, PixelFormat.Format32bppRgb);
g.Save();
Graphics g = Graphics.FromImage(b);
EyemImage eyemImage1 = new EyemImage();
eyemImage1.iWidth = 224; g.DrawImage(inputimg, new Rectangle(0, 0, 224, 224), rectangle, GraphicsUnit.Pixel);
eyemImage1.iHeight = 224; g.Save();
eyemImage1.iChannels = 3;
eyemImage1.iDepth = 0; EyemImage eyemImage1 = new EyemImage();
BitmapData bitmapData = b.LockBits(new Rectangle(0, 0, 224, 224), ImageLockMode.ReadWrite, PixelFormat.Format32bppRgb); eyemImage1.iWidth = 224;
eyemImage1.ucpImage = bitmapData.Scan0; eyemImage1.iHeight = 224;
eyemImage1.iChannels = 3;
char* p = (char*)Marshal.StringToHGlobalAnsi(pn).ToPointer(); eyemImage1.iDepth = 0;
match_feature(output_path, eyemImage1, (char*)p, true, out _); BitmapData bitmapData = b.LockBits(new Rectangle(0, 0, 224, 224), ImageLockMode.ReadWrite, PixelFormat.Format32bppRgb);
b.UnlockBits(bitmapData); eyemImage1.ucpImage = bitmapData.Scan0;
b.Dispose();
char* p = (char*)Marshal.StringToHGlobalAnsi(pn).ToPointer();
match_feature(output_path, eyemImage1, (char*)p, true, out _);
b.UnlockBits(bitmapData);
b.Dispose();
}
catch(Exception e)
{
Common.LogUtil.error("learn",e);
}
} }
} }
} }
...@@ -794,6 +794,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -794,6 +794,7 @@ namespace OnlineStore.DeviceLibrary
{ {
return; return;
} }
SecurityAccessProcess();
if (runStatus.Equals(RunStatus.Runing)) if (runStatus.Equals(RunStatus.Runing))
{ {
ExecuteOutListProcess(); ExecuteOutListProcess();
...@@ -948,7 +949,112 @@ namespace OnlineStore.DeviceLibrary ...@@ -948,7 +949,112 @@ namespace OnlineStore.DeviceLibrary
#endregion #endregion
#region 门禁
//门禁状态:0正常。1=安全门禁打开,已停止运动
private int CurrSecurityAccess = 0;
protected void SecurityAccessProcess()
{
try
{
if (!baseConfig.DIList.ContainsKey(IO_Type.LeftDoor_Limit))
{
return;
}
if (!baseConfig.DIList.ContainsKey(IO_Type.RightDoor_Limit))
{
return;
}
if (!baseConfig.DIList.ContainsKey(IO_Type.BackDoor_Limit))
{
return;
}
if (CurrSecurityAccess.Equals(0))
{
if (StoreManager.DisBoxSecurityAccess)
{
}
else if (IOValue(IO_Type.LeftDoor_Limit).Equals(IO_VALUE.LOW))
{
SecurityAccessStop("左前门门禁");
}
else if (IOValue(IO_Type.RightDoor_Limit).Equals(IO_VALUE.LOW))
{
SecurityAccessStop("右前门门禁");
}
else if (IOValue(IO_Type.BackDoor_Limit).Equals(IO_VALUE.LOW))
{
SecurityAccessStop("后门门禁");
}
}
else if (CurrSecurityAccess.Equals(1))
{
if (IOValue(IO_Type.LeftDoor_Limit).Equals(IO_VALUE.HIGH) &&
IOValue(IO_Type.RightDoor_Limit).Equals(IO_VALUE.HIGH) &&
IOValue(IO_Type.BackDoor_Limit).Equals(IO_VALUE.HIGH))
{
SecurityAccessReset();
}
}
}
catch (Exception ex)
{
LogUtil.error(Name + " 出错 :" + ex.ToString());
}
}
private void SecurityAccessStop(string doorname)
{
if (!baseConfig.DIList.ContainsKey(IO_Type.LeftDoor_Limit))
{
return;
}
if (!baseConfig.DIList.ContainsKey(IO_Type.RightDoor_Limit))
{
return;
}
if (!baseConfig.DIList.ContainsKey(IO_Type.BackDoor_Limit))
{
return;
}
CurrSecurityAccess = 1;
if (alarmType > (AlarmType.IoSingleTimeOut))
{
return;
}
LogUtil.info($"{Name} {doorname}被打开,停止当前运动{MoveInfo.MoveType},MoveStop={MoveStop},报警急停");
SetWarnMsg($"{doorname}被打开,报警急停");
Alarm(AlarmType.SuddenStop);
}
private void SecurityAccessReset()
{
if (!baseConfig.DIList.ContainsKey(IO_Type.LeftDoor_Limit))
{
return;
}
if (!baseConfig.DIList.ContainsKey(IO_Type.RightDoor_Limit))
{
return;
}
if (!baseConfig.DIList.ContainsKey(IO_Type.BackDoor_Limit))
{
return;
}
CurrSecurityAccess = 0;
MoveStop = false;
if (alarmType > (AlarmType.IoSingleTimeOut))
{
return;
}
//光栅恢复处理
}
#endregion
} }
......
...@@ -112,7 +112,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -112,7 +112,7 @@ namespace OnlineStore.DeviceLibrary
boxStatus.status = (int)deviceStatus; boxStatus.status = (int)deviceStatus;
if (lastPosId != "") if (lastPosId != "")
{ {
LogUtil.info("给服务器发送出入库完成消息:" + Name + ",status【" + deviceStatus + "】posId【" + lastPosId + "】"); LogUtil.info("给服务器发送出入库消息:" + Name + ",status【" + deviceStatus + "】posId【" + lastPosId + "】");
} }
lastPosId = ""; lastPosId = "";
} }
......
...@@ -323,12 +323,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -323,12 +323,12 @@ namespace OnlineStore.DeviceLibrary
case StepEnum.SI_17_PushTray: case StepEnum.SI_17_PushTray:
MoveInfo.NextMoveStep(StepEnum.SI_18_PutTrayMiddle); MoveInfo.NextMoveStep(StepEnum.SI_18_PutTrayMiddle);
LogInfo($"入库 {MoveInfo.SLog}:推到抽屉提取点,料斗拉取进出轴到料屉提取点P2/P4[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); LogInfo($"入库 {MoveInfo.SLog}:推到抽屉提取点,料斗拉取进出轴到料屉提取点P2/P4[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
SaveSpecifiedImage();
Bitmap bitmap = AcqImage(CamPosSide(MoveInfo.MoveParam.PosInfo.PosId));
bool rtn = MatchAndSaveImg(bitmap, $"{CamPosSide(MoveInfo.MoveParam.PosInfo.PosId)}_{DateTime.Now.ToString("HHmmss")}");
string res = rtn ? "OK" : "NG";
LogInfo($"入库 {MoveInfo.SLog}:抓手检测结果:{res}[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
PullAxis_Inout_To_P2_P4(); PullAxis_Inout_To_P2_P4();
SaveSpecifiedImage();
//Bitmap bitmap = AcqImage(CamPosSide(MoveInfo.MoveParam.PosInfo.PosId));
//bool rtn = MatchAndSaveImg(bitmap, $"{DateTime.Now.ToString("HHmmss")}");
//string res = rtn ? "OK" : "NG";
//LogInfo($"入库 {MoveInfo.SLog}:抓手检测结果:{res}");
//PullAxis_UpdownToMiddleP2(); //PullAxis_UpdownToMiddleP2();
//if (CheckASide()) //if (CheckASide())
......
...@@ -123,12 +123,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -123,12 +123,12 @@ namespace OnlineStore.DeviceLibrary
case StepEnum.SO_11_PushTray: case StepEnum.SO_11_PushTray:
MoveInfo.NextMoveStep(StepEnum.SO_12_PutTrayMiddle); MoveInfo.NextMoveStep(StepEnum.SO_12_PutTrayMiddle);
LogInfo($"出库 {MoveInfo.SLog}:推到抽屉提取点,料斗拉取进出轴到料屉提取点P2/P4[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); LogInfo($"出库 {MoveInfo.SLog}:推到抽屉提取点,料斗拉取进出轴到料屉提取点P2/P4[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
SaveSpecifiedImage(); //Bitmap bitmap = AcqImage(CamPosSide(MoveInfo.MoveParam.PosInfo.PosId));
Bitmap bitmap = AcqImage(CamPosSide(MoveInfo.MoveParam.PosInfo.PosId));
bool rtn = MatchAndSaveImg(bitmap, $"{CamPosSide(MoveInfo.MoveParam.PosInfo.PosId)}_{DateTime.Now.ToString("HHmmss")}");
string res = rtn ? "OK" : "NG";
LogInfo($"出库 {MoveInfo.SLog}:抓手检测结果:{res}[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
PullAxis_Inout_To_P2_P4(); PullAxis_Inout_To_P2_P4();
SaveSpecifiedImage();
//bool rtn = MatchAndSaveImg(bitmap, $"{DateTime.Now.ToString("HHmmss")}");
//string res = rtn ? "OK" : "NG";
//LogInfo($"出库 {MoveInfo.SLog}:抓手检测结果:{res}");
//PullAxis_UpdownToMiddleP2(); //PullAxis_UpdownToMiddleP2();
//if (CheckASide()) //if (CheckASide())
......
...@@ -1074,14 +1074,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -1074,14 +1074,18 @@ namespace OnlineStore.DeviceLibrary
#endregion #endregion
private void SaveSpecifiedImage() private void SaveSpecifiedImage()
{ {
if (CheckASide()) Task.Factory.StartNew(new Action(() =>
{
SaveImage("box_A");
}
else
{ {
SaveImage("box_B"); if (CheckASide())
} {
SaveImage("box_A");
}
else
{
SaveImage("box_B");
}
}));
} }
} }
} }
...@@ -11,7 +11,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -11,7 +11,7 @@ namespace OnlineStore.DeviceLibrary
public partial class BoxEquip public partial class BoxEquip
{ {
public bool isInitPosDebugInfo = false; public bool isInitPosDebugInfo = false;
public PosDebugInfo posDebugInfo = null; public PosDebugInfo posDebugInfo = null;
public void InitPosDebugInfo() public void InitPosDebugInfo()
{ {
PosDebugResultManager.Init(PositionNumList); PosDebugResultManager.Init(PositionNumList);
...@@ -36,17 +36,37 @@ namespace OnlineStore.DeviceLibrary ...@@ -36,17 +36,37 @@ namespace OnlineStore.DeviceLibrary
PullAxis_Inout_To_P1(); PullAxis_Inout_To_P1();
} }
//public void Test() public void Test()
//{ {
// while(!posDebugInfo.IsLastDrawer()) Random random = new Random();
// { Task.Factory.StartNew(new Action(delegate
// while(!posDebugInfo.IsLastGrid()) {
// { while (!posDebugInfo.IsLastDrawer())
// posDebugInfo.NextGrid(); {
// } while (!posDebugInfo.IsLastGrid())
// posDebugInfo.NextDrawer(); {
// } PosDebugResultManager.SetGridResult(posDebugInfo.CurGrid, 1);
//} posDebugInfo.NextGrid();
System.Threading.Thread.Sleep(500);
}
PosDebugResultManager.SetGridResult(posDebugInfo.CurGrid, 1);
PosDebugResultManager.SetDrawerResult(posDebugInfo.CurDrawer, 1);
PosDebugResultManager.SetDrawerResultWithGrid(posDebugInfo.CurDrawer);
posDebugInfo.NextDrawer();
System.Threading.Thread.Sleep(500);
}
while (!posDebugInfo.IsLastGrid())
{
PosDebugResultManager.SetGridResult(posDebugInfo.CurGrid, 1);//random.Next(0, 2)
posDebugInfo.NextGrid();
System.Threading.Thread.Sleep(500);
}
PosDebugResultManager.SetGridResult(posDebugInfo.CurGrid, 1);
PosDebugResultManager.SetDrawerResultWithGrid(posDebugInfo.CurDrawer);
posDebugInfo.NextDrawer();
}));
PosDebugResultManager.SaveResult();
}
/// <summary> /// <summary>
/// 更新移动信息 /// 更新移动信息
/// </summary> /// </summary>
...@@ -237,10 +257,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -237,10 +257,10 @@ namespace OnlineStore.DeviceLibrary
break; break;
case StepEnum.SP_18_UpDownBack: case StepEnum.SP_18_UpDownBack:
if(posDebugInfo.IsLastGrid()) if (posDebugInfo.IsLastGrid())
{ {
MoveInfo.NextMoveStep(StepEnum.SP_19_CheckDrawerFinish); MoveInfo.NextMoveStep(StepEnum.SP_19_CheckDrawerFinish);
int drawerRescode= PosDebugResultManager.SetDrawerResultWithGrid(posDebugInfo.CurDrawer); int drawerRescode = PosDebugResultManager.SetDrawerResultWithGrid(posDebugInfo.CurDrawer);
LogInfo($"库位调试 {MoveInfo.SLog}:{posDebugInfo.CurDrawer}{posDebugInfo.CurGrid}是抽屉的最后一个库位,统计抽屉结果:{drawerRescode}[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); LogInfo($"库位调试 {MoveInfo.SLog}:{posDebugInfo.CurDrawer}{posDebugInfo.CurGrid}是抽屉的最后一个库位,统计抽屉结果:{drawerRescode}[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
} }
else else
...@@ -284,7 +304,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -284,7 +304,7 @@ namespace OnlineStore.DeviceLibrary
break; break;
case StepEnum.SP_24_InoutBack: case StepEnum.SP_24_InoutBack:
if(posDebugInfo.IsLastDrawer()) if (posDebugInfo.IsLastDrawer())
{ {
MoveInfo.NextMoveStep(StepEnum.SP_26_ToBufferArea); MoveInfo.NextMoveStep(StepEnum.SP_26_ToBufferArea);
LogInfo($"库位调试 {MoveInfo.SLog}:{posDebugInfo.CurDrawer}是最后一个抽屉,将料盘送回暂存区。旋转轴到水平点P2,行走机构到待机点P1,抽屉升降轴到待机点P1、移栽升降轴到下暂存区高点P4/P10[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); LogInfo($"库位调试 {MoveInfo.SLog}:{posDebugInfo.CurDrawer}是最后一个抽屉,将料盘送回暂存区。旋转轴到水平点P2,行走机构到待机点P1,抽屉升降轴到待机点P1、移栽升降轴到下暂存区高点P4/P10[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
...@@ -306,7 +326,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -306,7 +326,7 @@ namespace OnlineStore.DeviceLibrary
case StepEnum.SP_25_ToNextDrawer: case StepEnum.SP_25_ToNextDrawer:
MoveInfo.NextMoveStep(StepEnum.SP_07_MiddleToP3); MoveInfo.NextMoveStep(StepEnum.SP_07_MiddleToP3);
LogInfo($"库位调试 {MoveInfo.SLog}:抽屉{posDebugInfo.CurDrawer}调试开始[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); LogInfo($"库位调试 {MoveInfo.SLog}:抽屉{posDebugInfo.CurDrawer}调试开始[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
break; break;
case StepEnum.SP_25_ToNextGrid: case StepEnum.SP_25_ToNextGrid:
MoveInfo.NextMoveStep(StepEnum.SP_12_DropDrawerToPos); MoveInfo.NextMoveStep(StepEnum.SP_12_DropDrawerToPos);
...@@ -364,7 +384,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -364,7 +384,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 当前料格 /// 当前料格
/// </summary> /// </summary>
public string CurGrid { get { return $"{CurDrawer}{CurRowInDrawer}{CurColInDrawer}"; } } public string CurGrid { get { return $"{CurDrawer}{CurRowInDrawer.ToString("00")}{CurColInDrawer.ToString("00")}"; } }
public string CID { get; private set; } public string CID { get; private set; }
public string PosSide { get; set; } = "AA"; public string PosSide { get; set; } = "AA";
...@@ -381,7 +401,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -381,7 +401,7 @@ namespace OnlineStore.DeviceLibrary
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) public void SetDrawerParam(int startrow, int startcol, int endrow, int endcol)
{ {
CurDrawerRow = startrow; CurDrawerRow = startrow;
PreDrawerRow = startrow; PreDrawerRow = startrow;
...@@ -440,6 +460,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -440,6 +460,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public void NextGrid() public void NextGrid()
{ {
PosDebugResultManager.SaveResult();
if ((CurColInDrawer == PreColInDrawer && CurRowInDrawer == PreRowInDrawer) || //第一个料格结束 if ((CurColInDrawer == PreColInDrawer && CurRowInDrawer == PreRowInDrawer) || //第一个料格结束
(CurRowInDrawer == PreRowInDrawer && CurColInDrawer > PreColInDrawer))//同一层下一个,正向走 (CurRowInDrawer == PreRowInDrawer && CurColInDrawer > PreColInDrawer))//同一层下一个,正向走
{ {
...@@ -512,6 +533,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -512,6 +533,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public void NextDrawer() public void NextDrawer()
{ {
PosDebugResultManager.SaveResult();
if ((CurDrawerCol == PreDrawerCol && CurDrawerRow == PreDrawerRow) || //第一个抽屉结束 if ((CurDrawerCol == PreDrawerCol && CurDrawerRow == PreDrawerRow) || //第一个抽屉结束
(CurDrawerRow == PreDrawerRow && CurDrawerCol > PreDrawerCol))//同一层下一个,正向走 (CurDrawerRow == PreDrawerRow && CurDrawerCol > PreDrawerCol))//同一层下一个,正向走
{ {
...@@ -557,7 +579,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -557,7 +579,7 @@ namespace OnlineStore.DeviceLibrary
{ {
if (CurDrawerRow < EndDrawerRow)//轴未到目标层 if (CurDrawerRow < EndDrawerRow)//轴未到目标层
{ {
if (CurDrawerCol >1) if (CurDrawerCol > 1)
{ {
PreDrawerCol = CurDrawerCol; PreDrawerCol = CurDrawerCol;
CurDrawerCol--; CurDrawerCol--;
......
...@@ -3,6 +3,7 @@ using System.Collections.Generic; ...@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.DeviceLibrary namespace OnlineStore.DeviceLibrary
{ {
...@@ -10,7 +11,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -10,7 +11,7 @@ namespace OnlineStore.DeviceLibrary
{ {
public static List<DrawerResult> DrawerResults; 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 = Application.StartupPath + 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))
...@@ -56,6 +57,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -56,6 +57,18 @@ namespace OnlineStore.DeviceLibrary
} }
isInit = true; isInit = true;
} }
public static void SaveResult()
{
try
{
string res = Common.JsonHelper.SerializeObject(DrawerResults);
System.IO.File.WriteAllText(filePath, res);
}
catch(Exception e)
{
Common.LogUtil.error("SaveResult", e);
}
}
/// <summary> /// <summary>
/// 获取抽屉调试结果 /// 获取抽屉调试结果
/// </summary> /// </summary>
......
...@@ -84,6 +84,7 @@ ...@@ -84,6 +84,7 @@
this.aGVCancelStateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aGVCancelStateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator17 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator17 = new System.Windows.Forms.ToolStripSeparator();
this.禁用安全光栅ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.禁用安全光栅ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.启用门禁ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout(); this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout(); this.tabPage2.SuspendLayout();
...@@ -535,7 +536,8 @@ ...@@ -535,7 +536,8 @@
this.toolStripSeparator25, this.toolStripSeparator25,
this.aGVCancelStateToolStripMenuItem, this.aGVCancelStateToolStripMenuItem,
this.toolStripSeparator17, this.toolStripSeparator17,
this.禁用安全光栅ToolStripMenuItem}); this.禁用安全光栅ToolStripMenuItem,
this.启用门禁ToolStripMenuItem});
this.运行参数ToolStripMenuItem.Name = "运行参数ToolStripMenuItem"; this.运行参数ToolStripMenuItem.Name = "运行参数ToolStripMenuItem";
this.运行参数ToolStripMenuItem.Size = new System.Drawing.Size(86, 25); this.运行参数ToolStripMenuItem.Size = new System.Drawing.Size(86, 25);
this.运行参数ToolStripMenuItem.Text = "运行参数"; this.运行参数ToolStripMenuItem.Text = "运行参数";
...@@ -578,13 +580,20 @@ ...@@ -578,13 +580,20 @@
this.toolStripSeparator17.Size = new System.Drawing.Size(203, 6); this.toolStripSeparator17.Size = new System.Drawing.Size(203, 6);
this.toolStripSeparator17.Visible = false; this.toolStripSeparator17.Visible = false;
// //
// 用安全光栅ToolStripMenuItem // 用安全光栅ToolStripMenuItem
// //
this.禁用安全光栅ToolStripMenuItem.Name = "用安全光栅ToolStripMenuItem"; this.禁用安全光栅ToolStripMenuItem.Name = "用安全光栅ToolStripMenuItem";
this.禁用安全光栅ToolStripMenuItem.Size = new System.Drawing.Size(206, 26); this.禁用安全光栅ToolStripMenuItem.Size = new System.Drawing.Size(206, 26);
this.禁用安全光栅ToolStripMenuItem.Text = "启用安全光栅"; this.禁用安全光栅ToolStripMenuItem.Text = "启用安全光栅";
this.禁用安全光栅ToolStripMenuItem.Click += new System.EventHandler(this.启用安全光栅ToolStripMenuItem_Click); this.禁用安全光栅ToolStripMenuItem.Click += new System.EventHandler(this.启用安全光栅ToolStripMenuItem_Click);
// //
// 启用门禁ToolStripMenuItem
//
this.启用门禁ToolStripMenuItem.Name = "启用门禁ToolStripMenuItem";
this.启用门禁ToolStripMenuItem.Size = new System.Drawing.Size(206, 26);
this.启用门禁ToolStripMenuItem.Text = "启用门禁";
this.启用门禁ToolStripMenuItem.Click += new System.EventHandler(this.启用门禁ToolStripMenuItem_Click);
//
// FrmXLRStore // FrmXLRStore
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
...@@ -674,6 +683,7 @@ ...@@ -674,6 +683,7 @@
private EquipControl ShelfAControl; private EquipControl ShelfAControl;
private EquipControl ShelfBControl; private EquipControl ShelfBControl;
private System.Windows.Forms.ToolStripMenuItem 禁用安全光栅ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 禁用安全光栅ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 启用门禁ToolStripMenuItem;
} }
} }
...@@ -61,6 +61,14 @@ namespace OnlineStore.XLRStore ...@@ -61,6 +61,14 @@ namespace OnlineStore.XLRStore
{ {
禁用安全光栅ToolStripMenuItem.Text = "禁用安全光栅"; 禁用安全光栅ToolStripMenuItem.Text = "禁用安全光栅";
} }
if(StoreManager.DisBoxSecurityAccess)
{
启用门禁ToolStripMenuItem.Text = gouStr + "禁用门禁";
}
else
{
启用门禁ToolStripMenuItem.Text= "禁用门禁";
}
//tabControl1.TabPages.Remove(tabPage5); //tabControl1.TabPages.Remove(tabPage5);
timer1.Start(); timer1.Start();
} }
...@@ -740,5 +748,30 @@ namespace OnlineStore.XLRStore ...@@ -740,5 +748,30 @@ namespace OnlineStore.XLRStore
} }
LogUtil.info(Name + " 点击:" + 禁用安全光栅ToolStripMenuItem.Text); LogUtil.info(Name + " 点击:" + 禁用安全光栅ToolStripMenuItem.Text);
} }
private void 启用门禁ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!LoadOk)
{
return;
}
bool result = !启用门禁ToolStripMenuItem.Text.Contains(gouStr);
if (result.Equals(StoreManager.DisBoxSecurityAccess))
{
return;
}
StoreManager.DisBoxSecurityAccess = result;
//ConfigAppSettings.SaveValue(Setting_Init.DisSecurityAccess, (StoreManager.DisSecurityAccess ? 1 : 0));
if (result)
{
启用门禁ToolStripMenuItem.Text = gouStr + " 禁用门禁";
}
else
{
启用门禁ToolStripMenuItem.Text = "禁用门禁";
}
LogUtil.info(Name + " 点击:" + 启用门禁ToolStripMenuItem.Text);
}
} }
} }
...@@ -22,7 +22,7 @@ namespace OnlineStore.XLRStore ...@@ -22,7 +22,7 @@ namespace OnlineStore.XLRStore
BoxEquip boxEquip; BoxEquip boxEquip;
private void btnStart_Click(object sender, EventArgs e) private void btnStart_Click(object sender, EventArgs e)
{ {
if(MessageBox.Show("是否开始库位调试?","提示",MessageBoxButtons.OKCancel).Equals(MessageBoxButtons.OK)) if(MessageBox.Show("是否开始库位调试?","提示",MessageBoxButtons.YesNo).Equals(DialogResult.Yes))
{ {
boxEquip.posDebugInfo.IsBreak = false; boxEquip.posDebugInfo.IsBreak = false;
int startDrawerRow = int.Parse(txtStartDrawerRow.Text); int startDrawerRow = int.Parse(txtStartDrawerRow.Text);
...@@ -36,6 +36,7 @@ namespace OnlineStore.XLRStore ...@@ -36,6 +36,7 @@ namespace OnlineStore.XLRStore
int endColInDrawer = int.Parse(txtEndColInDrawer.Text); int endColInDrawer = int.Parse(txtEndColInDrawer.Text);
boxEquip.posDebugInfo.SetDrawerParam(startDrawerRow,startDrawerCol,endDrawerRow,endDrawerCol); boxEquip.posDebugInfo.SetDrawerParam(startDrawerRow,startDrawerCol,endDrawerRow,endDrawerCol);
boxEquip.posDebugInfo.SetGridParam(startRowInDrawer,startColInDrawer,endRowInDrawer,endColInDrawer); boxEquip.posDebugInfo.SetGridParam(startRowInDrawer,startColInDrawer,endRowInDrawer,endColInDrawer);
boxEquip.Test();
} }
} }
......
...@@ -29,6 +29,7 @@ namespace OnlineStore.XLRStore ...@@ -29,6 +29,7 @@ namespace OnlineStore.XLRStore
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.tlpPos = new System.Windows.Forms.TableLayoutPanel(); this.tlpPos = new System.Windows.Forms.TableLayoutPanel();
...@@ -38,6 +39,7 @@ namespace OnlineStore.XLRStore ...@@ -38,6 +39,7 @@ namespace OnlineStore.XLRStore
this.tlpDrawerA = new System.Windows.Forms.TableLayoutPanel(); this.tlpDrawerA = new System.Windows.Forms.TableLayoutPanel();
this.tabPage2 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage();
this.tlpDrawerB = new System.Windows.Forms.TableLayoutPanel(); this.tlpDrawerB = new System.Windows.Forms.TableLayoutPanel();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
...@@ -59,7 +61,7 @@ namespace OnlineStore.XLRStore ...@@ -59,7 +61,7 @@ namespace OnlineStore.XLRStore
this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1004, 721); this.tableLayoutPanel1.Size = new System.Drawing.Size(1004, 689);
this.tableLayoutPanel1.TabIndex = 0; this.tableLayoutPanel1.TabIndex = 0;
// //
// groupBox2 // groupBox2
...@@ -68,7 +70,7 @@ namespace OnlineStore.XLRStore ...@@ -68,7 +70,7 @@ namespace OnlineStore.XLRStore
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox2.Location = new System.Drawing.Point(584, 3); this.groupBox2.Location = new System.Drawing.Point(584, 3);
this.groupBox2.Name = "groupBox2"; this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(417, 715); this.groupBox2.Size = new System.Drawing.Size(417, 683);
this.groupBox2.TabIndex = 1; this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "库位结果"; this.groupBox2.Text = "库位结果";
...@@ -82,7 +84,7 @@ namespace OnlineStore.XLRStore ...@@ -82,7 +84,7 @@ namespace OnlineStore.XLRStore
this.tlpPos.Name = "tlpPos"; this.tlpPos.Name = "tlpPos";
this.tlpPos.RowCount = 1; this.tlpPos.RowCount = 1;
this.tlpPos.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tlpPos.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tlpPos.Size = new System.Drawing.Size(411, 695); this.tlpPos.Size = new System.Drawing.Size(411, 663);
this.tlpPos.TabIndex = 1; this.tlpPos.TabIndex = 1;
// //
// groupBox1 // groupBox1
...@@ -91,7 +93,7 @@ namespace OnlineStore.XLRStore ...@@ -91,7 +93,7 @@ namespace OnlineStore.XLRStore
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Location = new System.Drawing.Point(3, 3); this.groupBox1.Location = new System.Drawing.Point(3, 3);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(575, 715); this.groupBox1.Size = new System.Drawing.Size(575, 683);
this.groupBox1.TabIndex = 0; this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "抽屉结果"; this.groupBox1.Text = "抽屉结果";
...@@ -104,7 +106,7 @@ namespace OnlineStore.XLRStore ...@@ -104,7 +106,7 @@ namespace OnlineStore.XLRStore
this.tabControl1.Location = new System.Drawing.Point(3, 17); this.tabControl1.Location = new System.Drawing.Point(3, 17);
this.tabControl1.Name = "tabControl1"; this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0; this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(569, 695); this.tabControl1.Size = new System.Drawing.Size(569, 663);
this.tabControl1.TabIndex = 1; this.tabControl1.TabIndex = 1;
// //
// tabPage1 // tabPage1
...@@ -113,7 +115,7 @@ namespace OnlineStore.XLRStore ...@@ -113,7 +115,7 @@ namespace OnlineStore.XLRStore
this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1"; this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3); this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(561, 669); this.tabPage1.Size = new System.Drawing.Size(561, 637);
this.tabPage1.TabIndex = 0; this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "A面"; this.tabPage1.Text = "A面";
this.tabPage1.UseVisualStyleBackColor = true; this.tabPage1.UseVisualStyleBackColor = true;
...@@ -127,7 +129,7 @@ namespace OnlineStore.XLRStore ...@@ -127,7 +129,7 @@ namespace OnlineStore.XLRStore
this.tlpDrawerA.Name = "tlpDrawerA"; this.tlpDrawerA.Name = "tlpDrawerA";
this.tlpDrawerA.RowCount = 1; this.tlpDrawerA.RowCount = 1;
this.tlpDrawerA.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tlpDrawerA.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tlpDrawerA.Size = new System.Drawing.Size(555, 663); this.tlpDrawerA.Size = new System.Drawing.Size(555, 631);
this.tlpDrawerA.TabIndex = 0; this.tlpDrawerA.TabIndex = 0;
// //
// tabPage2 // tabPage2
...@@ -153,11 +155,16 @@ namespace OnlineStore.XLRStore ...@@ -153,11 +155,16 @@ namespace OnlineStore.XLRStore
this.tlpDrawerB.Size = new System.Drawing.Size(555, 663); this.tlpDrawerB.Size = new System.Drawing.Size(555, 663);
this.tlpDrawerB.TabIndex = 1; this.tlpDrawerB.TabIndex = 1;
// //
// timer1
//
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// FrmPosResult // FrmPosResult
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1004, 721); this.ClientSize = new System.Drawing.Size(1004, 689);
this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.tableLayoutPanel1);
this.MaximizeBox = false; this.MaximizeBox = false;
this.Name = "FrmPosResult"; this.Name = "FrmPosResult";
...@@ -183,5 +190,6 @@ namespace OnlineStore.XLRStore ...@@ -183,5 +190,6 @@ namespace OnlineStore.XLRStore
private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2; private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TableLayoutPanel tlpDrawerB; private System.Windows.Forms.TableLayoutPanel tlpDrawerB;
private System.Windows.Forms.Timer timer1;
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -15,21 +15,28 @@ namespace OnlineStore.XLRStore ...@@ -15,21 +15,28 @@ namespace OnlineStore.XLRStore
{ {
public FrmPosResult() public FrmPosResult()
{ {
CheckForIllegalCrossThreadCalls = false;
boxEquip = StoreManager.XLRStore.boxEquip; boxEquip = StoreManager.XLRStore.boxEquip;
DrawerResults = PosDebugResultManager.DrawerResults; DrawerResults = PosDebugResultManager.DrawerResults;
InitializeComponent(); InitializeComponent();
LoadDrawerList(); LoadDrawerList();
timer1.Enabled = true;
} }
List<DrawerResult> DrawerResults; List<DrawerResult> DrawerResults;
BoxEquip boxEquip; BoxEquip boxEquip;
protected Dictionary<string, UCStatusPanel> PosControlList = new Dictionary<string, UCStatusPanel>();
protected Dictionary<string, UCStatusPanel> DrawerControlList = new Dictionary<string, UCStatusPanel>(); protected Dictionary<string, UCStatusPanel> DrawerControlList = new Dictionary<string, UCStatusPanel>();
private void LoadDrawerList() private void LoadDrawerList()
{ {
this.tlpDrawerA.RowStyles.Clear(); this.tlpDrawerA.RowStyles.Clear();
this.tlpDrawerA.ColumnStyles.Clear(); this.tlpDrawerA.ColumnStyles.Clear();
this.tlpDrawerA.CellBorderStyle = TableLayoutPanelCellBorderStyle.OutsetPartial;
this.tlpDrawerA.RowCount = boxEquip.Config.Drawer_Rows; this.tlpDrawerA.RowCount = boxEquip.Config.Drawer_Rows;
this.tlpDrawerA.ColumnCount = boxEquip.Config.Drawer_Columns; this.tlpDrawerA.ColumnCount = boxEquip.Config.Drawer_Columns;
this.tlpDrawerA.Height = 40 * this.tlpDrawerA.RowCount;
this.tlpDrawerA.Width = 90 * this.tlpDrawerA.ColumnCount;
string cid = boxEquip.Config.CID; string cid = boxEquip.Config.CID;
selectedDrawer = $"{cid}AA{"01"}{"01"}";
for (int rowindex = 0; rowindex < boxEquip.Config.Drawer_Rows; rowindex++) for (int rowindex = 0; rowindex < boxEquip.Config.Drawer_Rows; rowindex++)
{ {
tlpDrawerA.RowStyles.Add(new RowStyle(SizeType.Absolute, 38)); tlpDrawerA.RowStyles.Add(new RowStyle(SizeType.Absolute, 38));
...@@ -37,8 +44,9 @@ namespace OnlineStore.XLRStore ...@@ -37,8 +44,9 @@ namespace OnlineStore.XLRStore
{ {
tlpDrawerA.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 87)); tlpDrawerA.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 87));
UCStatusPanel control = new UCStatusPanel(); UCStatusPanel control = new UCStatusPanel();
control.ControlName = $"{cid}AA{(rowindex+1).ToString("00")}{(colindex+1).ToString("00")}"; control.ControlName = $"{cid}AA{(rowindex + 1).ToString("00")}{(colindex + 1).ToString("00")}";
control.Click += Control_Click; control.Click += Control_Click;
control.Dock = DockStyle.Fill;
this.tlpDrawerA.Controls.Add(control, colindex, rowindex); this.tlpDrawerA.Controls.Add(control, colindex, rowindex);
DrawerControlList.Add(control.ControlName, control); DrawerControlList.Add(control.ControlName, control);
} }
...@@ -46,8 +54,11 @@ namespace OnlineStore.XLRStore ...@@ -46,8 +54,11 @@ namespace OnlineStore.XLRStore
this.tlpDrawerB.RowStyles.Clear(); this.tlpDrawerB.RowStyles.Clear();
this.tlpDrawerB.ColumnStyles.Clear(); this.tlpDrawerB.ColumnStyles.Clear();
this.tlpDrawerB.CellBorderStyle = TableLayoutPanelCellBorderStyle.OutsetPartial;
this.tlpDrawerB.RowCount = boxEquip.Config.Drawer_Rows; this.tlpDrawerB.RowCount = boxEquip.Config.Drawer_Rows;
this.tlpDrawerB.ColumnCount = boxEquip.Config.Drawer_Columns; this.tlpDrawerB.ColumnCount = boxEquip.Config.Drawer_Columns;
this.tlpDrawerB.Height = 40 * this.tlpDrawerB.RowCount;
this.tlpDrawerB.Width = 90 * this.tlpDrawerB.ColumnCount;
for (int rowindex = 0; rowindex < boxEquip.Config.Drawer_Rows; rowindex++) for (int rowindex = 0; rowindex < boxEquip.Config.Drawer_Rows; rowindex++)
{ {
tlpDrawerB.RowStyles.Add(new RowStyle(SizeType.Absolute, 38)); tlpDrawerB.RowStyles.Add(new RowStyle(SizeType.Absolute, 38));
...@@ -55,8 +66,9 @@ namespace OnlineStore.XLRStore ...@@ -55,8 +66,9 @@ namespace OnlineStore.XLRStore
{ {
tlpDrawerB.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 87)); tlpDrawerB.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 87));
UCStatusPanel control = new UCStatusPanel(); UCStatusPanel control = new UCStatusPanel();
control.ControlName = $"{cid}BB{(rowindex+1).ToString("00")}{(colindex+1).ToString("00")}"; control.ControlName = $"{cid}BB{(rowindex + 1).ToString("00")}{(colindex + 1).ToString("00")}";
control.Click += Control_Click; control.Click += Control_Click;
control.Dock = DockStyle.Fill;
this.tlpDrawerB.Controls.Add(control, colindex, rowindex); this.tlpDrawerB.Controls.Add(control, colindex, rowindex);
DrawerControlList.Add(control.ControlName, control); DrawerControlList.Add(control.ControlName, control);
} }
...@@ -64,9 +76,12 @@ namespace OnlineStore.XLRStore ...@@ -64,9 +76,12 @@ namespace OnlineStore.XLRStore
this.tlpPos.RowStyles.Clear(); this.tlpPos.RowStyles.Clear();
this.tlpPos.ColumnStyles.Clear(); this.tlpPos.ColumnStyles.Clear();
this.tlpPos.CellBorderStyle = TableLayoutPanelCellBorderStyle.OutsetPartial;
this.tlpPos.AutoScroll = true; this.tlpPos.AutoScroll = true;
this.tlpPos.RowCount = boxEquip.Config.Cols_In_Drawer; this.tlpPos.RowCount = boxEquip.Config.Cols_In_Drawer;
this.tlpPos.ColumnCount = boxEquip.Config.Rows_In_Drawer; this.tlpPos.ColumnCount = boxEquip.Config.Rows_In_Drawer;
this.tlpPos.Height = 40 * this.tlpPos.RowCount;
this.tlpPos.Width = 90 * this.tlpPos.ColumnCount;
for (int rowindex = 0; rowindex < boxEquip.Config.Cols_In_Drawer; rowindex++) for (int rowindex = 0; rowindex < boxEquip.Config.Cols_In_Drawer; rowindex++)
{ {
tlpPos.RowStyles.Add(new RowStyle(SizeType.Absolute, 38)); tlpPos.RowStyles.Add(new RowStyle(SizeType.Absolute, 38));
...@@ -74,8 +89,10 @@ namespace OnlineStore.XLRStore ...@@ -74,8 +89,10 @@ namespace OnlineStore.XLRStore
{ {
tlpPos.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 87)); tlpPos.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 87));
UCStatusPanel control = new UCStatusPanel(); UCStatusPanel control = new UCStatusPanel();
control.ControlName = $"{(colindex+1).ToString("00")}{(rowindex+1).ToString("00")}"; control.ControlName = $"{(colindex + 1).ToString("00")}{(rowindex + 1).ToString("00")}";
control.Dock = DockStyle.Fill;
this.tlpPos.Controls.Add(control, colindex, rowindex); this.tlpPos.Controls.Add(control, colindex, rowindex);
PosControlList.Add(control.ControlName, control);
} }
} }
this.SuspendLayout(); this.SuspendLayout();
...@@ -83,7 +100,44 @@ namespace OnlineStore.XLRStore ...@@ -83,7 +100,44 @@ namespace OnlineStore.XLRStore
private void Control_Click(object sender, EventArgs e) private void Control_Click(object sender, EventArgs e)
{ {
throw new NotImplementedException(); UCStatusPanel statusPanel = sender as UCStatusPanel;
if (statusPanel != null)
{
selectedDrawer = statusPanel.ControlName;
UpdateInfosInDrawer(statusPanel.ControlName);
}
}
public string selectedDrawer = "";
private void UpdateInfosInDrawer(string drawername)
{
groupBox2.Text = $"{drawername}库位结果";
foreach (var item in PosControlList.Values)
{
StringBuilder sb = new StringBuilder();
sb.Append(drawername);
sb.Append(item.ControlName);
item.ResultCode = PosDebugResultManager.GetGridResult(sb.ToString());
item.ShowResult();
}
}
private void UpdateDrawerInfos()
{
foreach (var item in DrawerControlList.Values)
{
item.ResultCode = PosDebugResultManager.GetDrawerResult(item.ControlName);
item.ShowResult();
}
}
bool inUpdate = false;
private void timer1_Tick(object sender, EventArgs e)
{
if (inUpdate)
return;
inUpdate = true;
UpdateDrawerInfos();
if (!selectedDrawer.Equals(""))
UpdateInfosInDrawer(selectedDrawer);
inUpdate = false;
} }
} }
} }
...@@ -117,4 +117,7 @@ ...@@ -117,4 +117,7 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>
\ No newline at end of file \ No newline at end of file
...@@ -42,6 +42,7 @@ namespace OnlineStore.XLRStore ...@@ -42,6 +42,7 @@ namespace OnlineStore.XLRStore
this.lblStatus.TabIndex = 0; this.lblStatus.TabIndex = 0;
this.lblStatus.Text = "05BB0101"; this.lblStatus.Text = "05BB0101";
this.lblStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.lblStatus.Click += new System.EventHandler(this.lblStatus_Click);
// //
// UCStatusPanel // UCStatusPanel
// //
......
...@@ -35,5 +35,9 @@ namespace OnlineStore.XLRStore ...@@ -35,5 +35,9 @@ namespace OnlineStore.XLRStore
} }
} }
private void lblStatus_Click(object sender, EventArgs e)
{
this.OnClick(e);
}
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!