Commit 404f41fe 刘韬

添加压紧轴列表, 回原加速度调到6倍, 扫码完后取盘时检测不到盘则取消任务

1 个父辈 de14ca3c
正在显示 28 个修改的文件 包含 307 行增加74 行删除
......@@ -218,7 +218,7 @@
</EmbeddedResource>
<None Include="app.manifest" />
<None Include="packages.config" />
<None Include="resource\language.resource">
<None Include="resources\language.resource">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Properties\Settings.settings">
......@@ -230,7 +230,7 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<None Include="resource\ResourceMap.csv">
<None Include="resources\ResourceMap.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
......
......@@ -72,7 +72,7 @@
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
</logger>
<logger name="ResourcesLog" additivity="false">
<logger name="LngResource" additivity="false">
<level value="All" />
<appender-ref ref="ResourcesLog" />
</logger>
......
......@@ -254,7 +254,7 @@
this.chbAutoRead.Checked = true;
this.chbAutoRead.CheckState = System.Windows.Forms.CheckState.Checked;
this.chbAutoRead.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbAutoRead.Location = new System.Drawing.Point(588, 613);
this.chbAutoRead.Location = new System.Drawing.Point(592, 613);
this.chbAutoRead.Name = "chbAutoRead";
this.chbAutoRead.Size = new System.Drawing.Size(75, 21);
this.chbAutoRead.TabIndex = 244;
......@@ -538,7 +538,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(882, 657);
this.ClientSize = new System.Drawing.Size(886, 657);
this.Controls.Add(this.button1);
this.Controls.Add(this.groupBoxHighState);
this.Controls.Add(this.groupBoxDowrite);
......
......@@ -91,10 +91,10 @@
this.rbtnJapanese.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.rbtnJapanese.Location = new System.Drawing.Point(198, 130);
this.rbtnJapanese.Name = "rbtnJapanese";
this.rbtnJapanese.Size = new System.Drawing.Size(60, 25);
this.rbtnJapanese.Size = new System.Drawing.Size(76, 25);
this.rbtnJapanese.TabIndex = 281;
this.rbtnJapanese.TabStop = true;
this.rbtnJapanese.Text = "日";
this.rbtnJapanese.Text = "日本語";
this.rbtnJapanese.UseVisualStyleBackColor = true;
//
// FrmLanguare
......
......@@ -168,11 +168,12 @@ namespace OnlineStore.ACSingleStore
this.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title);
notifyIcon1.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title);
axisMoveControl1.LoadData(store);
LoadOk = true;
this.chbBuzzer.Checked = store.UseBuzzer;
this.chbTH.Checked = store.UseAirBlow;
axisMoveControl1.LoadData(store);
chbIsDebug.Checked = store.IsDebug;
LoadOk = true;
HideForm();
LogUtil.info("启动完成");
......@@ -193,7 +194,7 @@ namespace OnlineStore.ACSingleStore
iodbgfrm.TopLevel = false;
tabPage9.Controls.Add(iodbgfrm);
iodbgfrm.Dock = DockStyle.Fill;
iodbgfrm.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left)));
//iodbgfrm.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left)));
iodbgfrm.Show();
......@@ -444,7 +445,10 @@ namespace OnlineStore.ACSingleStore
private void AxisABSMove(ConfigMoveAxis moveAxis, int targetPosition, int targetSpeed)
{
moveAxis.TargetPosition = targetPosition;
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed, targetSpeed*4, targetSpeed*4);
//var moveAxis = getAxis(SlvAddr);
var addSpeed = moveAxis.AddSpeed > 0 ? moveAxis.AddSpeed : targetSpeed * 4;
var delSpeed = moveAxis.DelSpeed > 0 ? moveAxis.DelSpeed : targetSpeed * 4;
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed, addSpeed, delSpeed);
}
private void btnUpDownP1_Click(object sender, EventArgs e)
{
......@@ -598,7 +602,12 @@ namespace OnlineStore.ACSingleStore
{
Camera._cam.CloseAll();
}
//CodeResourceControl.OpenResourceLog = true;
CodeResourceControl.GetLanguageEvent += () => { return ResourceCulture.CurrLanguage; };
CodeResourceControl.CurrLanguage= ResourceCulture.CurrLanguage;
CodeLibrary.FrmCodeDecode frm = new CodeLibrary.FrmCodeDecode();
frm.CurrLanguage = ResourceCulture.CurrLanguage;
frm.LanguageProcess();
frm.chbZxing.Checked = false;
frm.chbZxing.Visible = false;
frm.ShowDialog();
......@@ -933,9 +942,9 @@ namespace OnlineStore.ACSingleStore
short slvAddr = store.Config.UpDown_Axis.GetAxisValue();
int ioIndex = 0;
// if (store.Config.StoreDIList.ContainsKey(IO_Type.UpdownPositionSingal))
if (store.Config.StoreDIList.ContainsKey(IO_Type.TrayCheck_Fixture))
if (store.Config.StoreDIList.ContainsKey(IO_Type.Laser_detection))
{
ioIndex = store.Config.StoreDIList[IO_Type.TrayCheck_Fixture].GetIOAddr();
ioIndex = store.Config.StoreDIList[IO_Type.Laser_detection].GetIOAddr();
}
FrmPositionTool frm = new FrmPositionTool(PortName, slvAddr, ioIndex, store.Config.UpDown_Axis.HomeHighSpeed, store.Config.UpDown_Axis.HomeLowSpeed, store.Config.UpDown_Axis.HomeAddSpeed);
frm.ShowDialog();
......
......@@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SO951-HC-ACSingleStore 82710d360fb1b40b2637f7671e0085adf4f5926c")]
[assembly: AssemblyProduct("SO951-HC-ACSingleStore de14ca3c0b9efddc8beead183e4c06c73936ef8b")]
[assembly: AssemblyCopyright("Copyright ? 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
......
......@@ -58,7 +58,7 @@ namespace OnlineStore
//string chinaPath = Application.StartupPath + @"\resource\zh-CN.resource";
//Dictionary<string, string> ChinaMap = LoadDataMap(chinaPath);
//Dictionary<string, string> EnglishMap = LoadDataMap(englishPath);
string rPath= Application.StartupPath + @"\resource\language.resource";
string rPath= Application.StartupPath + @"\resources\language.resource";
ResourceMap = new Dictionary<string, Dictionary<string, string>>();
Dictionary<string, string> ChinaMap = new Dictionary<string, string>();
Dictionary<string, string> EnglishMap = new Dictionary<string, string>();
......@@ -186,7 +186,7 @@ namespace OnlineStore
private static Dictionary<string,string> LoadRMap()
{
string path = Application.StartupPath + @"\resource\ResourceMap.csv";
string path = Application.StartupPath + @"\resources\ResourceMap.csv";
Dictionary<string, string> map = new Dictionary<string, string>();
try
{
......
......@@ -150,12 +150,18 @@ namespace OnlineStore.ACSingleStore
{
int position = Convert.ToInt32(txtPosition.Text);
int speed = Convert.ToInt32(txtSpeed.Text);
ACServerManager.RelMove(PortName, SlvAddr, position, speed, speed*4, speed * 4);
var moveAxis = getAxis(SlvAddr);
var addSpeed = moveAxis.AddSpeed > 0 ? moveAxis.AddSpeed : speed * 4;
var delSpeed = moveAxis.DelSpeed > 0 ? moveAxis.DelSpeed : speed * 4;
ACServerManager.RelMove(PortName, SlvAddr, position, speed, addSpeed, delSpeed);
}
private void btnHomeMove_Click(object sender, EventArgs e)
{
int speed = Convert.ToInt32(txtSpeed.Text);
ACServerManager.HomeMove(PortName, SlvAddr, ptpAcc, ptpDec,homespeed);
var moveAxis = getAxis(SlvAddr);
var HomeAddSpeed = moveAxis.HomeAddSpeed > 0 ? moveAxis.HomeAddSpeed : moveAxis.HomeHighSpeed * 6;
var HomeLowSpeed = moveAxis.HomeLowSpeed > 0 ? moveAxis.HomeLowSpeed : moveAxis.HomeHighSpeed / 10;
ACServerManager.HomeMove(PortName, SlvAddr, moveAxis.HomeHighSpeed, HomeAddSpeed, HomeLowSpeed);
}
private void btnSpeedMove_Click(object sender, EventArgs e)
{
......@@ -213,7 +219,10 @@ namespace OnlineStore.ACSingleStore
PositionList = new List<int>();
LogUtil.info(LogName + "伺服开始运动,速度【" + speed + "】位置【" + position + "】启动定时器 ");
formMoveStatus(false);
ACServerManager.AbsMove(PortName, SlvAddr, position, speed, speed * 4, speed * 4);
var moveAxis = getAxis(SlvAddr);
var addSpeed = moveAxis.AddSpeed > 0 ? moveAxis.AddSpeed : speed * 4;
var delSpeed = moveAxis.DelSpeed > 0 ? moveAxis.DelSpeed : speed * 4;
ACServerManager.AbsMove(PortName, SlvAddr, position, speed, addSpeed, delSpeed);
toolTimer.Start();
}
private int P3Offset = 0;
......@@ -235,6 +244,7 @@ namespace OnlineStore.ACSingleStore
{
toolTimer.Stop();
ACServerManager.SuddenStop(PortName, SlvAddr);
formMoveStatus(true);
}
private IO_VALUE GetSingleValue()
......@@ -370,6 +380,19 @@ namespace OnlineStore.ACSingleStore
{
this.Close();
}
ConfigMoveAxis getAxis(short SlvAddr)
{
foreach (ConfigMoveAxis a in StoreManager.Store.moveAxisList)
{
if (a.IsSameAxis(PortName, SlvAddr))
{
return a;
}
}
return null;
}
}
}
......@@ -111,7 +111,10 @@ namespace OnlineStore.DUOStore
int position = FormUtil.GetIntValue(txtAPosition);
int speed = FormUtil.GetIntValue(txtASpeed);
LogUtil.info(boxBean.Name+"点击【绝对运动】,【" + PortName + "_" + SlvAddr + "】位置【" + position + "】速度【" + speed + "】");
AxisManager.AbsMove(PortName, SlvAddr, position, speed, speed*4, speed * 4);
var moveAxis = getAxis(SlvAddr);
var addSpeed = moveAxis.AddSpeed > 0 ? moveAxis.AddSpeed : speed * 4;
var delSpeed = moveAxis.DelSpeed > 0 ? moveAxis.DelSpeed : speed * 4;
AxisManager.AbsMove(PortName, SlvAddr, position, speed, addSpeed, delSpeed);
}
private void btnAxisRMove_Click(object sender, EventArgs e)
......@@ -123,7 +126,10 @@ namespace OnlineStore.DUOStore
int position = FormUtil.GetIntValue(txtAPosition);
int speed = FormUtil.GetIntValue(txtASpeed);
LogUtil.info(boxBean.Name+"点击【相对运动】,【" + PortName + "_" + SlvAddr + "】位置【" + position + "】速度【" + speed + "】");
AxisManager.RelMove(PortName, SlvAddr, position, speed, speed*4, speed*4);
var moveAxis = getAxis(SlvAddr);
var addSpeed = moveAxis.AddSpeed > 0 ? moveAxis.AddSpeed : speed * 4;
var delSpeed = moveAxis.DelSpeed > 0 ? moveAxis.DelSpeed : speed * 4;
AxisManager.RelMove(PortName, SlvAddr, position, speed, addSpeed, delSpeed);
}
private void btnAxisVMove_Click(object sender, EventArgs e)
......@@ -173,8 +179,10 @@ namespace OnlineStore.DUOStore
if (a.IsSameAxis(PortName, SlvAddr))
{
LogUtil.info(boxBean.Name+"点击【原点返回】,【" + PortName + "_" + SlvAddr + "】 速度【" + a.HomeHighSpeed + "】");
AxisManager.HomeMove(PortName, SlvAddr, a.HomeHighSpeed,a.HomeLowSpeed,a.HomeAddSpeed);
var moveAxis = a;
var HomeAddSpeed = moveAxis.HomeAddSpeed > 0 ? moveAxis.HomeAddSpeed : moveAxis.HomeHighSpeed * 6;
var HomeLowSpeed = moveAxis.HomeLowSpeed > 0 ? moveAxis.HomeLowSpeed : moveAxis.HomeHighSpeed / 10;
AxisManager.HomeMove(PortName, SlvAddr, a.HomeHighSpeed,HomeLowSpeed,HomeAddSpeed);
}
}
}
......@@ -333,7 +341,7 @@ namespace OnlineStore.DUOStore
}
private void ReadAxisStatus()
{
groupBox2.Text = cmbAxis.Text + "-状态监控";
groupBox2.Text = cmbAxis.Text;
//【1】更新轴号
short axisNo = SlvAddr;
if (axisNo < 0)
......@@ -421,5 +429,17 @@ namespace OnlineStore.DUOStore
{
this.timer1.Stop();
}
ConfigMoveAxis getAxis(short SlvAddr) {
foreach (ConfigMoveAxis a in axisList)
{
if (a.IsSameAxis(PortName, SlvAddr))
{
return a;
}
}
return null;
}
}
}
......@@ -115,8 +115,15 @@ namespace OnlineStore.ACSingleStore.useControl
pa[1] += "A";
if (int.TryParse(pb[1], out _))
pb[1] += "A";
var isa = Regex.Replace(pa[1], @"[^\d]*", "") + (pa[1][1].Equals('A') ? "1" : "2") + pa[2][0] + pa[3].PadLeft(2, '0');
var isb = Regex.Replace(pb[1], @"[^\d]*", "") + (pb[1][1].Equals('A') ? "1" : "2") + pb[2][0] + pb[3].PadLeft(2, '0');
var pa1 = pa[1][0]+(pa[1][1].Equals('A') ? "1" : "2");
var pb1 = pb[1][0] + (pb[1][1].Equals('A') ? "1" : "2");
var pa2 = pa[2].Length==2? (pa[2][1].Equals('A') ? "1" : "2")+ pa[2][0] : pa[2];
var pb2 = pb[2].Length == 2 ? (pb[2][1].Equals('A') ? "1" : "2")+ pb[2][0] : pb[2];
var isa = Regex.Replace(pa[1], @"[^\d]*", "") + pa1 + pa2 + pa[3].PadLeft(2, '0');
var isb = Regex.Replace(pb[1], @"[^\d]*", "") + pb1 + pb2 + pb[3].PadLeft(2, '0');
if (int.Parse(isa) == int.Parse(isb))
return 0;
......@@ -359,7 +366,10 @@ namespace OnlineStore.ACSingleStore.useControl
private void AxisABSMove(ConfigMoveAxis moveAxis, int targetPosition, int targetSpeed)
{
moveAxis.TargetPosition = targetPosition;
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed, targetSpeed * 4, targetSpeed * 4);
var addSpeed = moveAxis.AddSpeed > 0 ? moveAxis.AddSpeed : targetSpeed * 4;
var delSpeed = moveAxis.DelSpeed > 0 ? moveAxis.DelSpeed : targetSpeed * 4;
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed, addSpeed, delSpeed);
}
/// <summary>
/// 判断进出轴是否在P1点
......
......@@ -62,6 +62,7 @@
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
......
......@@ -121,5 +121,65 @@ namespace OnlineStore.Common
}
return "";
}
private static string Addr_cancelPutInTask = "/service/store/cancelPutInTask";
public static string cancelPutInTask(string deviceName, string barcode)
{
string msg = "";
try
{
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("barcode", barcode);
string server = GetAddr(Addr_cancelPutInTask, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
LogUtil.info(deviceName + "cancelPutInTask " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
RfidData data = JsonHelper.DeserializeJsonToObject<RfidData>(resultStr);
if (data == null)
{
return msg = deviceName + " cancelPutInTask【 " + barcode + "】 没有收到服务器反馈";
}
else if (data.code.Equals(0).Equals(false))
{
return msg = deviceName + " cancelPutInTask【 " + barcode + "】 :" + data.msg;
}
return "";
}
catch (Exception ex)
{
LogUtil.error(deviceName + " " + ex.ToString());
}
return msg;
}
private static string GetAddr(string addr, Dictionary<string, string> paramsMap)
{
string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
if (server.EndsWith("/"))
{
server = server.Substring(0, server.Length - 1);
}
string path = server + addr.Trim() + "?";
foreach (string paramName in paramsMap.Keys)
{
string par = System.Web.HttpUtility.UrlEncode(paramsMap[paramName], System.Text.Encoding.UTF8);
path += paramName + "=" + par + "&";
}
path = path.Substring(0, path.Length - 1);
return path;
}
public class RfidData
{
//{"code":0,"msg":"ok","data":"7"}
public int code { get; set; }
public string msg { get; set; }
public Dictionary<string, string> data { get; set; }
}
}
}
\ No newline at end of file
......@@ -36,8 +36,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Asa.Camera.VisionLib">
<HintPath>..\..\..\camera\Asa.Camera.VisionLib.dll</HintPath>
<Reference Include="Asa.Camera.VisionLib, Version=1.3.7927.28975, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Camera\CameraVisionLib\bin\Debug\Asa.Camera.VisionLib.dll</HintPath>
</Reference>
<Reference Include="Asa.IOModule.AIOBOX">
<HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
......
......@@ -36,6 +36,7 @@ PRO,升降轴 进料口出料缓冲点 P8,UpDownAxis_DoorIBPosition_P8,700000,,,,,,
PRO,旋转轴(轴1)P1 待机原位点,MiddleAxis_P1_Position,151500,,,,,,
PRO,进出轴(轴3)P1待机原位点,InOutAxis_P1_Position,0,,,,,,
PRO,压紧轴(轴4)P1待机原位点,CompressAxis_P1_Position,2000,,,,,,
PRO,L4_压紧轴_P2压紧点范围对应值,_CompAxis_P2_List,8=49928;12=45455;16=42495;,,,,,,
PRO,是否使用定位气缸,IsHasLocationCylinder,0,,,,,,
PRO,是否有左右侧门,IsHasDoorLimit,1,,,,,,
PRO,是否使用压紧轴(1=使用),IsHasCompress_Axis,1,,,,,,
......
......@@ -123,7 +123,8 @@ namespace OnlineStore.DeviceLibrary
IOManager.IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW);
//IOManager.IOMove(IO_Type.Device_Led, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.Device_Led, IO_VALUE.HIGH);
LogUtil.info(StoreName + " 初始化完成,OutStoreWaitSeconds=" + OutStoreWaitSeconds);
}
......@@ -190,7 +191,7 @@ namespace OnlineStore.DeviceLibrary
public override bool StartRun()
{
LogUtil.info(LOGGER, StoreName + "开始启动,启动时间:" + StartTime.ToString());
autoNext = false;
mainTimer.Enabled = false;
alarmType = StoreAlarmType.None;
......@@ -388,13 +389,10 @@ namespace OnlineStore.DeviceLibrary
return;
}
//复位和回原点要等轴3进出轴ORG亮了以后才能返回其他轴
LogUtil.info(LOGGER, StoreName + "复位中: 压紧轴,旋转轴,上下轴开始 原点返回");
LogUtil.info(LOGGER, StoreName + "复位中: 旋转轴,上下轴开始 原点返回");
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_OtherAxisBack_wait);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(1000));
if (IsHasCompress_Axis)
{
ACAxisHomeMove(Config.Comp_Axis);
}
ACAxisHomeMove(Config.Middle_Axis);
ACAxisHomeMove(Config.UpDown_Axis);
break;
......@@ -403,15 +401,22 @@ namespace OnlineStore.DeviceLibrary
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(500));
break;
case StoreMoveStep.BOX_H_OtherAxisBack:
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_MiddleAxisToP1);
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_OtherAxisBack_wait2);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(1000));
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_DoorOPosition_P1, Config.UpDownAxis_P1_Speed);
ComMoveToPosition(Config.CompressAxis_P1_Position,Config.CompAxis_P1_Speed);
if (IsHasCompress_Axis)
{
ACAxisHomeMove(Config.Comp_Axis);
}
break;
case StoreMoveStep.BOX_H_OtherAxisBack_wait2:
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_MiddleAxisToP1);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(500));
break;
case StoreMoveStep.BOX_H_MiddleAxisToP1:
ComMoveToPosition(Config.CompressAxis_P1_Position, Config.CompAxis_P1_Speed);
HuichuanLibrary.HCBoardManager.SetAxBacklash(Config.Middle_Axis.GetAxisValue(), Config.MiddleAxis_Reverse_Offset, Config.Middle_Axis.HomeLowSpeed, -1);
LogUtil.info(LOGGER, StoreName + "复位完成,设置旋转轴反向间隙:"+ Config.MiddleAxis_Reverse_Offset);
storeRunStatus = StoreRunStatus.Runing;
......@@ -1715,7 +1720,7 @@ namespace OnlineStore.DeviceLibrary
return CalHeight(Value);
}
private int CalHeight(double Value)
{
int result = 0;
......@@ -1730,6 +1735,7 @@ namespace OnlineStore.DeviceLibrary
else
{
result = (int)Math.Floor(1F * (Value) / 4) * 4;
result = (int)Math.Floor(1F * (Value));
if (result <= 8)
{
result = 8;
......@@ -1753,12 +1759,20 @@ namespace OnlineStore.DeviceLibrary
}
else if (result >= 16)
{
result = 24;
result = 16;
}
else if (result >= 13)
{
result = 12;
}
else if (result >= 5)
{
result = 8;
}
else
{
result = 0;
}
return result;
}
......@@ -2190,10 +2204,16 @@ namespace OnlineStore.DeviceLibrary
}
else
{
if (StoreMove.MoveType == StoreMoveType.OutStore && StoreMove.MoveParam.PositionNum == posId)
{
LogUtil.error(LOGGER, "执行出库【" + posId + "】失败,当前库位正在出库");
continue;
}
FixtureCodeInfo currInOutFixture = new FixtureCodeInfo(0, "", posId, plateW, plateH);
if (CanStarInOut())
{
bool result = StartOutStoreMove(new InOutStoreParam("", posId, position));
bool result = StartOutStoreMove(new InOutStoreParam("", posId, plateH, plateW));
if (!result)
{
LogUtil.info(LOGGER, StoreName + " 执行出库【" + currInOutFixture.ToStr() + "】失败,加入等待队列");
......
......@@ -73,6 +73,12 @@ namespace OnlineStore.DeviceLibrary
p.UpDown_P7 = Config.UpDownAxis_DoorOBPosition_P7;
p.ComPress_P2 = position.CompressAxis_Position_P2;
if (int.TryParse(param.PlateH, out int plateh))
{
var h = Config.GetComP2(plateh);
if (h>0)
p.ComPress_P2 = h;
}
p.ComPress_P3 = position.CompressAxis_CPosition_P3;
p.InOut_P3 = position.InOutAxis_Position_P3;
p.Middle_P2 = position.MiddleAxis_Position_P2;
......@@ -386,10 +392,21 @@ namespace OnlineStore.DeviceLibrary
else if (StoreMove.MoveStep == StoreMoveStep.SI_05_DeviceToDoor)
{
NeedCheckSafetyLight = 0;
InStoreLog("入库:SI_06 拿物品,压紧轴至P2(压紧点)) 升降轴至P7(进料口取料缓冲点) ");
StoreMove.NextMoveStep(StoreMoveStep.SI_06_DoorWarToDevice);
ComMoveToPosition(moveP.ComPress_P2, Config.CompAxis_P2_Speed);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P7, Config.UpDownAxis_P7_Speed);
if (IOManager.IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.LOW))
{
InStoreLog("入库:SI_06 未检测到料盘,任务取消 ");
StoreMove.NextMoveStep(StoreMoveStep.SI_14_CheckTray);
HttpHelper.cancelPutInTask(Name, StoreMove.MoveParam.WareNumber);
}
else
{
InStoreLog("入库:SI_06 拿物品,压紧轴至P2(压紧点)) 升降轴至P7(进料口取料缓冲点) ");
StoreMove.NextMoveStep(StoreMoveStep.SI_06_DoorWarToDevice);
ComMoveToPosition(moveP.ComPress_P2, Config.CompAxis_P2_Speed);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P7, Config.UpDownAxis_P7_Speed);
}
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_06_DoorWarToDevice)
......@@ -414,7 +431,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.SI_09_MoveToBag);
ACAxisMove(Config.Middle_Axis, moveP.Middle_P2, Config.MiddleAxis_P2_Speed);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P3, Config.UpDownAxis_P3_Speed);
//关闭仓门
//关闭仓门
CloseDoor(false);
}
//else
......@@ -866,7 +883,9 @@ namespace OnlineStore.DeviceLibrary
{
lock (waitOutListLock)
{
waitOutStoreList.Add(code);
var x = waitOutStoreList.FindAll((fx) => { return fx.PosId == code.PosId; });
if (x.Count==0)
waitOutStoreList.Add(code);
}
}
/// <summary>
......
......@@ -154,8 +154,9 @@ namespace OnlineStore.DeviceLibrary
HalconDotNet.HObject ho_Image = null;
try
{
ho_Image = Camera._cam.CaptureOnImage(cameraName,out Bitmap bitmap);
if (ho_Image == null)
bool nohalcon = false;
ho_Image = Camera._cam.CaptureOnImage(cameraName,out Bitmap bitmap, nohalcon);
if (ho_Image == null && !nohalcon)
{
LogUtil.error(" 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机");
CloseCamera(cameraName);
......@@ -165,17 +166,15 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(" 【" + cameraName + "】取图片完成,开始扫码");
List<CodeInfo> cc = new List<CodeInfo>();
string r = "";
foreach (string codeType in codeTypeList)
RemoteDecodeHelper.RemoteDecodeParam remoteDecodeParam = new RemoteDecodeHelper.RemoteDecodeParam
{
//判断是否是一维码
if (codeType.ToLower().Equals("barcode"))
{
cc = HDCodeHelper.DecodeBarCode(ho_Image);
}
else
{
cc = HDCodeHelper.DecodeCode(ho_Image, codeType, GetCodeParamFilePath(codeType), codeCount, 4000);
}
codeTypeList = codeTypeList.ToArray(),
codeCount = codeCount,
timeout = 4000
};
cc = RemoteDecodeHelper.DecodeRequest(bitmap, remoteDecodeParam);
if (cc != null) {
foreach (CodeInfo c in cc)
{
string str = CodeManager.ReplaceCode(c.CodeStr);
......@@ -186,6 +185,7 @@ namespace OnlineStore.DeviceLibrary
}
}
}
if (String.IsNullOrEmpty(r))
{
// SaveImageToFile(deviceName, cameraName, bit);
......
......@@ -40,7 +40,7 @@ namespace OnlineStore
}
var m = Regex.Match(configtxt, "name\".*?\"(.+)\"", RegexOptions.IgnoreCase);
DeviceName = m.Groups[1].Value;
camera = new VisionLib(path, "HIK.IPCamera");
camera = new VisionLib(path,true, "HIK.IPCamera");
}
catch (Exception e){
LogUtil.error(Name + "加载监控相机配置文件失败:"+ e.ToString());
......
......@@ -73,7 +73,16 @@ namespace OnlineStore.DeviceLibrary
MoveP = null;
IsSolderPaste = false;
}
public InOutStoreParam(string wareNo, string posId, string plateH, string plateW, ACStorePosition movep)
{
ACStoreP = movep;
WareNumber = wareNo;
PositionNum = posId;
MoveP = null;
IsSolderPaste = false;
this.PlagtW = plateW;
this.PlateH = plateH;
}
private ACStorePosition ACStoreP = null;
public ACStorePosition GetACPosition()
......
......@@ -228,7 +228,10 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(LOGGER, moveAxis.DisplayStr + "speed[" + moveAxis.TargetSpeed + "]开始原点返回");
StoreMove.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, true));
AddAxisMoveTime(moveAxis);
ACServerManager.HomeMove(moveAxis.DeviceName, (short)moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed, moveAxis.HomeLowSpeed, moveAxis.HomeAddSpeed);
var HomeAddSpeed = moveAxis.HomeAddSpeed > 0 ? moveAxis.HomeAddSpeed : moveAxis.HomeHighSpeed * 6;
var HomeLowSpeed = moveAxis.HomeLowSpeed > 0 ? moveAxis.HomeLowSpeed : moveAxis.HomeHighSpeed / 10;
ACServerManager.HomeMove(moveAxis.DeviceName, (short)moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed, HomeLowSpeed, HomeAddSpeed);
}
/// <summary>
......@@ -239,7 +242,10 @@ namespace OnlineStore.DeviceLibrary
StoreMove.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, targetPosition, targetSpeed));
moveAxis.TargetPosition = targetPosition;
AddAxisMoveTime(moveAxis);
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition,targetSpeed, targetSpeed*4, targetSpeed * 4);
var addSpeed = moveAxis.AddSpeed > 0 ? moveAxis.AddSpeed:targetSpeed * 4;
var delSpeed = moveAxis.DelSpeed > 0 ? moveAxis.DelSpeed:targetSpeed * 4;
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition,targetSpeed, addSpeed, delSpeed);
}
/// <summary>
......@@ -274,8 +280,11 @@ namespace OnlineStore.DeviceLibrary
if (StoreMove.CanWhileCount > 0)
{
LogUtil.error(LOGGER, moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount +
"],误差过大,重新开始运动,剩余[" + StoreMove.CanWhileCount + "]次");
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed, targetSpeed * 4, targetSpeed * 4);
"],误差过大,重新开始运动,剩余[" + StoreMove.CanWhileCount + "]次");
var addSpeed = moveAxis.AddSpeed > 0 ? moveAxis.AddSpeed : targetSpeed * 4;
var delSpeed = moveAxis.DelSpeed > 0 ? moveAxis.DelSpeed : targetSpeed * 4;
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed, addSpeed, delSpeed);
StoreMove.CanWhileCount--;
}
else
......@@ -306,7 +315,10 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(LOGGER, moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],重新回原点,剩余[" + StoreMove.CanWhileCount + "]次");
//LogUtil.error(LOGGER, StoreName + moveAxis.DisplayStr + "重新回原点");
ACServerManager.HomeMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed, moveAxis.HomeLowSpeed, moveAxis.HomeAddSpeed);
var HomeAddSpeed = moveAxis.HomeAddSpeed > 0 ? moveAxis.HomeAddSpeed : moveAxis.HomeHighSpeed * 6;
var HomeLowSpeed = moveAxis.HomeLowSpeed > 0 ? moveAxis.HomeLowSpeed : moveAxis.HomeHighSpeed / 10;
ACServerManager.HomeMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed, HomeLowSpeed, HomeAddSpeed);
StoreMove.CanWhileCount--;
}
else
......
......@@ -142,6 +142,7 @@ namespace OnlineStore.DeviceLibrary
/// 料仓原点返回和重置步骤,,升降轴,旋转轴,压紧轴原点返回
/// </summary>
BOX_H_OtherAxisBack = 014,
BOX_H_OtherAxisBack_wait2 = 015,
///// <summary>
///// 清理轴位置
///// </summary>
......@@ -149,7 +150,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 旋转轴返回P1
/// </summary>
BOX_H_MiddleAxisToP1=016,
BOX_H_MiddleAxisToP1 =016,
/// <summary>
/// 叉子先退回P1
......
using System;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
......@@ -340,7 +341,11 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
[ConfigProAttribute("CompressAxis_P1_Position")]
public int CompressAxis_P1_Position { get; set; }
/// <summary>
/// PRO,,L4_压紧轴_P2压紧点范围对应值,CompAxis_P2_List,8=385001;12=383001;16=379001;
/// </summary>
[ConfigProAttribute("CompAxis_P2_List",false)]
public string CompAxis_P2_List { get; set; }
/// <summary>
/// PRO 是否使用料盘检测信号 IsUse_Tray_Check
/// </summary>
......@@ -680,8 +685,50 @@ namespace OnlineStore.LoadCSVLibrary
Config.Comp_Axis.CanErrorCountMin = 10;
Config.Comp_Axis.PositionMin = 0;
Config.Comp_Axis.PositionMax = 0;
}
}
private Dictionary<int, int> ComP2Map = null;
public int GetComP2(int plateh)
{
//查找指定的高度
analysisComP2();
if (ComP2Map.ContainsKey(plateh))
{
return ComP2Map[plateh];
}
else
return 0;
//return new List<int>(ComP2Map.Values).First<int>();
}
private void analysisComP2()
{
if (ComP2Map == null)
{
try
{
// 8=385001;424000#12=383001;385000#16=379001;
ComP2Map = new Dictionary<int, int>();
string[] arrayList = CompAxis_P2_List.Split(';');
foreach (string str in arrayList)
{
if (str.Equals(""))
{
continue;
}
string[] com2A = str.Split('=');
if (com2A.Length.Equals(2))
{
int plateH = Convert.ToInt32(com2A[0]);
int p2 = Convert.ToInt32(com2A[1]);
ComP2Map.Add(plateH, p2);
}
}
}
catch (Exception ex)
{
LogUtil.error("解析CompAxis_P2_List【" + CompAxis_P2_List + "】出错:" + ex.ToString());
}
}
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!