Commit 738813b5 张东亮

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

1 个父辈 9b6571e1
......@@ -20,6 +20,7 @@ namespace OnlineStore.DeviceLibrary
//public static bool DisSecurityAccess = ConfigAppSettings.GetIntValue(Setting_Init.DisSecurityAccess).Equals(1);
public static bool DisSecurityAccess = false;
public static bool DisBoxSecurityAccess = false;
public static bool DisGetWare = false;
public static bool UseBuzzer = ConfigAppSettings.GetIntValue(Setting_Init.UseBuzzer).Equals(1);
......
......@@ -794,6 +794,7 @@ namespace OnlineStore.DeviceLibrary
{
return;
}
SecurityAccessProcess();
if (runStatus.Equals(RunStatus.Runing))
{
ExecuteOutListProcess();
......@@ -948,7 +949,112 @@ namespace OnlineStore.DeviceLibrary
#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
boxStatus.status = (int)deviceStatus;
if (lastPosId != "")
{
LogUtil.info("给服务器发送出入库完成消息:" + Name + ",status【" + deviceStatus + "】posId【" + lastPosId + "】");
LogUtil.info("给服务器发送出入库消息:" + Name + ",status【" + deviceStatus + "】posId【" + lastPosId + "】");
}
lastPosId = "";
}
......
......@@ -323,12 +323,12 @@ namespace OnlineStore.DeviceLibrary
case StepEnum.SI_17_PushTray:
MoveInfo.NextMoveStep(StepEnum.SI_18_PutTrayMiddle);
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();
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();
//if (CheckASide())
......
......@@ -123,12 +123,12 @@ namespace OnlineStore.DeviceLibrary
case StepEnum.SO_11_PushTray:
MoveInfo.NextMoveStep(StepEnum.SO_12_PutTrayMiddle);
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()}面]");
//Bitmap bitmap = AcqImage(CamPosSide(MoveInfo.MoveParam.PosInfo.PosId));
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();
//if (CheckASide())
......
......@@ -1074,14 +1074,18 @@ namespace OnlineStore.DeviceLibrary
#endregion
private void SaveSpecifiedImage()
{
if (CheckASide())
{
SaveImage("box_A");
}
else
Task.Factory.StartNew(new Action(() =>
{
SaveImage("box_B");
}
if (CheckASide())
{
SaveImage("box_A");
}
else
{
SaveImage("box_B");
}
}));
}
}
}
......@@ -11,7 +11,7 @@ namespace OnlineStore.DeviceLibrary
public partial class BoxEquip
{
public bool isInitPosDebugInfo = false;
public PosDebugInfo posDebugInfo = null;
public PosDebugInfo posDebugInfo = null;
public void InitPosDebugInfo()
{
PosDebugResultManager.Init(PositionNumList);
......@@ -36,17 +36,37 @@ namespace OnlineStore.DeviceLibrary
PullAxis_Inout_To_P1();
}
//public void Test()
//{
// while(!posDebugInfo.IsLastDrawer())
// {
// while(!posDebugInfo.IsLastGrid())
// {
// posDebugInfo.NextGrid();
// }
// posDebugInfo.NextDrawer();
// }
//}
public void Test()
{
Random random = new Random();
Task.Factory.StartNew(new Action(delegate
{
while (!posDebugInfo.IsLastDrawer())
{
while (!posDebugInfo.IsLastGrid())
{
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>
......@@ -237,10 +257,10 @@ namespace OnlineStore.DeviceLibrary
break;
case StepEnum.SP_18_UpDownBack:
if(posDebugInfo.IsLastGrid())
if (posDebugInfo.IsLastGrid())
{
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()}面]");
}
else
......@@ -284,7 +304,7 @@ namespace OnlineStore.DeviceLibrary
break;
case StepEnum.SP_24_InoutBack:
if(posDebugInfo.IsLastDrawer())
if (posDebugInfo.IsLastDrawer())
{
MoveInfo.NextMoveStep(StepEnum.SP_26_ToBufferArea);
LogInfo($"库位调试 {MoveInfo.SLog}:{posDebugInfo.CurDrawer}是最后一个抽屉,将料盘送回暂存区。旋转轴到水平点P2,行走机构到待机点P1,抽屉升降轴到待机点P1、移栽升降轴到下暂存区高点P4/P10[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
......@@ -306,7 +326,7 @@ namespace OnlineStore.DeviceLibrary
case StepEnum.SP_25_ToNextDrawer:
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;
case StepEnum.SP_25_ToNextGrid:
MoveInfo.NextMoveStep(StepEnum.SP_12_DropDrawerToPos);
......@@ -364,7 +384,7 @@ namespace OnlineStore.DeviceLibrary
/// <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 PosSide { get; set; } = "AA";
......@@ -381,7 +401,7 @@ namespace OnlineStore.DeviceLibrary
public int EndDrawerCol { get; set; }
public int EndRowInDrawer { 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;
PreDrawerRow = startrow;
......@@ -440,6 +460,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public void NextGrid()
{
PosDebugResultManager.SaveResult();
if ((CurColInDrawer == PreColInDrawer && CurRowInDrawer == PreRowInDrawer) || //第一个料格结束
(CurRowInDrawer == PreRowInDrawer && CurColInDrawer > PreColInDrawer))//同一层下一个,正向走
{
......@@ -512,6 +533,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public void NextDrawer()
{
PosDebugResultManager.SaveResult();
if ((CurDrawerCol == PreDrawerCol && CurDrawerRow == PreDrawerRow) || //第一个抽屉结束
(CurDrawerRow == PreDrawerRow && CurDrawerCol > PreDrawerCol))//同一层下一个,正向走
{
......@@ -557,7 +579,7 @@ namespace OnlineStore.DeviceLibrary
{
if (CurDrawerRow < EndDrawerRow)//轴未到目标层
{
if (CurDrawerCol >1)
if (CurDrawerCol > 1)
{
PreDrawerCol = CurDrawerCol;
CurDrawerCol--;
......
......@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.DeviceLibrary
{
......@@ -10,7 +11,7 @@ namespace OnlineStore.DeviceLibrary
{
public static List<DrawerResult> DrawerResults;
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)
{
if (!System.IO.File.Exists(filePath))
......@@ -56,6 +57,18 @@ namespace OnlineStore.DeviceLibrary
}
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>
......
......@@ -84,6 +84,7 @@
this.aGVCancelStateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator17 = new System.Windows.Forms.ToolStripSeparator();
this.禁用安全光栅ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.启用门禁ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
......@@ -535,7 +536,8 @@
this.toolStripSeparator25,
this.aGVCancelStateToolStripMenuItem,
this.toolStripSeparator17,
this.禁用安全光栅ToolStripMenuItem});
this.禁用安全光栅ToolStripMenuItem,
this.启用门禁ToolStripMenuItem});
this.运行参数ToolStripMenuItem.Name = "运行参数ToolStripMenuItem";
this.运行参数ToolStripMenuItem.Size = new System.Drawing.Size(86, 25);
this.运行参数ToolStripMenuItem.Text = "运行参数";
......@@ -578,13 +580,20 @@
this.toolStripSeparator17.Size = new System.Drawing.Size(203, 6);
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.Text = "启用安全光栅";
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
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
......@@ -674,6 +683,7 @@
private EquipControl ShelfAControl;
private EquipControl ShelfBControl;
private System.Windows.Forms.ToolStripMenuItem 禁用安全光栅ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 启用门禁ToolStripMenuItem;
}
}
......@@ -61,6 +61,14 @@ namespace OnlineStore.XLRStore
{
禁用安全光栅ToolStripMenuItem.Text = "禁用安全光栅";
}
if(StoreManager.DisBoxSecurityAccess)
{
启用门禁ToolStripMenuItem.Text = gouStr + "禁用门禁";
}
else
{
启用门禁ToolStripMenuItem.Text= "禁用门禁";
}
//tabControl1.TabPages.Remove(tabPage5);
timer1.Start();
}
......@@ -740,5 +748,30 @@ namespace OnlineStore.XLRStore
}
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
BoxEquip boxEquip;
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;
int startDrawerRow = int.Parse(txtStartDrawerRow.Text);
......@@ -36,6 +36,7 @@ namespace OnlineStore.XLRStore
int endColInDrawer = int.Parse(txtEndColInDrawer.Text);
boxEquip.posDebugInfo.SetDrawerParam(startDrawerRow,startDrawerCol,endDrawerRow,endDrawerCol);
boxEquip.posDebugInfo.SetGridParam(startRowInDrawer,startColInDrawer,endRowInDrawer,endColInDrawer);
boxEquip.Test();
}
}
......
......@@ -29,6 +29,7 @@ namespace OnlineStore.XLRStore
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.tlpPos = new System.Windows.Forms.TableLayoutPanel();
......@@ -38,6 +39,7 @@ namespace OnlineStore.XLRStore
this.tlpDrawerA = new System.Windows.Forms.TableLayoutPanel();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tlpDrawerB = new System.Windows.Forms.TableLayoutPanel();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.tableLayoutPanel1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
......@@ -59,7 +61,7 @@ namespace OnlineStore.XLRStore
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.Absolute, 20F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1004, 721);
this.tableLayoutPanel1.Size = new System.Drawing.Size(1004, 689);
this.tableLayoutPanel1.TabIndex = 0;
//
// groupBox2
......@@ -68,7 +70,7 @@ namespace OnlineStore.XLRStore
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox2.Location = new System.Drawing.Point(584, 3);
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.TabStop = false;
this.groupBox2.Text = "库位结果";
......@@ -82,7 +84,7 @@ namespace OnlineStore.XLRStore
this.tlpPos.Name = "tlpPos";
this.tlpPos.RowCount = 1;
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;
//
// groupBox1
......@@ -91,7 +93,7 @@ namespace OnlineStore.XLRStore
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Location = new System.Drawing.Point(3, 3);
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.TabStop = false;
this.groupBox1.Text = "抽屉结果";
......@@ -104,7 +106,7 @@ namespace OnlineStore.XLRStore
this.tabControl1.Location = new System.Drawing.Point(3, 17);
this.tabControl1.Name = "tabControl1";
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;
//
// tabPage1
......@@ -113,7 +115,7 @@ namespace OnlineStore.XLRStore
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
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.Text = "A面";
this.tabPage1.UseVisualStyleBackColor = true;
......@@ -127,7 +129,7 @@ namespace OnlineStore.XLRStore
this.tlpDrawerA.Name = "tlpDrawerA";
this.tlpDrawerA.RowCount = 1;
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;
//
// tabPage2
......@@ -153,11 +155,16 @@ namespace OnlineStore.XLRStore
this.tlpDrawerB.Size = new System.Drawing.Size(555, 663);
this.tlpDrawerB.TabIndex = 1;
//
// timer1
//
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// FrmPosResult
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
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.MaximizeBox = false;
this.Name = "FrmPosResult";
......@@ -183,5 +190,6 @@ namespace OnlineStore.XLRStore
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TableLayoutPanel tlpDrawerB;
private System.Windows.Forms.Timer timer1;
}
}
\ No newline at end of file
......@@ -15,21 +15,28 @@ namespace OnlineStore.XLRStore
{
public FrmPosResult()
{
CheckForIllegalCrossThreadCalls = false;
boxEquip = StoreManager.XLRStore.boxEquip;
DrawerResults = PosDebugResultManager.DrawerResults;
InitializeComponent();
LoadDrawerList();
timer1.Enabled = true;
}
List<DrawerResult> DrawerResults;
BoxEquip boxEquip;
protected Dictionary<string, UCStatusPanel> PosControlList = new Dictionary<string, UCStatusPanel>();
protected Dictionary<string, UCStatusPanel> DrawerControlList = new Dictionary<string, UCStatusPanel>();
private void LoadDrawerList()
{
this.tlpDrawerA.RowStyles.Clear();
this.tlpDrawerA.ColumnStyles.Clear();
this.tlpDrawerA.CellBorderStyle = TableLayoutPanelCellBorderStyle.OutsetPartial;
this.tlpDrawerA.RowCount = boxEquip.Config.Drawer_Rows;
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;
selectedDrawer = $"{cid}AA{"01"}{"01"}";
for (int rowindex = 0; rowindex < boxEquip.Config.Drawer_Rows; rowindex++)
{
tlpDrawerA.RowStyles.Add(new RowStyle(SizeType.Absolute, 38));
......@@ -37,8 +44,9 @@ namespace OnlineStore.XLRStore
{
tlpDrawerA.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 87));
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.Dock = DockStyle.Fill;
this.tlpDrawerA.Controls.Add(control, colindex, rowindex);
DrawerControlList.Add(control.ControlName, control);
}
......@@ -46,8 +54,11 @@ namespace OnlineStore.XLRStore
this.tlpDrawerB.RowStyles.Clear();
this.tlpDrawerB.ColumnStyles.Clear();
this.tlpDrawerB.CellBorderStyle = TableLayoutPanelCellBorderStyle.OutsetPartial;
this.tlpDrawerB.RowCount = boxEquip.Config.Drawer_Rows;
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++)
{
tlpDrawerB.RowStyles.Add(new RowStyle(SizeType.Absolute, 38));
......@@ -55,8 +66,9 @@ namespace OnlineStore.XLRStore
{
tlpDrawerB.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 87));
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.Dock = DockStyle.Fill;
this.tlpDrawerB.Controls.Add(control, colindex, rowindex);
DrawerControlList.Add(control.ControlName, control);
}
......@@ -64,9 +76,12 @@ namespace OnlineStore.XLRStore
this.tlpPos.RowStyles.Clear();
this.tlpPos.ColumnStyles.Clear();
this.tlpPos.CellBorderStyle = TableLayoutPanelCellBorderStyle.OutsetPartial;
this.tlpPos.AutoScroll = true;
this.tlpPos.RowCount = boxEquip.Config.Cols_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++)
{
tlpPos.RowStyles.Add(new RowStyle(SizeType.Absolute, 38));
......@@ -74,8 +89,10 @@ namespace OnlineStore.XLRStore
{
tlpPos.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 87));
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);
PosControlList.Add(control.ControlName, control);
}
}
this.SuspendLayout();
......@@ -83,7 +100,44 @@ namespace OnlineStore.XLRStore
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 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</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>
\ No newline at end of file
......@@ -42,6 +42,7 @@ namespace OnlineStore.XLRStore
this.lblStatus.TabIndex = 0;
this.lblStatus.Text = "05BB0101";
this.lblStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.lblStatus.Click += new System.EventHandler(this.lblStatus_Click);
//
// UCStatusPanel
//
......
......@@ -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!