Commit 252a2fee LN

1

1 个父辈 c7dad736
......@@ -18,6 +18,8 @@
this.components = new System.ComponentModel.Container();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnRShlefStop = new System.Windows.Forms.Button();
this.btnLShelfStop = new System.Windows.Forms.Button();
this.btnLShelfBack = new System.Windows.Forms.Button();
this.btnLShelfForward = new System.Windows.Forms.Button();
this.btnCloseRDoor = new System.Windows.Forms.Button();
......@@ -58,6 +60,8 @@
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.groupBox1.Controls.Add(this.btnRShlefStop);
this.groupBox1.Controls.Add(this.btnLShelfStop);
this.groupBox1.Controls.Add(this.btnLShelfBack);
this.groupBox1.Controls.Add(this.btnLShelfForward);
this.groupBox1.Controls.Add(this.btnCloseRDoor);
......@@ -69,18 +73,42 @@
this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(485, 170);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(388, 290);
this.groupBox1.Size = new System.Drawing.Size(388, 287);
this.groupBox1.TabIndex = 105;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "IO测试";
//
// btnRShlefStop
//
this.btnRShlefStop.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnRShlefStop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnRShlefStop.Location = new System.Drawing.Point(251, 196);
this.btnRShlefStop.Name = "btnRShlefStop";
this.btnRShlefStop.Size = new System.Drawing.Size(112, 40);
this.btnRShlefStop.TabIndex = 259;
this.btnRShlefStop.Text = "右侧货架-停止";
this.btnRShlefStop.UseVisualStyleBackColor = true;
this.btnRShlefStop.Click += new System.EventHandler(this.btnRShlefStop_Click);
//
// btnLShelfStop
//
this.btnLShelfStop.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnLShelfStop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnLShelfStop.Location = new System.Drawing.Point(251, 143);
this.btnLShelfStop.Name = "btnLShelfStop";
this.btnLShelfStop.Size = new System.Drawing.Size(112, 40);
this.btnLShelfStop.TabIndex = 258;
this.btnLShelfStop.Text = "左侧货架-停止";
this.btnLShelfStop.UseVisualStyleBackColor = true;
this.btnLShelfStop.Click += new System.EventHandler(this.btnLShelfStop_Click);
//
// btnLShelfBack
//
this.btnLShelfBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnLShelfBack.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnLShelfBack.Location = new System.Drawing.Point(41, 194);
this.btnLShelfBack.Location = new System.Drawing.Point(134, 143);
this.btnLShelfBack.Name = "btnLShelfBack";
this.btnLShelfBack.Size = new System.Drawing.Size(140, 40);
this.btnLShelfBack.Size = new System.Drawing.Size(112, 40);
this.btnLShelfBack.TabIndex = 257;
this.btnLShelfBack.Text = "左侧货架-后退";
this.btnLShelfBack.UseVisualStyleBackColor = true;
......@@ -90,9 +118,9 @@
//
this.btnLShelfForward.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnLShelfForward.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnLShelfForward.Location = new System.Drawing.Point(41, 148);
this.btnLShelfForward.Location = new System.Drawing.Point(16, 143);
this.btnLShelfForward.Name = "btnLShelfForward";
this.btnLShelfForward.Size = new System.Drawing.Size(140, 40);
this.btnLShelfForward.Size = new System.Drawing.Size(112, 40);
this.btnLShelfForward.TabIndex = 256;
this.btnLShelfForward.Text = "左侧托架-前进";
this.btnLShelfForward.UseVisualStyleBackColor = true;
......@@ -126,9 +154,9 @@
//
this.btnRShelfBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnRShelfBack.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnRShelfBack.Location = new System.Drawing.Point(206, 194);
this.btnRShelfBack.Location = new System.Drawing.Point(134, 196);
this.btnRShelfBack.Name = "btnRShelfBack";
this.btnRShelfBack.Size = new System.Drawing.Size(140, 40);
this.btnRShelfBack.Size = new System.Drawing.Size(112, 40);
this.btnRShelfBack.TabIndex = 253;
this.btnRShelfBack.Text = "右侧货架-后退";
this.btnRShelfBack.UseVisualStyleBackColor = true;
......@@ -138,9 +166,9 @@
//
this.btnRShelfForward.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnRShelfForward.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnRShelfForward.Location = new System.Drawing.Point(206, 148);
this.btnRShelfForward.Location = new System.Drawing.Point(16, 196);
this.btnRShelfForward.Name = "btnRShelfForward";
this.btnRShelfForward.Size = new System.Drawing.Size(140, 40);
this.btnRShelfForward.Size = new System.Drawing.Size(112, 40);
this.btnRShelfForward.TabIndex = 252;
this.btnRShelfForward.Text = "右侧货架-前进";
this.btnRShelfForward.UseVisualStyleBackColor = true;
......@@ -447,6 +475,8 @@
private System.Windows.Forms.Button btnLShelfForward;
private System.Windows.Forms.Button btnCloseRDoor;
private System.Windows.Forms.Button btnOpenRDoor;
private System.Windows.Forms.Button btnRShlefStop;
private System.Windows.Forms.Button btnLShelfStop;
}
}
......@@ -72,7 +72,7 @@ namespace OnlineStore.ACSingleStore
cmbWriteIO.DataSource = new List<ConfigIO>(boxBean.Config.StoreDOList.Values);
cmbWriteIO.ValueMember = "ProName";
cmbWriteIO.DisplayMember = "DisplayStr";
cmbWriteIO.SelectedIndex = 0;
cmbWriteIO.SelectedIndex = 0;
}
private void timer1_Tick(object sender, EventArgs e)
......@@ -99,7 +99,7 @@ namespace OnlineStore.ACSingleStore
LogUtil.error(LOGGER, ex.StackTrace);
}
}
private ConfigIO GetSelectDO()
{
......@@ -132,7 +132,7 @@ namespace OnlineStore.ACSingleStore
private void FrmStoreIOStatus_Load(object sender, EventArgs e)
{
//KNDAIManager.NeedShow = true;
}
}
private void btnReadIO_Click(object sender, EventArgs e)
{
ReadIOList();
......@@ -149,7 +149,8 @@ namespace OnlineStore.ACSingleStore
control.IOValue = iov;
control.ShowData();
}
} foreach (string key in this.DOControlList.Keys)
}
foreach (string key in this.DOControlList.Keys)
{
IOTextControl control = DOControlList[key];
int iov = (int)IOManager.DOValue(key);
......@@ -159,12 +160,12 @@ namespace OnlineStore.ACSingleStore
control.ShowData();
}
}
}
private void FrmIOStatus_Shown(object sender, EventArgs e)
{
{
timer1.Start();
}
......@@ -253,15 +254,25 @@ namespace OnlineStore.ACSingleStore
}
private void btnLShelfBack_Click(object sender, EventArgs e)
{
StoreManager.Store.ShelfBack(1 );
StoreManager.Store.ShelfBack(1);
}
private void btnOpenB_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Axis_Brake, IO_VALUE.HIGH);
}
private void btnCloseB_Click(object sender, EventArgs e)
{
{
IOManager.IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW);
}
private void btnLShelfStop_Click(object sender, EventArgs e)
{
StoreManager.Store.LeftShlefMove.Stop();
}
private void btnRShlefStop_Click(object sender, EventArgs e)
{
StoreManager.Store.RightShelfMove.Stop();
}
}
}
......@@ -59,6 +59,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="acSquareStore\ShelfMoveBean.cs" />
<Compile Include="acSquareStore\Square_BoxBean.cs" />
<Compile Include="acSquareStore\Square_BoxBean_Partial.cs" />
<Compile Include="acSquareStore\StoreManager.cs" />
......
......@@ -7,18 +7,17 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary.acSquareStore
namespace OnlineStore.DeviceLibrary
{
public class ShelfDoorBean
public class ShelfMoveBean
{
public bool IsRun = false;
private string LastMoveDO = "";
private string LastCheckDI = "";
private int ShelfType = 1;
internal DateTime LastEndTime = DateTime.Now;
public ShelfDoorBean( )
{
public ShelfMoveBean(int shelfType = 1)
{
this.ShelfType = shelfType;
}
public void Stop()
{
......@@ -27,35 +26,30 @@ namespace OnlineStore.DeviceLibrary.acSquareStore
IsRun = false;
}
}
private bool Start(string moveDO, string checkDI, int timeOutMS = 30000)
private bool Start(string moveDO, string closeDO, string checkDI, int timeOutMS = 30000)
{
if (IsRun)
{
LogUtil.error("启动[" + moveDO + "] [" + checkDI + "] 失败");
LogUtil.error("启动[" + moveDO + "][" + closeDO + "] [" + checkDI + "] 失败");
return false;
}
IsRun = true;
Task.Factory.StartNew(delegate
{
WriteAndWait(moveDO, checkDI, timeOutMS);
WriteAndWait(moveDO, closeDO, checkDI, timeOutMS);
});
return true;
}
private string WriteAndWait(string moveDO, string checkDI, int timeOutMS = 30000)
private string WriteAndWait(string moveDO, string closeDO, string checkDI, int timeOutMS = 30000)
{
LastMoveDO = moveDO;
LastCheckDI = checkDI;
LogUtil.debug("写入信号:" + moveDO + ",等待信号:" + checkDI + "");
//if (moveDO.Equals(IO_Type.EntranceDoor_Open))
//{
// IOManager.IOMove(IO_Type.EntranceDoor_Close, IO_VALUE.LOW );
//}
//else
//{
// IOManager.IOMove(IO_Type.EntranceDoor_Open, IO_VALUE.LOW );
//}
IOManager.IOMove(moveDO, IO_VALUE.HIGH );
//LastMoveDO = moveDO;
//LastCheckDI = checkDI;
LogUtil.debug("写入:" + moveDO + ",关闭:" + closeDO + ",等待信号:" + checkDI + "");
IOManager.IOMove(closeDO, IO_VALUE.LOW);
IOManager.IOMove(moveDO, IO_VALUE.HIGH);
Thread.Sleep(50);
IsRun = true;
......@@ -100,51 +94,54 @@ namespace OnlineStore.DeviceLibrary.acSquareStore
}
}
public bool StartOpen(StoreMoveInfo moveInfo)
public bool StartForward(StoreMoveInfo moveInfo)
{
//bool UseDoor = ConfigAppSettings.GetIntValue(Setting_Init.UseDoor).Equals(1);
//if (!UseDoor)
//{
// return false;
//}
string forwardIO = IO_Type.LeftShelf_Forward;
string backIO = IO_Type.LeftShelf_Back;
if (this.ShelfType.Equals(2))
{
forwardIO = IO_Type.RightShelf_Forward;
backIO = IO_Type.RightShelf_Back;
}
//如果门已打开直接返回
if (IOManager.IOValue(forwardIO).Equals(IO_VALUE.HIGH) &&
IOManager.IOValue(backIO).Equals(IO_VALUE.LOW))
{
return true;
}
////如果门已打开直接返回
//if (IOManager.IOValue(IO_Type.EntranceDoor_Open ).Equals(IO_VALUE.HIGH) &&
// IOManager.IOValue(IO_Type.EntranceDoor_Close ).Equals(IO_VALUE.LOW))
//{
// return true;
//}
if (moveInfo != null)
{
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(forwardIO, IO_VALUE.HIGH));
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(backIO, IO_VALUE.LOW));
}
return Start(forwardIO, backIO, forwardIO);
//if (moveInfo != null)
//{
// moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LeftDoor_Close, IO_VALUE.HIGH));
// moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.EntranceDoor_Close, IO_VALUE.LOW));
//}
//return Start(IO_Type.EntranceDoor_Open, IO_Type.EntranceDoor_Open);
return false;
}
public bool StartClose(StoreMoveInfo moveInfo)
public bool StartBack(StoreMoveInfo moveInfo)
{
//bool UseDoor = ConfigAppSettings.GetIntValue(Setting_Init.UseDoor).Equals(1);
//if (!UseDoor)
//{
// return false;
//}
////如果门已关闭直接返回
//if (IOManager.IOValue(IO_Type.EntranceDoor_Close ).Equals(IO_VALUE.HIGH) &&
// IOManager.IOValue(IO_Type.EntranceDoor_Open ).Equals(IO_VALUE.LOW))
//{
// return true;
//}
//if (moveInfo != null)
//{
// moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.EntranceDoor_Close, IO_VALUE.HIGH));
// moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.EntranceDoor_Open, IO_VALUE.LOW));
//}
//return Start(IO_Type.EntranceDoor_Close, IO_Type.EntranceDoor_Close);
return false;
}
string forwardIO = IO_Type.LeftShelf_Forward;
string backIO = IO_Type.LeftShelf_Back;
if (this.ShelfType.Equals(2))
{
forwardIO = IO_Type.RightShelf_Forward;
backIO = IO_Type.RightShelf_Back;
}
//如果门已打开直接返回
if (IOManager.IOValue(backIO).Equals(IO_VALUE.HIGH) &&
IOManager.IOValue(forwardIO).Equals(IO_VALUE.LOW))
{
return true;
}
if (moveInfo != null)
{
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(backIO, IO_VALUE.HIGH));
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(forwardIO, IO_VALUE.LOW));
}
return Start(backIO, forwardIO, backIO);
}
}
}
......@@ -37,6 +37,8 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
private Dictionary<string, AxisAlarmInfo> AxisAlarmCodeMap = new Dictionary<string, AxisAlarmInfo>();
public ShelfMoveBean LeftShlefMove = null;
public ShelfMoveBean RightShelfMove = null;
private System.Timers.Timer serverConnectTimer = new System.Timers.Timer();
private System.Timers.Timer IoCheckTimer = new System.Timers.Timer();
......@@ -78,7 +80,8 @@ namespace OnlineStore.DeviceLibrary
IOManager.Init();
IOManager.instance.ConnectionIOList(Config.DIODeviceNameList);
LeftShlefMove = new ShelfMoveBean(1);
RightShelfMove = new ShelfMoveBean(2);
mainTimer.Enabled = false;
int isAuto = ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun);
if (isAuto == 1)
......@@ -268,8 +271,8 @@ namespace OnlineStore.DeviceLibrary
}
private void InoutStartReset()
{
string portName = Config.InOut_Axis.DeviceName;
int slvAddr = Config.InOut_Axis.GetAxisValue();
LeftShlefMove.Stop();
RightShelfMove.Stop();
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutBack);
LogUtil.info(LOGGER, StoreName + "复位中,进出轴开始原点返回");
......@@ -358,11 +361,11 @@ namespace OnlineStore.DeviceLibrary
break;
case StoreMoveStep.BOX_M_H_TOP1_CompressHome:
StoreMove.NextMoveStep(StoreMoveStep.BOX_M_H_TOP1_OtherAxisToP1);
LogUtil.info(LOGGER, StoreName + "到待机状态:前后轴运动到P1,升降轴走到P1,压紧轴到P1,左右托架后退");
LogUtil.info(LOGGER, StoreName + "到待机状态:前后轴运动到P1,升降轴走到P1,压紧轴到P1,左右托架前进");
ACAxisMove(Config.Middle_Axis, Config.MiddleAxis_P1_Position, Config.MiddleAxis_P1_Speed);
ACAxisMove(Config.UpDown_Axis, Config.UpDownAxis_DoorO_P1, Config.UpDownAxis_P1_Speed);
CylinderMove(StoreMove, IO_Type.LeftShelf_Forward, IO_Type.LeftShelf_Back);
CylinderMove(StoreMove, IO_Type.RightShelf_Forward, IO_Type.RightShelf_Back);
ShelfForward(1);
ShelfForward(2);
break;
case StoreMoveStep.BOX_M_H_TOP1_OtherAxisToP1:
LogUtil.info(LOGGER, StoreName + "到待机状态完成");
......@@ -378,29 +381,29 @@ namespace OnlineStore.DeviceLibrary
default: break;
}
}
public void ShelfBack(int shelfType=1,StoreMoveInfo moveInfo=null)
public void ShelfBack(int shelfType = 1, StoreMoveInfo moveInfo = null)
{
if (shelfType.Equals(1))
{
CylinderMove(moveInfo, IO_Type.LeftShelf_Forward, IO_Type.LeftShelf_Back);
LeftShlefMove.StartBack(moveInfo);
}
else
{
CylinderMove(moveInfo, IO_Type.RightShelf_Forward, IO_Type.RightShelf_Back);
{
RightShelfMove.StartBack(moveInfo);
}
}
public void ShelfForward(int shelfType = 1, StoreMoveInfo moveInfo = null)
{
if (shelfType.Equals(1))
{
CylinderMove(moveInfo, IO_Type.LeftShelf_Back, IO_Type.LeftShelf_Forward);
LeftShlefMove.StartForward(moveInfo);
}
else
{
CylinderMove(moveInfo, IO_Type.RightShelf_Back, IO_Type.RightShelf_Forward);
{
RightShelfMove.StartForward(moveInfo);
}
}
public string DoorIsClose( )
public string DoorIsClose( )
{
if (!IOManager.IOValue(IO_Type.LeftDoor_Close).Equals(IO_VALUE.HIGH))
{
......@@ -1073,6 +1076,8 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public override void StopMove(bool IsCloseAxis)
{
LeftShlefMove.Stop();
RightShelfMove.Stop();
IOManager.IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW);
//运动版停止
......@@ -1085,9 +1090,7 @@ namespace OnlineStore.DeviceLibrary
{
CloseAllAxis();
}
LogUtil.info(LOGGER, StoreName + "StopMove");
//IOManager.IOMove(IO_Type.Door_Down, IO_VALUE.LOW);
//IOManager.IOMove(IO_Type.Door_Up, IO_VALUE.LOW);
LogUtil.info(LOGGER, StoreName + "StopMove");
isInPro = false;
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!