Commit faf869d1 几米阳光

增加进出轴限位

1 个父辈 55efe6d1
此文件类型无法预览
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<appSettings>
<!--是否开机自动启动料仓-->
<add key="App_AutoRun" value="1"/>
<add key="App_Title" value="AC_SA_料仓"/>
<add key="App_AutoRun" value="0" />
<add key="App_Title" value="AC_SA_料仓" />
<!--默认语言-->
<add key="Default_Language" value="zh-CN"/>
<add key="scanner_start_command" value="S"/>
<add key="Default_Language" value="zh-CN" />
<add key="scanner_start_command" value="S" />
<!-- 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)-->
<add key="StartBlowValue" value="4"/>
<add key="StartBlowValue" value="4" />
<!-- 停止吹气的判断值(配置值=服务器发送的湿度值-停止吹气值)-->
<add key="StopBlowValue" value="4"/>
<add key="StopBlowValue" value="4" />
<!--Server address-->
<add key="http.server" value="http://192.168.1.106:8080/"/>
<!--<add key="http.server" value="http://192.168.1.106:8080/"/>-->
<!--storeType-->
<add key="store_count" value="1"/>
<add key="store_count" value="1" />
<!--start one store config-->
<add key="Store_Position_Config" value="\StoreConfig\AC\linePositions.csv"/>
<add key="Store_ConfigPath" value="\StoreConfig\AC\StoreConfig.csv"/>
<add key="Store_Type" value="RC_AC_SA"/>
<add key="Store_CID" value="bjac1"/>
<add key="Store_Position_Config" value="\StoreConfig\AC\linePositions.csv" />
<add key="Store_ConfigPath" value="\StoreConfig\AC\StoreConfig.csv" />
<add key="Store_Type" value="RC_AC_SA" />
<add key="Store_CID" value="bjac1" />
<!--end one store config-->
<!--摄像机名称列表配置,用#分割-->
<add key="CameraName" value="codeCamera"/>
<add key="CameraName" value="GigE:MV-CE100-30GC (00C93521688)" />
<!--二维码类型列表配置,用#分割-->
<add key="CodeType" value="QR Code"/>
<add key="CodeType" value="QR Code" />
<!--<add key="CodeType" value="Data Matrix ECC 200"/>-->
<!--二维码参数文件所在路径,文件名与二维码类型名一样-->
<add key="CodeParamPath" value="\StoreConfig\AC\"/>
<add key="ACBaudRate" value="4800"/>
<add key="UseAIOBOX" value="1"/>
<add key="CodeParamPath" value="\StoreConfig\AC\" />
<add key="ACBaudRate" value="9600" />
<add key="UseAIOBOX" value="1" />
<add key ="InOutDefaultPosition" value ="3000"/>
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/BJACStore.log"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<file value="logs/BJACStore.log" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n"/>
<conversionPattern value="[%date][%t]%-5p %m%n" />
</layout>
</appender>
<root>
<level value="Info"/>
<appender-ref ref="RollingLogFileAppender"/>
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
</root>
</log4net>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
<!-- 部署服务库项目时,必须将配置文件的内容添加到
主机的 app.config 文件中。System.Configuration 不支持库的配置文件。 -->
......@@ -60,13 +60,13 @@
<service name="AcStoreWCF.CWSMDBox">
<endpoint address="" binding="basicHttpBinding" contract="AcStoreWCF.ICWSMDBox">
<identity>
<dns value="localhost"/>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/AcStoreWCF/CWSMDBox/"/>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/AcStoreWCF/CWSMDBox/" />
</baseAddresses>
</host>
</service>
......@@ -76,11 +76,11 @@
<behavior>
<!-- 为避免泄漏元数据信息,
请在部署前将以下值设置为 false -->
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" />
<!-- 要接收故障异常详细信息以进行调试,
请将以下值设置为 true。在部署前设置为 false
以避免泄漏异常信息 -->
<serviceDebug includeExceptionDetailInFaults="False"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
......
......@@ -26,8 +26,10 @@ namespace OnlineStore.ACSingleStore
private int compress_Slv = 0;
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private AC_SA_BoxBean store = null;
public FrmAxisDebug(AC_SA_BoxBean boxBean)
{
this.store = boxBean;
middle = boxBean.Config.Middle_Axis;
updown = boxBean.Config.UpDown_Axis;
......@@ -73,9 +75,26 @@ namespace OnlineStore.ACSingleStore
UpdateMiddlePosition();
}
}
/// <summary>
/// 判断进出轴是否在P1点
/// </summary>
private bool InOutIsIsP1()
{
int InOutDefaultPosition = ConfigAppSettings.GetIntValue(Setting_Init.InOutDefaultPosition);
int currValue = ACServerManager.GetActualtPosition(store.Config.InOut_Axis.DeviceName, store.Config.InOut_Axis.GetAxisValue());
if (currValue <= InOutDefaultPosition)
{
return true;
}
MessageBox.Show("叉子不在待机位,请先将叉子退回待机位(" + InOutDefaultPosition + ")", "警告(叉子在待机位时,才能移动升降轴和旋转轴) ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}
private void btnUpDownMove_MouseDown(object sender, MouseEventArgs e)
{
if (!InOutIsIsP1())
{
return;
}
int speed = FormUtil.GetIntValue(txtUpDownSpeed);
if (speed <= 0)
{
......@@ -98,7 +117,11 @@ namespace OnlineStore.ACSingleStore
private void btnInOutMove_MouseDown(object sender, MouseEventArgs e)
{
if (ACStoreManager.store.LoacationIsDown().Equals(false))
if (!InOutIsIsP1())
{
return;
}
if (ACStoreManager.store.InoutAxisCanMove().Equals(false))
{
MessageBox.Show( FrmStoreBox.cannotMove, FrmStoreBox.warn, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
......@@ -123,34 +146,13 @@ namespace OnlineStore.ACSingleStore
}
}
//private void btnComMove_MouseDown(object sender, MouseEventArgs e)
//{
// int speed = FormUtil.GetIntValue(txtComSpeed);
// if (speed <= 0)
// {
// MessageBox.Show(ResourceCulture.GetString(ResourceCulture.MsgTitle,"提示"),ResourceCulture.GetString(ResourceCulture.PWSpeed, "请先输入正确的速度"));
// return;
// }
// this.btnComMove.BackColor = Color.Green;
// ShuoKeControls.SetSpeed(compress_Slv, ShuoKeCMD.SetEndSpeed, speed);
// ShuoKeControls.SetSpeed(compress_Slv, ShuoKeCMD.SetMaxSpeed, speed);
// ShuoKeControls.VolMove(compress_Slv, speed);
//}
//private void btnComMove_MouseUp(object sender, MouseEventArgs e)
//{
// if (this.btnComMove.BackColor == Color.Green)
// {
// btnComMove.BackColor = System.Drawing.SystemColors.Control;
// //ACServerManager.SuddenStop(compress.DeviceName, compress.GetAxisValue());
// ShuoKeControls.SuddownStop(compress_Slv);
// }
//}
//private string cannotMove = ResourceCulture.GetString(ResourceCulture.CannotMove, "定位气缸不在下降端,不能移动进出轴");
//private string warn = ResourceCulture.GetString(ResourceCulture.WarnMsg, "警告");
private void btnMiddleMovej_MouseDown(object sender, MouseEventArgs e)
{
if (!InOutIsIsP1())
{
return;
}
int speed = FormUtil.GetIntValue(txtMiddleSpeed);
if (speed <= 0)
{
......@@ -173,6 +175,10 @@ namespace OnlineStore.ACSingleStore
private void btnUpDownMovej_MouseDown(object sender, MouseEventArgs e)
{
if (!InOutIsIsP1())
{
return;
}
int speed = FormUtil.GetIntValue(txtUpDownSpeed);
if (speed <= 0)
{
......@@ -195,7 +201,11 @@ namespace OnlineStore.ACSingleStore
private void btnInOutMovej_MouseDown(object sender, MouseEventArgs e)
{
if (ACStoreManager.store.LoacationIsDown().Equals(false))
if (!InOutIsIsP1())
{
return;
}
if (ACStoreManager.store.InoutAxisCanMove().Equals(false))
{
MessageBox.Show(FrmStoreBox.cannotMove, FrmStoreBox.warn, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
......@@ -220,29 +230,7 @@ namespace OnlineStore.ACSingleStore
}
}
//private void btnComMovej_MouseDown(object sender, MouseEventArgs e)
//{
// int speed = FormUtil.GetIntValue(txtComSpeed);
// if (speed <= 0)
// {
// MessageBox.Show(ResourceCulture.GetString(ResourceCulture.MsgTitle,"提示"),ResourceCulture.GetString(ResourceCulture.PWSpeed, "请先输入正确的速度"));
// return;
// }
// this.btnComMovej.BackColor = Color.Green;
// //AxisMove(compress, -speed);
// ShuoKeControls.SetSpeed(compress_Slv, ShuoKeCMD.SetEndSpeed, speed);
// ShuoKeControls.SetSpeed(compress_Slv, ShuoKeCMD.SetMaxSpeed, speed);
// ShuoKeControls.VolMove(compress_Slv, speed);
//}
//private void btnComMovej_MouseUp(object sender, MouseEventArgs e)
//{
// if (btnComMovej.BackColor.Equals(Color.Green))
// {
// btnComMovej.BackColor = System.Drawing.SystemColors.Control;
// ShuoKeControls.SuddownStop(compress_Slv);
// }
//}
private void button1_Click(object sender, EventArgs e)
{
......
......@@ -520,17 +520,22 @@ namespace OnlineStore.ACSingleStore
private void btnAxisAMove_Click(object sender, EventArgs e)
{
//ConfigMoveAxis axisC = store.moveAxisList[cmbAxisList.SelectedIndex];
string portName = txtAxisDeviceName.Text;
short SlvAddr = FormUtil.GetShortValue(txtAxisValue);
int position = FormUtil.GetIntValue(txtAPosition);
int speed = FormUtil.GetIntValue(txtASpeed);
//if (portName.Equals(store.Config.InOut_Axis.DeviceName) && (store.LoacationIsDown().Equals(false)))
if (store.Config.InOut_Axis.IsSameAxis(portName, SlvAddr) && (store.LoacationIsDown().Equals(false)))
if (store.Config.InOut_Axis.IsSameAxis(portName, SlvAddr) && (store.InoutAxisCanMove().Equals(false)))
{
MessageBox.Show( cannotMove,warn, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
} else if (store.Config.UpDown_Axis.IsSameAxis(portName, SlvAddr) || store.Config.Middle_Axis.IsSameAxis(portName, SlvAddr))
{
if (!InOutIsIsP1())
{
return;
}
}
LogUtil.info("点击【绝对运动】,端口号【"+ portName + "】地址【" + SlvAddr + "】位置【" + position + "】速度【" + speed + "】");
ACServerManager.AbsMove(portName, SlvAddr, position, speed );
......@@ -541,12 +546,19 @@ namespace OnlineStore.ACSingleStore
string portName = txtAxisDeviceName.Text;
short SlvAddr = FormUtil.GetShortValue(txtAxisValue);
int speed = FormUtil.GetIntValue(txtASpeed);
//if (portName.Equals(store.Config.InOut_Axis.DeviceName) && (store.LoacationIsDown().Equals(false)))
if (store.Config.InOut_Axis.IsSameAxis(portName, SlvAddr) && (store.LoacationIsDown().Equals(false)))
//if (portName.Equals(store.Config.InOut_Axis.DeviceName) && (store.InoutAxisCanMove().Equals(false)))
if (store.Config.InOut_Axis.IsSameAxis(portName, SlvAddr) && (store.InoutAxisCanMove().Equals(false)))
{
MessageBox.Show(cannotMove, warn, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
else if (store.Config.UpDown_Axis.IsSameAxis(portName, SlvAddr) || store.Config.Middle_Axis.IsSameAxis(portName, SlvAddr))
{
if (!InOutIsIsP1())
{
return;
}
}
LogUtil.info("点击【匀速运动】,端口号【" + portName + "】地址【" + SlvAddr + "】 速度【" + speed + "】");
ACServerManager.SpeedMove(portName, SlvAddr, speed);
}
......@@ -558,20 +570,19 @@ namespace OnlineStore.ACSingleStore
short SlvAddr = FormUtil.GetShortValue(txtAxisValue);
int position = FormUtil.GetIntValue(txtAPosition);
int speed = FormUtil.GetIntValue(txtASpeed);
//int currPositon = ACServerManager.GetActualtPosition(portName, SlvAddr);
// int newPosition = position + currPositon;
// if (axisC.PositionIsHasLimit() && (axisC.PositionMin > newPosition || axisC.PositionMax < newPosition))
//{
// MessageBox.Show("位置超出"+axisC.Explain+"上下限(" + axisC.PositionMin + "-" + axisC.PositionMax + ")");
// return;
//}
//if (portName.Equals(store.Config.InOut_Axis.DeviceName) && (store.LoacationIsDown().Equals(false)))
if (store.Config.InOut_Axis.IsSameAxis(portName, SlvAddr) && (store.LoacationIsDown().Equals(false)))
if (store.Config.InOut_Axis.IsSameAxis(portName, SlvAddr) && (store.InoutAxisCanMove().Equals(false)))
{
MessageBox.Show(cannotMove, warn, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
else if (store.Config.UpDown_Axis.IsSameAxis(portName, SlvAddr) || store.Config.Middle_Axis.IsSameAxis(portName, SlvAddr))
{
if (!InOutIsIsP1())
{
return;
}
}
LogUtil.info("点击【相对运动】,端口号【" + portName + "】地址【" + SlvAddr + "】位置【" + position + "】速度【" + speed + "】");
ACServerManager.RelMove(portName, SlvAddr, position, speed);
}
......@@ -715,8 +726,29 @@ namespace OnlineStore.ACSingleStore
LogUtil.info("点击【关闭伺服】,端口号【" + portName + "】地址【" + SlvAddr + "】 ");
ACServerManager.ServoOff(portName, SlvAddr);
}
/// <summary>
/// 判断进出轴是否在P1点
/// </summary>
private bool InOutIsIsP1()
{
int InOutDefaultPosition = ConfigAppSettings.GetIntValue(Setting_Init.InOutDefaultPosition);
int currValue = ACServerManager.GetActualtPosition(store.Config.InOut_Axis.DeviceName, store.Config.InOut_Axis.GetAxisValue());
if (currValue <= InOutDefaultPosition)
{
return true;
}
MessageBox.Show("叉子不在待机位,请先将叉子退回待机位(" + InOutDefaultPosition + ")", "警告(叉子在待机位时,才能移动升降轴和旋转轴) ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}
private void AxisABSMove(ConfigMoveAxis moveAxis, int targetPosition, int targetSpeed)
{
if (moveAxis.IsSameAxis(store.Config.Middle_Axis) || moveAxis.IsSameAxis(store.Config.UpDown_Axis))
{
if (!InOutIsIsP1())
{
return;
}
}
moveAxis.TargetPosition = targetPosition;
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed);
}
......@@ -783,7 +815,7 @@ namespace OnlineStore.ACSingleStore
private void btnInOutP1_Click(object sender, EventArgs e)
{
if (store.LoacationIsDown().Equals(false))
if (store.InoutAxisCanMove().Equals(false))
{
MessageBox.Show(cannotMove, warn, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
......@@ -794,7 +826,7 @@ namespace OnlineStore.ACSingleStore
private void btnInOutP3_Click(object sender, EventArgs e)
{
if (store.LoacationIsDown().Equals(false))
if (store.InoutAxisCanMove().Equals(false))
{
MessageBox.Show(cannotMove, warn, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
......@@ -805,7 +837,7 @@ namespace OnlineStore.ACSingleStore
private void btnInOutP2_Click(object sender, EventArgs e)
{
if (store.LoacationIsDown().Equals(false))
if (store.InoutAxisCanMove().Equals(false))
{
MessageBox.Show(cannotMove, warn, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
......
......@@ -70,6 +70,9 @@ namespace OnlineStore.Common
/// 是否使用新IO模块 AIOBOX,1=使用新IO
/// </summary>
public static string UseAIOBOX = "UseAIOBOX";
/// <summary>
/// 进出轴待机点限位
/// </summary>
public static string InOutDefaultPosition = "InOutDefaultPosition";
}
}
......@@ -87,6 +87,7 @@ namespace OnlineStore.DeviceLibrary
string codeStr = ConfigAppSettings.GetValue(Setting_Init.CodeType);
CodeManager.LoadConfig(nameStr, codeStr);
CodeLibrary.CodeResourceControl.OpenResourceLog = false;
Task.Factory.StartNew(delegate
{
IOManager.instance.ConnectionKND(Config.DIODeviceNameList);
......
......@@ -700,7 +700,7 @@ namespace OnlineStore.DeviceLibrary
}
}
public bool LoacationIsDown()
public bool InoutAxisCanMove()
{
if (KNDIOValue(IO_Type.LocationCylinder_Down).Equals(IO_VALUE.HIGH)
&& KNDIOValue(IO_Type.LocationCylinder_Up).Equals(IO_VALUE.LOW)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!