Commit 9aac7466 张东亮

紧急料和工单混合、出库压紧轴张开问题

1 个父辈 7af92bf5
此文件的差异太大,无法显示。
...@@ -18,6 +18,7 @@ using System.IO.Ports; ...@@ -18,6 +18,7 @@ using System.IO.Ports;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using CodeLibrary; using CodeLibrary;
using System.Security.Cryptography; using System.Security.Cryptography;
using HalconDotNet;
namespace OnlineStore.ACPackingStore namespace OnlineStore.ACPackingStore
{ {
...@@ -39,6 +40,7 @@ namespace OnlineStore.ACPackingStore ...@@ -39,6 +40,7 @@ namespace OnlineStore.ACPackingStore
{ {
btnCMove.Tag = 0; btnCMove.Tag = 0;
cmbPlateH.Items.Clear(); cmbPlateH.Items.Clear();
cmbPosPlateH.Items.Clear();
//for (int i = 8; i <= 48; i = i + 4) //for (int i = 8; i <= 48; i = i + 4)
//{ //{
// cmbPlateH.Items.Add(i.ToString()); // cmbPlateH.Items.Add(i.ToString());
...@@ -47,6 +49,12 @@ namespace OnlineStore.ACPackingStore ...@@ -47,6 +49,12 @@ namespace OnlineStore.ACPackingStore
{ {
cmbPlateH.Items.Add(item); cmbPlateH.Items.Add(item);
} }
foreach (var item in BoxBean.Config.GetComP3AllHeights())
{
cmbPosPlateH.Items.Add(item);
}
if (cmbPosPlateH.Items.Count > 0)
cmbPosPlateH.SelectedIndex = 0;
if (cmbPlateH.Items.Count > 0) if (cmbPlateH.Items.Count > 0)
cmbPlateH.SelectedIndex = 0; cmbPlateH.SelectedIndex = 0;
LoadStore(); LoadStore();
...@@ -1110,5 +1118,88 @@ namespace OnlineStore.ACPackingStore ...@@ -1110,5 +1118,88 @@ namespace OnlineStore.ACPackingStore
{ {
BoxBean.IsScanCodeWithLockedShelf = chbLockedShelf.Checked; BoxBean.IsScanCodeWithLockedShelf = chbLockedShelf.Checked;
} }
private void cmbPosPlateH_SelectedIndexChanged(object sender, EventArgs e)
{
if (cmbPosPlateH.SelectedIndex >= 0)
{
int height = Convert.ToInt32(cmbPosPlateH.Text);
ComP2Info p2Info = BoxBean.Config.GetComP3(height);
if (p2Info == (null))
{
txtPosComP3.Text = 0.ToString();
btnCMoveP3.Text = height + "mm库位压紧前点P3:" + 0;
btnCMoveP3.Tag = 0;
}
else
{
txtPosComP3.Text = p2Info.MaxComP.ToString();
btnCMoveP3.Text = height + "mm库位压紧前点P3:" + p2Info.TargetComP2();
btnCMoveP3.Tag = p2Info.TargetComP2();
}
}
}
private void btnSaveComP3_Click(object sender, EventArgs e)
{
if (cmbPosPlateH.SelectedIndex >= 0)
{
int height = Convert.ToInt32(cmbPosPlateH.Text);
int minValue = FormUtil.GetIntValue(txtPosComP3);
int maxValue = FormUtil.GetIntValue(txtPosComP3);
ComP2Info p2Info = new ComP2Info(height, minValue, maxValue);
if (minValue > BoxBean.Config.CompAxis_P1_Position && maxValue > BoxBean.Config.CompAxis_P1_Position)
{
}
else
{
MessageBox.Show("保存失败:" + " 盘高【" + height + "】范围【" + minValue + "~" + maxValue + "】无效,压紧前点需大于待机点【" + BoxBean.Config.CompAxis_P1_Position + "】");
return;
}
BoxBean.Config.UpdateComP3(height, p2Info);
if (StoreManager.UpdateBoxConfig(BoxBean.Config))
{
LogUtil.info(BoxBean.Name + "更新库位压紧前点ComP3【 " + BoxBean.Config.CompAxis_P3_List + "】");
}
else
{
MessageBox.Show("保存失败");
}
}
}
private void btnCMoveP3_Click(object sender, EventArgs e)
{
int value = Convert.ToInt32(btnCMoveP3.Tag);
if (value > 0)
{
AxisABSMove(BoxBean.Config.Comp_Axis, value, BoxBean.Config.CompAxis_P3_Speed);
}
}
private void txtPosComP3_TextChanged(object sender, EventArgs e)
{
if (cmbPosPlateH.SelectedIndex >= 0)
{
int height = Convert.ToInt32(cmbPosPlateH.Text);
ComP2Info p2Info = BoxBean.Config.GetComP3(height);
if (p2Info == (null))
{
txtPosComP3.Text = 0.ToString();
btnCMoveP3.Text = height + "mm库位压紧前点P3:" + 0;
btnCMoveP3.Tag = 0;
}
else
{
txtPosComP3.Text = p2Info.MaxComP.ToString();
btnCMoveP3.Text = height + "mm库位压紧前点P3:" + p2Info.TargetComP2();
btnCMoveP3.Tag = p2Info.TargetComP2();
}
}
}
} }
} }
...@@ -211,7 +211,7 @@ namespace OnlineStore.Common ...@@ -211,7 +211,7 @@ namespace OnlineStore.Common
if (_serialPort.IsOpen) if (_serialPort.IsOpen)
{ {
//lock (lockObj) //lock (lockObj)
if(Monitor.TryEnter(lockObj,100)) if(Monitor.TryEnter(lockObj,800))
{ {
//Monitor.Enter(lockObj); //Monitor.Enter(lockObj);
try try
......
using Asa; using Asa;
using CodeLibrary;
using log4net.Core; using log4net.Core;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
...@@ -63,6 +64,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -63,6 +64,8 @@ namespace OnlineStore.DeviceLibrary
private void SO_03_ToBagPosition() private void SO_03_ToBagPosition()
{ {
ACBoxPosition position = CSVPositionReader<ACBoxPosition>.GetPositon(MoveInfo.MoveParam.PosID);
MoveInfo.MoveParam.MoveP.ComPress_P3 = Config.GetComP3(position.BagHigh).MaxComP;
LineMoveP movep = MoveInfo.MoveParam.MoveP; LineMoveP movep = MoveInfo.MoveParam.MoveP;
MoveInfo.NextMoveStep(StoreMoveStep.SO_03_ToPosition); MoveInfo.NextMoveStep(StoreMoveStep.SO_03_ToPosition);
InOutStoreLog("走到库位,压紧轴至P3[" + movep.ComPress_P3 + "] ,旋转轴至P2[" + movep.Middle_P2 + "],升降轴至P5[" + movep.UpDown_P5 + "] ,顶升上升"); InOutStoreLog("走到库位,压紧轴至P3[" + movep.ComPress_P3 + "] ,旋转轴至P2[" + movep.Middle_P2 + "],升降轴至P5[" + movep.UpDown_P5 + "] ,顶升上升");
...@@ -240,9 +243,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -240,9 +243,10 @@ namespace OnlineStore.DeviceLibrary
int targetP = currPosition + Config.CompAxis_Down_Position; int targetP = currPosition + Config.CompAxis_Down_Position;
LastHeight = Config.GetComP2PlateH(targetP); LastHeight = Config.GetComP2PlateH(targetP);
MoveInfo.MoveParam.MoveP.ComPress_P2 = targetP; MoveInfo.MoveParam.MoveP.ComPress_P2 = targetP;
MoveInfo.MoveParam.MoveP.ComPress_P3 = targetP + Config.CompAxis_P3_P2_Value; ACBoxPosition position = CSVPositionReader<ACBoxPosition>.GetPositon(MoveInfo.MoveParam.PosID);
MoveInfo.MoveParam.MoveP.ComPress_P3 = Config.GetComP3(position.BagHigh).MaxComP;
InOutStoreLog("料架取料,检测到Compress_Check,盘高【" + LastHeight + "】,向下压紧 [" + Config.CompAxis_Down_Position + "] 目标 [" + targetP + InOutStoreLog("料架取料,检测到Compress_Check,盘高【" + LastHeight + "】,向下压紧 [" + Config.CompAxis_Down_Position + "] 目标 [" + targetP +
"]记录ComP2[" + targetP + "]ComP3[" + MoveInfo.MoveParam.MoveP.ComPress_P3 + "]"); "]记录ComP2[" + targetP + "]");
ACAxisMove(Config.Comp_Axis, targetP, Config.CompAxis_P1_Speed); ACAxisMove(Config.Comp_Axis, targetP, Config.CompAxis_P1_Speed);
...@@ -706,9 +710,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -706,9 +710,18 @@ namespace OnlineStore.DeviceLibrary
} }
if(string.IsNullOrEmpty(StoreManager.FindRealRfidByTempRfid(xuniId))) if(string.IsNullOrEmpty(StoreManager.FindRealRfidByTempRfid(xuniId)))
{ {
StoreManager.findTempRfid("IsRightShelfId", curShelfId, out string tmpRfid);
if(string.IsNullOrEmpty (tmpRfid) )
{
LogRunStepInfo($"当前虚拟rfid={xuniId}未出库,可以使用{curShelfId}出库"); LogRunStepInfo($"当前虚拟rfid={xuniId}未出库,可以使用{curShelfId}出库");
return true; return true;
} }
else
{
LogRunStepInfo($"当前虚拟rfid={xuniId}未出库,{curShelfId}与{tmpRfid}绑定,无法出库");
return false;
}
}
return false; return false;
} }
//private void SO_06_StartCompress() //private void SO_06_StartCompress()
......
...@@ -65,6 +65,7 @@ PRO,压紧轴(轴4)非七寸盘压紧前点相对压紧点的位置,CompAxis_P3_P2_Value,-90000,,, ...@@ -65,6 +65,7 @@ PRO,压紧轴(轴4)非七寸盘压紧前点相对压紧点的位置,CompAxis_P3_P2_Value,-90000,,,
PRO,压紧轴(轴4)七寸盘压紧前点相对压紧点的位置,CompAxis7_P3_P2_Value,-50000,,,,,,, PRO,压紧轴(轴4)七寸盘压紧前点相对压紧点的位置,CompAxis7_P3_P2_Value,-50000,,,,,,,
PRO,压紧轴(轴4)压紧确认信号收到之后下降的位置,CompAxis_Down_Position,77500,,,,,,, PRO,压紧轴(轴4)压紧确认信号收到之后下降的位置,CompAxis_Down_Position,77500,,,,,,,
PRO,压紧轴(轴4)P2压紧点范围对应值(8=1000;2000#),CompAxis_P2_List,8=385001;424000#12=383001;385000#16=379001;383000#24=360001;368000#32=315001;330000#48=200000;231560#20=368001;379000#28=330001;360000#36=298001;315000#40=256101;298000#44=231561;256100#,,,,,,, PRO,压紧轴(轴4)P2压紧点范围对应值(8=1000;2000#),CompAxis_P2_List,8=385001;424000#12=383001;385000#16=379001;383000#24=360001;368000#32=315001;330000#48=200000;231560#20=368001;379000#28=330001;360000#36=298001;315000#40=256101;298000#44=231561;256100#,,,,,,,
PRO,压紧轴(轴4)P3库位压紧前点对应值,CompAxis_P3_List,8=385001#12=383001#16=379001#24=360001#32=315001,,,,,,,
,,,,,,,,,, ,,,,,,,,,,
PRO,(轴一)旋转轴目标速度,MiddleAxis_TargetSpeed,250,,,,,,, PRO,(轴一)旋转轴目标速度,MiddleAxis_TargetSpeed,250,,,,,,,
PRO,(轴一)旋转轴加速度,MiddleAxis_AddSpeed,1000,,,,,,, PRO,(轴一)旋转轴加速度,MiddleAxis_AddSpeed,1000,,,,,,,
......
...@@ -64,6 +64,7 @@ PRO,压紧轴(轴4)非七寸盘压紧前点相对压紧点的位置,CompAxis_P3_P2_Value,-100000,, ...@@ -64,6 +64,7 @@ PRO,压紧轴(轴4)非七寸盘压紧前点相对压紧点的位置,CompAxis_P3_P2_Value,-100000,,
PRO,压紧轴(轴4)七寸盘压紧前点相对压紧点的位置,CompAxis7_P3_P2_Value,-50000,,,,,,, PRO,压紧轴(轴4)七寸盘压紧前点相对压紧点的位置,CompAxis7_P3_P2_Value,-50000,,,,,,,
PRO,压紧轴(轴4)压紧确认信号收到之后下降的位置,CompAxis_Down_Position,81000,,,,,,, PRO,压紧轴(轴4)压紧确认信号收到之后下降的位置,CompAxis_Down_Position,81000,,,,,,,
PRO,压紧轴(轴4)P2压紧点范围对应值(8=1000;2000#),CompAxis_P2_List,8=419201;421200#12=384501;419200#16=379501;384500#24=358001;366000#32=308001;318000#48=200000;234000#44=234001;274000#40=274001;287500#36=287501;308000#28=318001;358000#20=366001;379500#,,,,,,, PRO,压紧轴(轴4)P2压紧点范围对应值(8=1000;2000#),CompAxis_P2_List,8=419201;421200#12=384501;419200#16=379501;384500#24=358001;366000#32=308001;318000#48=200000;234000#44=234001;274000#40=274001;287500#36=287501;308000#28=318001;358000#20=366001;379500#,,,,,,,
PRO,压紧轴(轴4)P3库位压紧前点对应值,CompAxis_P3_List,8=385001#12=383001#16=379001#24=360001#32=315001,,,,,,,
,,,,,,,,,, ,,,,,,,,,,
PRO,(轴一)旋转轴目标速度,MiddleAxis_TargetSpeed,250,,,,,,, PRO,(轴一)旋转轴目标速度,MiddleAxis_TargetSpeed,250,,,,,,,
PRO,(轴一)旋转轴加速度,MiddleAxis_AddSpeed,1000,,,,,,, PRO,(轴一)旋转轴加速度,MiddleAxis_AddSpeed,1000,,,,,,,
......
using System; using OnlineStore.Common;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
...@@ -549,7 +550,11 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -549,7 +550,11 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary> /// </summary>
[ConfigProAttribute("CompAxis_P2_List")] [ConfigProAttribute("CompAxis_P2_List")]
public string CompAxis_P2_List { get; set; } public string CompAxis_P2_List { get; set; }
/// <summary>
/// PRO,压紧轴(轴4)P3库位压紧前点对应值,CompAxis_P3_List,8=385001#12=383001#16=379001#24=360001#32=315001,,,,,,,
/// </summary>
[ConfigProAttribute("CompAxis_P3_List")]
public string CompAxis_P3_List { get; set; }
/// <summary> /// <summary>
/// PRO,压紧轴(轴4)P3最大压紧前点,CompAxis_Max_P3,10000,,,,,,, /// PRO,压紧轴(轴4)P3最大压紧前点,CompAxis_Max_P3,10000,,,,,,,
...@@ -563,6 +568,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -563,6 +568,7 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("All_CIDs")] [ConfigProAttribute("All_CIDs")]
public string All_CIDs { get; set; } public string All_CIDs { get; set; }
private List< ComP2Info> ComP2List = null; private List< ComP2Info> ComP2List = null;
private List<ComP2Info> ComP3List = null;
public ComP2Info GetComP2(int plateh) public ComP2Info GetComP2(int plateh)
{ {
//查找指定的高度 //查找指定的高度
...@@ -583,6 +589,27 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -583,6 +589,27 @@ namespace OnlineStore.LoadCSVLibrary
} }
return new ComP2Info(plateh, CompAxis_P4_Position, CompAxis_P4_Position+CompAxis_Down_Position); return new ComP2Info(plateh, CompAxis_P4_Position, CompAxis_P4_Position+CompAxis_Down_Position);
} }
public ComP2Info GetComP3(int plateh)
{
//查找指定的高度
analysisComP3();
List<ComP2Info> list = (from m in ComP3List where m.PlateH.Equals(plateh) select m).ToList<ComP2Info>();
if (list.Count > 0)
{
return list[0];
}
//查找类似的高度
list = (from com in ComP3List orderby com.PlateH descending select com).ToList<ComP2Info>();
foreach (ComP2Info comp2 in list)
{
if (plateh >= comp2.PlateH)
{
return comp2;
}
}
LogUtil.LOGGER.Warn($"未查询到指定高度={plateh}的脉冲,使用P3最大压紧前点");
return new ComP2Info(plateh, CompAxis_Max_P3, CompAxis_Max_P3);
}
public List<int> GetComP2AllHeights() public List<int> GetComP2AllHeights()
{ {
analysisComP2(); analysisComP2();
...@@ -593,6 +620,16 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -593,6 +620,16 @@ namespace OnlineStore.LoadCSVLibrary
} }
return list; return list;
} }
public List<int> GetComP3AllHeights()
{
analysisComP3();
List<int> list = new List<int>();
foreach (var item in ComP3List)
{
list.Add(item.PlateH);
}
return list;
}
public int GetComP2PlateH(int currP) public int GetComP2PlateH(int currP)
{ {
analysisComP2(); analysisComP2();
...@@ -647,10 +684,39 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -647,10 +684,39 @@ namespace OnlineStore.LoadCSVLibrary
} }
CompAxis_P2_List = tt; CompAxis_P2_List = tt;
} }
public void UpdateComP3(int height, ComP2Info p2Info)
{
analysisComP3();
bool isUpdate = false;
foreach (ComP2Info p in ComP3List)
{
if (p.PlateH.Equals(height))
{
p.MinComP = p2Info.MinComP;
p.MaxComP = p2Info.MaxComP;
isUpdate = true;
}
}
if (!isUpdate)
{
ComP3List.Add(p2Info);
}
string tt = "";
foreach (ComP2Info p in ComP3List)
{
tt += ComP3InfoToStr(p);
}
CompAxis_P3_List = tt;
}
private string ComP2InfoToStr(ComP2Info p2) private string ComP2InfoToStr(ComP2Info p2)
{ {
return p2.PlateH + "=" + p2.MinComP + ";" + p2.MaxComP + "#"; return p2.PlateH + "=" + p2.MinComP + ";" + p2.MaxComP + "#";
} }
private string ComP3InfoToStr(ComP2Info p2)
{
return p2.PlateH + "=" + p2.MinComP+"#";
}
private void analysisComP2() private void analysisComP2()
{ {
if (ComP2List == null) if (ComP2List == null)
...@@ -693,7 +759,45 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -693,7 +759,45 @@ namespace OnlineStore.LoadCSVLibrary
} }
} }
} }
private void analysisComP3()
{
if (ComP3List == null)
{
try
{
// 8 = 1000#12=2001#16=3001#20=4001#22=5001#24=6001
ComP3List = new List<ComP2Info>();
string[] arrayList = CompAxis_P3_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 maxP = Convert.ToInt32(com2A[1]);
int minP = Convert.ToInt32(com2A[1]);
if (minP > CompAxis_P1_Position && maxP > CompAxis_P1_Position)
{
ComP3List.Add(new ComP2Info(plateH, minP, maxP));
LOGGER.Info($"添加库位P3前点参数{plateH}={maxP}");
}
else
{
LOGGER.Error(DeviceID + "压紧轴库位P3 盘高【" + plateH + "】范围【" + minP + "~" + maxP + "】无效,位置小于待机点P1【" + CompAxis_P1_Position + "】");
}
}
}
}
catch (Exception ex)
{
LOGGER.Error("解析CompAxis_P3_List【" + CompAxis_P2_List + "】出错:" + ex.ToString());
}
}
}
public List<string> GetCameraList() public List<string> GetCameraList()
{ {
if (CameraList == null) if (CameraList == null)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!