Commit a3002d6c 几米阳光

调试修改

1 个父辈 0eb61213
......@@ -54,14 +54,17 @@ namespace OnlineStore.ACSingleStore
private void btnMiddleMove_MouseDown(object sender, MouseEventArgs e)
{
int speed = FormUtil.GetIntValue(txtMiddleSpeed);
if (speed <= 0)
if (btnMiddleMove.BackColor.Equals(System.Drawing.SystemColors.Control))
{
MessageBox.Show("提示", "请先输入正确的速度");
return;
int speed = FormUtil.GetIntValue(txtMiddleSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
return;
}
btnMiddleMove.BackColor = Color.Green;
AxisMove(middle, speed);
}
btnMiddleMove.BackColor = Color.Green;
AxisMove(middle, speed);
}
private void btnMiddleMove_MouseUp(object sender, MouseEventArgs e)
......@@ -76,14 +79,17 @@ namespace OnlineStore.ACSingleStore
private void btnUpDownMove_MouseDown(object sender, MouseEventArgs e)
{
int speed = FormUtil.GetIntValue(txtUpDownSpeed);
if (speed <= 0)
if (btnUpDownMove.BackColor.Equals(System.Drawing.SystemColors.Control))
{
MessageBox.Show("提示", "请先输入正确的速度");
return;
int speed = FormUtil.GetIntValue(txtUpDownSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
return;
}
btnUpDownMove.BackColor = Color.Green;
AxisMove(updown, speed);
}
btnUpDownMove.BackColor = Color.Green;
AxisMove(updown, speed);
}
private void btnUpDownMove_MouseUp(object sender, MouseEventArgs e)
......@@ -98,19 +104,22 @@ namespace OnlineStore.ACSingleStore
private void btnInOutMove_MouseDown(object sender, MouseEventArgs e)
{
if ( ACStoreManager.store.InOutAxisCanMove().Equals(false))
{
MessageBox.Show("定位气缸不在下降端,不能移动进出轴", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
int speed = FormUtil.GetIntValue(txtInOutSpeed);
if (speed <= 0)
if (this.btnInOutMove.BackColor .Equals(System.Drawing.SystemColors.Control))
{
MessageBox.Show("提示", "请先输入正确的速度");
return;
if (ACStoreManager.store.InOutAxisCanMove().Equals(false))
{
MessageBox.Show("定位气缸不在下降端,不能移动进出轴", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
int speed = FormUtil.GetIntValue(txtInOutSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
return;
}
this.btnInOutMove.BackColor = Color.Green;
AxisMove(inout, speed);
}
this.btnInOutMove.BackColor = Color.Green;
AxisMove(inout, speed);
}
private void btnInOutMove_MouseUp(object sender, MouseEventArgs e)
......@@ -121,20 +130,20 @@ namespace OnlineStore.ACSingleStore
ACServerManager.SuddenStop(inout.DeviceName, inout.GetAxisValue());
UpdateInOutPosition();
}
}
}
private void btnMiddleMovej_MouseDown(object sender, MouseEventArgs e)
{
int speed = FormUtil.GetIntValue(txtMiddleSpeed);
if (speed <= 0)
if (btnMiddleMovej.BackColor.Equals(System.Drawing.SystemColors.Control))
{
MessageBox.Show("提示", "请先输入正确的速度");
return;
int speed = FormUtil.GetIntValue(txtMiddleSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
return;
}
this.btnMiddleMovej.BackColor = Color.Green;
AxisMove(middle, -speed);
}
this.btnMiddleMovej.BackColor = Color.Green;
AxisMove(middle, -speed);
}
private void btnMiddleMovej_MouseUp(object sender, MouseEventArgs e)
......@@ -149,14 +158,17 @@ namespace OnlineStore.ACSingleStore
private void btnUpDownMovej_MouseDown(object sender, MouseEventArgs e)
{
int speed = FormUtil.GetIntValue(txtUpDownSpeed);
if (speed <= 0)
if (btnUpDownMovej.BackColor .Equals( System.Drawing.SystemColors.Control))
{
MessageBox.Show("提示", "请先输入正确的速度");
return;
int speed = FormUtil.GetIntValue(txtUpDownSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
return;
}
btnUpDownMovej.BackColor = Color.Green;
AxisMove(updown, -speed);
}
btnUpDownMovej.BackColor = Color.Green;
AxisMove(updown, -speed);
}
private void btnUpDownMovej_MouseUp(object sender, MouseEventArgs e)
......@@ -171,19 +183,22 @@ namespace OnlineStore.ACSingleStore
private void btnInOutMovej_MouseDown(object sender, MouseEventArgs e)
{
if (ACStoreManager.store.InOutAxisCanMove().Equals(false))
if (btnInOutMovej.BackColor.Equals(System.Drawing.SystemColors.Control))
{
MessageBox.Show("定位气缸不在下降端,不能移动进出轴", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
int speed = FormUtil.GetIntValue(txtInOutSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
return;
if (ACStoreManager.store.InOutAxisCanMove().Equals(false))
{
MessageBox.Show("定位气缸不在下降端,不能移动进出轴", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
int speed = FormUtil.GetIntValue(txtInOutSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
return;
}
this.btnInOutMovej.BackColor = Color.Green;
AxisMove(inout, -speed);
}
this.btnInOutMovej.BackColor = Color.Green;
AxisMove(inout, -speed);
}
private void btnInOutMovej_MouseUp(object sender, MouseEventArgs e)
......
......@@ -1461,7 +1461,7 @@
this.btnUpDownP7.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnUpDownP7.Size = new System.Drawing.Size(140, 27);
this.btnUpDownP7.TabIndex = 203;
this.btnUpDownP7.Text = "升降轴料缓冲点P7:";
this.btnUpDownP7.Text = "升降轴料缓冲点P7:";
this.btnUpDownP7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnUpDownP7.UseVisualStyleBackColor = true;
this.btnUpDownP7.Click += new System.EventHandler(this.btnUpDownP7_Click);
......@@ -1497,7 +1497,7 @@
this.btnUpDownP1.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnUpDownP1.Size = new System.Drawing.Size(140, 27);
this.btnUpDownP1.TabIndex = 199;
this.btnUpDownP1.Text = "升降轴料点P1:";
this.btnUpDownP1.Text = "升降轴料点P1:";
this.btnUpDownP1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnUpDownP1.UseVisualStyleBackColor = true;
this.btnUpDownP1.Click += new System.EventHandler(this.btnUpDownP1_Click);
......
......@@ -153,6 +153,7 @@ namespace OnlineStore.ACSingleStore
this.ShowInTaskbar = true;
this.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title);
LoadOk = true;
cmbHomeType.SelectedIndex = 1;
HideForm();
}
private DateTime preReadModblsTime = DateTime.Now;
......
......@@ -142,8 +142,8 @@ namespace OnlineStore.DeviceLibrary
}
else
{
ConnectionIP(io);
LogUtil.error(LOGGER, "AI模块" + io + "当前没有连上,重连" + io);
ConnectionIP(io);
}
PreCheckTime = DateTime.Now;
}
......
......@@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading;
namespace OnlineStore.DeviceLibrary
{
......@@ -232,7 +232,10 @@ namespace OnlineStore.DeviceLibrary
/// <param name="homeType">0=反方向,1=正方向</param>
public static void HomeMove(int slvAddr, byte homeType)
{
byte[] sendData = WriteData(slvAddr, ShuoKeCMD.HomeMove, 0x01, homeType);
string fangx = homeType.Equals(0) ? "反方向" : "正方向";
LogUtil.info("压紧轴原点返回:" + fangx);
byte[] sendData = WriteData(slvAddr, ShuoKeCMD.HomeMove, 0x01, homeType);
Thread.Sleep(100);
}
public static void VolMove(int slvAddr, int speed)
{
......
......@@ -398,9 +398,10 @@ namespace OnlineStore.DeviceLibrary
case StoreMoveStep.BOX_H_OtherAxisBack:
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_MiddleAxisToP1);
LogUtil.info(LOGGER, StoreName + "复位中:旋转轴运动到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_DoorOPosition_P1, Config.UpDownAxis_P1_Speed);
ComMoveToPosition(Config.CompressAxis_P1_Position);
break;
case StoreMoveStep.BOX_H_MiddleAxisToP1:
LogUtil.info(LOGGER, StoreName + "复位完成");
......@@ -426,9 +427,10 @@ 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!");
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_DoorOPosition_P1, Config.UpDownAxis_P1_Speed);
ComMoveToPosition(Config.CompressAxis_P1_Position);
break;
case StoreMoveStep.BOX_M_H_TOP1_OtherAxisToP1:
LogUtil.info(LOGGER, StoreName + "到待机状态完成");
......@@ -444,6 +446,18 @@ namespace OnlineStore.DeviceLibrary
default: break;
}
}
private void ComMoveToPosition(int targetPosition)
{
if (IsHasCompress_Axis)
{
LogUtil.info("压紧轴绝对运动目标位置:"+targetPosition);
ShuoKeControls.AbsMove(Config.CompressAxis_Slv, targetPosition);
StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, targetPosition, false));
Thread.Sleep(100);
}
}
private void OpenDoorAndWait()
{
KNDIOMove(IO_Type.Door_Down, IO_VALUE.LOW);
......@@ -512,12 +526,12 @@ namespace OnlineStore.DeviceLibrary
ACAxisHomeMove(Config.UpDown_Axis);
break;
case StoreMoveStep.BOX_H_OtherAxisBack:
case StoreMoveStep.BOX_H_OtherAxisBack:
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_MiddleAxisToP1);
LogUtil.info(LOGGER, StoreName + "回原点:旋转轴运动到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_DoorOPosition_P1, Config.UpDownAxis_P1_Speed);
ComMoveToPosition(Config.CompressAxis_P1_Position);
break;
case StoreMoveStep.BOX_H_MiddleAxisToP1:
LogUtil.info(LOGGER, StoreName + "回原点完成");
......@@ -949,11 +963,11 @@ namespace OnlineStore.DeviceLibrary
if (isWaitScan)
{
TimeSpan span = DateTime.Now - StartWaitScanTime;
if (span.TotalSeconds > 0.5)
if (span.TotalSeconds > 1)
{
isWaitScan = false;
IsScanCode = true;
LogUtil.info(StoreName + "检测到料盘信号且等待0.5秒,开始扫码");
LogUtil.info(StoreName + "检测到料盘信号且等待1秒,开始扫码");
//BeginScannering();
GetCameraCode();
}
......@@ -1329,16 +1343,15 @@ namespace OnlineStore.DeviceLibrary
foreach (string str in codeList)
{
string code = HDevelopExport.SubStrCode(str);
code = "=7X" + height + " =" + code;
code = "=1+0x0-7x" + height + " =" + code;
message = message + code + spiltStr;
}
}
if (!outMsg.Equals(""))
{
LogUtil.error("盘尺寸错误,清理二维码【"+message+"】");
LogUtil.error("盘尺寸错误,清理二维码【" + message + "】");
message = "";
}
KNDIOMove(IO_Type.CameraLight_Power, IO_VALUE.LOW);
KNDIOMove(IO_Type.CameraLight_Power, IO_VALUE.LOW);
onCodeReceived(message);
}
......
......@@ -307,11 +307,12 @@ namespace OnlineStore.DeviceLibrary
{
InStoreLog("入库:SI_03 所有轴回到待机点,轴2、轴1 动作到P1,,轴4动作至P3");
StoreMove.NextMoveStep(StoreMoveStep.SI_03_ReturnHome);
if (IsHasCompress_Axis)
{
ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P3);
StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P3, false));
}
ComMoveToPosition(moveP.ComPress_P3);
//if (IsHasCompress_Axis)
//{
// ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P3);
// StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P3, false));
//}
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
}
......@@ -321,8 +322,9 @@ namespace OnlineStore.DeviceLibrary
{
InStoreLog("入库:SI_04_CompressWare 压紧物品(有压紧轴的才需要此步骤),压紧轴至P3(压紧前点) 开始");
StoreMove.NextMoveStep(StoreMoveStep.SI_04_CompressWare);
ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P3);
StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P3, false));
ComMoveToPosition(moveP.ComPress_P3);
//ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P3);
//StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P3, false));
}
else
{
......@@ -341,12 +343,13 @@ namespace OnlineStore.DeviceLibrary
{
InStoreLog("入库:SI_06 拿物品,压紧轴至P2(压紧点)) 升降轴至P7(进料口取料缓冲点) ");
StoreMove.NextMoveStep(StoreMoveStep.SI_06_DoorWarToDevice);
if (IsHasCompress_Axis)
{
ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P2);
StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P2, false));
System.Threading.Thread.Sleep(600);
}
ComMoveToPosition(moveP.ComPress_P2);
//if (IsHasCompress_Axis)
//{
// ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P2);
// StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P2, false));
// System.Threading.Thread.Sleep(600);
//}
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P7, Config.UpDownAxis_P7_Speed);
}
......@@ -413,11 +416,12 @@ namespace OnlineStore.DeviceLibrary
{
InStoreLog("入库:SI_12 放下物品,升降轴至P4(库位入料缓冲点),压紧轴至P3(压紧前点) ");
StoreMove.NextMoveStep(StoreMoveStep.SI_12_PutWareToBag);
if (IsHasCompress_Axis)
{
ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P3);
StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P3, false));
}
ComMoveToPosition(moveP.ComPress_P3);
//if (IsHasCompress_Axis)
//{
// ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P3);
// StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P3, false));
//}
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P4, Config.UpDownAxis_P4_Speed);
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_12_PutWareToBag)
......@@ -438,11 +442,12 @@ namespace OnlineStore.DeviceLibrary
{
InStoreLog("入库:SI_14 返回待机点,轴2/轴1/轴4动作至P1(待机点)),检测门关闭");
StoreMove.NextMoveStep(StoreMoveStep.SI_14_GoBack);
if (IsHasCompress_Axis)
{
ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P1);
StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P1, false));
}
ComMoveToPosition(moveP.ComPress_P1);
//if (IsHasCompress_Axis)
//{
// ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P1);
// StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P1, false));
//}
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
CloseDoorAndWait();
......@@ -536,11 +541,12 @@ namespace OnlineStore.DeviceLibrary
{
StoreMove.NextMoveStep(StoreMoveStep.SO_03_ToBagPosition);
OutStoreLog("出库:SO_03 走到库位,压紧轴至P3(压紧前点) ,旋转轴至P2(库位点),升降轴至P5(库位出库前点)");
if (IsHasCompress_Axis)
{
ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P3);
StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P3, false));
}
ComMoveToPosition(moveP.ComPress_P3);
//if (IsHasCompress_Axis)
//{
// ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P3);
// StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P3, false));
//}
ACAxisMove(Config.Middle_Axis, StoreMove.MoveParam.MoveP.Middle_P2, Config.MiddleAxis_P2_Speed);
ACAxisMove(Config.UpDown_Axis, StoreMove.MoveParam.MoveP.UpDown_P5, Config.UpDownAxis_P5_Speed);
}
......@@ -555,11 +561,12 @@ namespace OnlineStore.DeviceLibrary
OutStoreLog("出库:SO_05 拿起物品,升降轴至P6(库位出料缓冲点),压紧轴至P2(压紧点) ");
StoreMove.NextMoveStep(StoreMoveStep.SO_05_BagWareToDevice);
//电缸微动至对应料盘的上端位置
if (IsHasCompress_Axis)
{
ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P2);
StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P2, false));
}
//if (IsHasCompress_Axis)
//{
// ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P2);
// StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P2, false));
//}
ComMoveToPosition(moveP.ComPress_P2);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P6, Config.UpDownAxis_P6_Speed);
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_05_BagWareToDevice)
......@@ -632,11 +639,13 @@ namespace OnlineStore.DeviceLibrary
{
OutStoreLog("出库:SO_11 放下物品,升降轴至P8(进料口出料缓冲点) ");
StoreMove.NextMoveStep(StoreMoveStep.SO_11_DevicePutWare);
if (IsHasCompress_Axis)
{
ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P1);
StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P1, false));
}
ComMoveToPosition(moveP.ComPress_P1);
//if (IsHasCompress_Axis)
//{
// ShuoKeControls.AbsMove(Config.CompressAxis_Slv, moveP.ComPress_P1);
// StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, moveP.ComPress_P1, false));
//}
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P8, Config.UpDownAxis_P8_Speed);
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_11_DevicePutWare)
......
......@@ -73,24 +73,16 @@ namespace OnlineStore.DeviceLibrary
{
HObject ho_Image = HDevelopExport.GrabImage(cameraName);
List<string> codeList = HDevelopExport.GetCode(ho_Image);
if (codeList.Count > 0)
{
Bitmap bitmap = HObject2Bpp24(ho_Image);
//DateTime time = DateTime.Now;
//try
//{
// string name = time.Hour.ToString() + time.Minute.ToString() + time.Second.ToString() + time.Millisecond.ToString() + ".jpg";
// bitmap.Save(name);
//}
//catch(Exception ex)
//{
//}
if (Exist(bitmap))
{
msg = "盘尺寸错误";
LogUtil.error("盘尺寸错误!");
}
}
//if (codeList.Count > 0)
//{
// Bitmap bitmap = HObject2Bpp24(ho_Image);
// if (Exist(bitmap))
// {
// msg = "盘尺寸错误";
// LogUtil.error("盘尺寸错误!");
// }
// bitmap = null;
//}
allCodeList.AddRange(codeList);
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!