Commit 97edbb72 几米阳光

压紧轴,升降轴P1都根据高度改变。最后一个料盘高度需要增加补充。

1 个父辈 8c107f8f
......@@ -37,6 +37,7 @@
<add key="AxisChangeValue" value="5000" />
<!--压紧轴计量检测信号亮1次的脉冲值-->
<add key="ComAxisChangeValue" value="10000" />
<add key ="DebugPosId" value ="1#AC1_2_1_1"/>
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
......@@ -79,15 +79,22 @@ X22_气压检测:
压紧轴改为同步返回数据模式,压紧轴增加计量检测功能。
20121226
20181226
出库状态下,如果复位未开门锁,不能清理出库信息
出入库增加统计,增加气压检测功能。
出入库失败信息发个服务器
20181227
压紧轴修改
最后一盘料需要补充高度
PRO,压紧轴(轴4)P2压紧点集合,CompressAxis_P2_List,52#-10000;48#-10000,,,,,,,,,
PRO,最后一盘料需要补充的高度,LastTrayAddHeight,10,,,,,,,,,
·
入库老报警,入库的P1没有重新加载
......
......@@ -78,5 +78,7 @@ namespace OnlineStore.Common
public static string CodeRun = "CodeRun";
public static string ComAxisChangeValue = "ComAxisChangeValue";
public static string DebugPosId = "DebugPosId";
}
}
......@@ -202,5 +202,10 @@ namespace OnlineStore.Common
LogUtil.error(LOGGER, "SetValue保存配置出错:AppKey=" + AppKey + ",AppValue=" + AppValue + "," + ex.StackTrace);
}
}
public static string GetValue(object debugPosId)
{
throw new NotImplementedException();
}
}
}
......@@ -939,9 +939,9 @@ namespace OnlineStore.DeviceLibrary
//没有启动时收到复位按钮,相当于启动按钮
LogUtil.info(LOGGER, StoreName + "没有启动时收到复位按钮,相当于启动按钮,开始调用启动方法!");
bool result = StartRun();
if (result.Equals(false))
if (!result)
{
LogUtil.error("料仓启动失败,继续等待下次启动!");
LogUtil.info("料仓启动失败,继续等待下次启动!");
int isAuto = ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun);
if (isAuto == 1)
{
......@@ -1588,7 +1588,7 @@ namespace OnlineStore.DeviceLibrary
{
if (CanStarInOut())
{
StartOutStoreMove(new InOutStoreParam("", posId, position), !isSingleOut);
StartOutStoreMove(new InOutStoreParam("", posId), !isSingleOut);
}
else
{
......
......@@ -38,16 +38,12 @@ namespace OnlineStore.DeviceLibrary
{
return false;
}
int height = 24;
if (Config.Default_TrayWidth.Equals(7))
{
height = 8;
}
//加载位置
if (param.MoveP == null)
{
LineMoveP p = new LineMoveP();
AutoStorePosition position = param.GetACPosition();
AutoStorePosition position = param.GetPosition();
if (position == null)
{
LogUtil.error(LOGGER, StoreName + "出入库时发现param中取到的Position=null,没有库位不能执行出入库");
......@@ -62,12 +58,9 @@ namespace OnlineStore.DeviceLibrary
p.UpDown_OutLow_P8 = Config.UpDownAxis_OutLow_P8;
p.InOut_P2 = position.InOutAxis_Batch_P2;
p.InOut_P4 = position.InOutAxis_DoorOutPosition_P4;
//if (IsBatch)
//{
// p.InOut_P2 = position.InOutAxis_Batch_P2;
//}
p.UpDown_P1 = Config.GetUpDownP1(position.BagHeight);
p.UpDown_P1 = Config.GetUpDownP1(param.PlateH);
p.ComPress_P2 = position.CompressAxis_Position_P2;
p.ComPress_P3 = position.CompressAxis_CPosition_P3;
p.InOut_P3 = position.InOutAxis_Position_P3;
......@@ -76,22 +69,20 @@ namespace OnlineStore.DeviceLibrary
p.UpDown_P4 = position.UpDownAxis_ILPosition_P4;
p.UpDown_P5 = position.UpDownAxis_OHPosition_P5;
p.UpDown_P6 = position.UpDownAxis_OLPosition_P6;
height = position.BagHeight;
param.MoveP = p;
return true;
}
else
int com2Value = Config.GetComP2(param.PlateH);
if (com2Value.Equals(-1).Equals(false))
{
AutoStorePosition position = CSVPositionReader<AutoStorePosition>.GetPositon(param.PositionNum);
if (position != null)
{
height = position.BagHeight;
}
param.MoveP.ComPress_P2 = com2Value;
//LogUtil.debug("【" + param.PositionNum + "】高度【" + param.PlateH + "】压紧点2位置【" + param.MoveP.ComPress_P2 + "】");
}
//出库时批量上下料轴需要下降的高度
param.MoveP.BatchAxis_DownValue = AutomaticBaiting.AxisChangeValue * height + Config.BatchAxis_OutDownPosition;
LogUtil.debug("【" + param.PositionNum + "】高度【" + height + "】批量上下料轴需要下降【" + param.MoveP.BatchAxis_DownValue + "】");
param.MoveP.BatchAxis_DownValue = AutomaticBaiting.AxisChangeValue * param.PlateH + Config.BatchAxis_OutDownPosition;
//LogUtil.debug("【" + param.PositionNum + "】高度【" + param.PlateH + "】批量上下料轴需要下降【" + param.MoveP.BatchAxis_DownValue + "】");
param.MoveP.UpDown_P1 = Config.GetUpDownP1(param.PlateH);
LogUtil.info("【" + param.PositionNum + "】高【" + param.PlateH + "】升降轴P1【" + param.MoveP.UpDown_P1 + "】压紧轴P2【" + param.MoveP.ComPress_P2 + "】批量上下料轴需要下降【" + param.MoveP.BatchAxis_DownValue + "】");
return true;
}
......@@ -597,7 +588,7 @@ namespace OnlineStore.DeviceLibrary
return false;
}
}
int height = param.GetACPosition().BagHeight;
int height = param.GetPosition().BagHeight;
if (AutomaticBaiting.BatchOutStoreHeight+ height > Config.BatchAxis_MaxHeight)
{
LogUtil.error(LOGGER, StoreName + logMsg + " 出错,当前高【"+ AutomaticBaiting.BatchOutStoreHeight + "】出库料盘高【"+ height + "】,最大高【"+ Config.BatchAxis_MaxHeight + "】");
......@@ -756,7 +747,7 @@ namespace OnlineStore.DeviceLibrary
OutStoreLog("出库:SO_11_PutTray 放下料盘,升降轴到P8(出库低点),压紧轴至P3(压紧前点)");
ComMoveToPosition(StoreMove.MoveParam.MoveP.ComPress_P3,true);
ACAxisMove(Config.UpDown_Axis, StoreMove.MoveParam.MoveP.UpDown_OutLow_P8, Config.UpDownAxis_P8_Speed);
AutomaticBaiting.BatchOutStoreHeight += StoreMove.MoveParam.GetACPosition().BagHeight;
AutomaticBaiting.BatchOutStoreHeight += StoreMove.MoveParam.GetPosition().BagHeight;
AutomaticBaiting.BatchOutStoreCount++;
}
else if (KND.IOValue(IO_Type.SafetyLightCurtains).Equals(IO_VALUE.HIGH))
......
......@@ -19,7 +19,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public static int DoorStatus = 2;
private static int LastHeight = 0;
private static int LastSize = 0;
private static int LastWidth = 0;
private static string LastCode = "";
private static string LastPosId = "";
public static int AxisChangeValue = ConfigAppSettings.GetIntValue(Setting_Init.AxisChangeValue);
......@@ -102,7 +102,7 @@ namespace OnlineStore.DeviceLibrary
LastCode = "";
LastPosId = "";
LastHeight = 0;
LastSize = 0;
LastWidth = 0;
}
public static void StopRun()
......@@ -133,13 +133,13 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.info(Name + " 复位前,清理报警【" + StoreManager.Store.alarmType + "】");
StoreManager.Store.alarmType = StoreAlarmType.None;
WarnMsg = "";
}
AutomaticBaiting.IsNeedStartInout = isNeedInout;
if (!StoreMove.MoveType.Equals(StoreMoveType.None))
{
StopMove();
}
WarnMsg = "";
ClearInStoreInfo();
DoorStatus = 2;
AutoBaitingStatus = StoreRunStatus.Reset;
......@@ -289,6 +289,7 @@ namespace OnlineStore.DeviceLibrary
if (KND.IOValue(IO_Type.SuckingDisc_Air).Equals(IO_VALUE.HIGH))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I06_SuckingDisc_Up);
LogUtil.info(Name + "入料: 吸盘上升,等待宽度到达" + StoreManager.Config.Default_TrayWidth);
CylinderMove(IO_Type.SuckingDisc_Up, IO_Type.SuckingDisc_Down, true);
if (StoreManager.Config.Default_TrayWidth.Equals(7))
......@@ -323,6 +324,11 @@ namespace OnlineStore.DeviceLibrary
{
if (StoreManager.Store.CanStarInOut())
{
LastWidth = StoreManager.Config.Default_TrayWidth;
LastHeight = GetHeight();
BatchInStoreCount++;
BatchInStoreHeight += LastHeight;
if (LastCode.Equals(""))
{
LogUtil.info(Name + "入料: 未扫到二维码,将料盘送出,等待料盘拿走");
......@@ -331,11 +337,8 @@ namespace OnlineStore.DeviceLibrary
else
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I08_GetPosId);
LastSize = StoreManager.Config.Default_TrayWidth;
LastHeight = GetHeight();
BatchInStoreCount++;
BatchInStoreHeight += LastHeight;
LogUtil.info(Name + "入料: 从服务器获取入库PosId,尺寸:【" + LastSize + "*" + LastHeight + "】二维码【" + LastCode + "】");
LogUtil.info(Name + "入料: 从服务器获取入库PosId,尺寸:【" + LastWidth + "*" + LastHeight + "】二维码【" + LastCode + "】");
GetInStorePosId(ProcessMsg());
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(3000));
......@@ -389,8 +392,23 @@ namespace OnlineStore.DeviceLibrary
{
//计算高度
EndMovePosition = ACServerManager.GetActualtPosition(StoreManager.Config.Batch_Axis.DeviceName, StoreManager.Config.Batch_Axis.GetAxisValue());
if (EndMovePosition.Equals(-1))
{
EndMovePosition = ACServerManager.GetActualtPosition(StoreManager.Config.Batch_Axis.DeviceName, StoreManager.Config.Batch_Axis.GetAxisValue());
}
LastHeight = (int)Math.Ceiling(1F * (EndMovePosition - StartMovePosition) / AxisChangeValue);
LogUtil.info(Name + "入料: 计算盘高:上升前【" + StartMovePosition + "】实时【" + EndMovePosition + "】计算后高度【" + LastHeight + "】");
int addHeight = 0;
//如果检测信号未亮,极限亮了,需要补充高
if (KND.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.LOW))
{
addHeight = StoreManager.Config.LastTrayAddHeight;
}
LastHeight += addHeight;
LogUtil.info(Name + "入料: 计算盘高:上升前【" + StartMovePosition + "】实时【" + EndMovePosition + "】补充【"+addHeight+"】计算后高度【" + LastHeight + "】");
if (LastHeight < 0)
{
LastHeight = StoreManager.Config.GetDefaultHeight();
}
if (StoreManager.Config.Default_TrayWidth.Equals(7))
{
if (LastHeight <= 8) { LastHeight = 8; }
......@@ -405,15 +423,27 @@ namespace OnlineStore.DeviceLibrary
LastHeight = (int)Math.Ceiling(1F * LastHeight / 4) * 4;
}
}
return LastHeight;
}
private static List<AutoStorePosition> AllPosList = null;
private static void SendTrayOut()
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I10_WaitTrayGo);
StoreMove.TimeOutSeconds = 120;
string posId = StoreManager.Store.PositionNumList[0];
StoreManager.Store.StartInStoreMove(new InOutStoreParam("", posId), true, false);
//盘先根据高低排序
if (AllPosList == null) {
AllPosList = CSVPositionReader<AutoStorePosition>.getPositionList();
AllPosList = (from m in AllPosList orderby m.BagHeight ascending select m).ToList<AutoStorePosition>();
}
List<AutoStorePosition> okList = (from m in AllPosList where m.BagHeight >= LastHeight select m ).ToList<AutoStorePosition>();
if (okList.Count > 0)
{
posId = okList[0].PositionNum;
}
StoreManager.Store.StartInStoreMove(new InOutStoreParam(LastCode, posId,LastHeight,LastWidth), true, false);
StoreMove.WaitList.Add(WaitResultInfo.WaitStoreRuning());
}
......@@ -432,7 +462,7 @@ namespace OnlineStore.DeviceLibrary
{
LastCode = "";
LastHeight = 0;
LastSize = 0;
LastWidth = 0;
LastPosId = "";
SuckingDisc_WorkCount = 0;
//如果有超时异常,需要清理
......
......@@ -368,31 +368,14 @@ namespace OnlineStore.DeviceLibrary
msg = "";
string deviceName = moveAxis.DeviceName;
short axisNo = moveAxis.GetAxisValue();
////如果是进出轴,并且光栅被遮挡,直接返回false
//if (NeedCheckSafetyLight.Equals(2))
//{
// if (StoreMove.MoveStep.Equals(StoreMoveStep.SO_10_DeviceToDoor) ||
// StoreMove.MoveStep.Equals(StoreMoveStep.SI_04_DeviceToDoor))
// {
// return false;
// }
//}
bool isOk = ACServerManager.GetBusyStatus(deviceName, axisNo).Equals(0);
int outCount = ACServerManager.GetActualtPosition(deviceName, axisNo);
int errorCount = Math.Abs(outCount - targetPosition);
if (isOk)
{
if (errorCount > moveAxis.CanErrorCountMax)
{
//if (NeedCheckSafetyLight.Equals(2))
//{
// if (StoreMove.MoveStep.Equals(StoreMoveStep.SO_10_DeviceToDoor) ||
// StoreMove.MoveStep.Equals(StoreMoveStep.SI_04_DeviceToDoor))
// {
// return false;
// }
//}
{
//判断是否需要重新运动
if (StoreMove.CanWhileCount > 0)
{
......
......@@ -34,8 +34,9 @@ namespace OnlineStore.DeviceLibrary
PositionNum = posId;
MoveP = null;
IsSolderPaste = false;
SetSize();
}
public InOutStoreParam(string wareNo, string posId,string plateH,string plateW)
public InOutStoreParam(string wareNo, string posId, int plateH, int plateW)
{
ACStoreP = null;
WareNumber = wareNo;
......@@ -45,17 +46,17 @@ namespace OnlineStore.DeviceLibrary
this.PlateH = plateH;
IsSolderPaste = false;
}
public InOutStoreParam(string wareNo, string posId, string plateH, string plateW,int trayCode)
{
ACStoreP = null;
WareNumber = wareNo;
PositionNum = posId;
MoveP = null;
this.PlagtW = plateW;
this.PlateH = plateH;
this.TrayCode = trayCode;
IsSolderPaste = false;
}
//public InOutStoreParam(string wareNo, string posId, int plateH, int plateW,int trayCode)
//{
// ACStoreP = null;
// WareNumber = wareNo;
// PositionNum = posId;
// MoveP = null;
// this.PlagtW = plateW;
// this.PlateH = plateH;
// this.TrayCode = trayCode;
// IsSolderPaste = false;
//}
public InOutStoreParam(string wareNo, string posId, LineMoveP linePosition)
{
......@@ -64,19 +65,33 @@ namespace OnlineStore.DeviceLibrary
PositionNum = posId;
MoveP = linePosition;
IsSolderPaste = false;
SetSize();
}
public InOutStoreParam(string wareNo, string posId, AutoStorePosition movep)
//public InOutStoreParam(string wareNo, string posId, AutoStorePosition movep)
//{
// ACStoreP = movep;
// WareNumber = wareNo;
// PositionNum = posId;
// MoveP = null;
// IsSolderPaste = false;
//}
public void SetSize()
{
ACStoreP = movep;
WareNumber = wareNo;
PositionNum = posId;
MoveP = null;
IsSolderPaste = false;
AutoStorePosition position = CSVPositionReader<AutoStorePosition>.GetPositon(PositionNum);
if (!(position == null))
{
this.PlateH = position.BagHeight;
this.PlagtW = position.BagWidth;
}
else
{
this.PlagtW = StoreManager.Config.Default_TrayWidth;
this.PlateH = StoreManager.Config.GetDefaultHeight();
}
}
private AutoStorePosition ACStoreP = null;
public AutoStorePosition GetACPosition()
public AutoStorePosition GetPosition()
{
try
{
......@@ -109,11 +124,11 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 料盘高度
/// </summary>
public string PlateH { get; set; }
public int PlateH { get; set; }
/// <summary>
/// 料盘宽度
/// </summary>
public string PlagtW { get; set; }
public int PlagtW { get; set; }
/// <summary>
/// 是否是放入锡膏(在线料仓才需要此字段)
/// </summary>
......
using System;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
......@@ -17,16 +18,29 @@ namespace OnlineStore.DeviceLibrary
this.TrayCode = trayCode;
this.WareNum = wareNum;
this.PosId = posId;
this.plateH = "";
this.plateW = "";
SetSize();
}
public FixtureCodeInfo(int trayCode, string wareNum, string posId,string platew,string plateh)
//public FixtureCodeInfo(int trayCode, string wareNum, string posId,int platew, int plateh)
//{
// this.TrayCode = trayCode;
// this.WareNum = wareNum;
// this.PosId = posId;
// this.plateW = platew;
// this.plateH = plateh;
//}
public void SetSize()
{
this.TrayCode = trayCode;
this.WareNum = wareNum;
this.PosId = posId;
this.plateW = platew;
this.plateH = plateh;
AutoStorePosition position = CSVPositionReader<AutoStorePosition>.GetPositon(PosId);
if (!(position == null))
{
this.plateH = position.BagHeight;
this.plateW = position.BagWidth;
}
else
{
this.plateW = StoreManager.Config.Default_TrayWidth;
this.plateH = StoreManager.Config.GetDefaultHeight();
}
}
/// <summary>
/// 夹具编码值(1-6)
......@@ -43,11 +57,11 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 料盘宽
/// </summary>
public string plateW { get; set; }
public int plateW { get; set; }
/// <summary>
/// 料盘高
/// </summary>
public string plateH { get; set; }
public int plateH { get; set; }
public string ToStr()
......
......@@ -352,6 +352,11 @@ namespace OnlineStore.LoadCSVLibrary
public int CompressAxis_P1_Position { get; set; }
/// <summary>
/// PRO,压紧轴(轴4)P2压紧点集合,CompressAxis_P2_List,52#-10000;48#-10000,,,,,,,,,
/// </summary>
[ConfigProAttribute("CompressAxis_P2_List")]
public string CompressAxis_P2_List { get; set; }
/// <summary>
/// PRO 是否使用料盘检测信号 IsUse_Tray_Check
/// </summary>
[ConfigProAttribute("IsUse_Tray_Check")]
......@@ -594,11 +599,73 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("IO_DOLength")]
public string IO_DOLength { get; set; }
/// <summary>
/// PRO,最后一盘料需要补充的高度,LastTrayAddHeight,10,,,,,,,,,
/// </summary>
[ConfigProAttribute("LastTrayAddHeight")]
public int LastTrayAddHeight { get; set; }
private Dictionary<string, ushort> DILengthMap = null;
private Dictionary<string, ushort> DOLengthMap = null;
private Dictionary<int, int> ComP2Map = null;
public int GetComP2(int trayHeight)
{
try
{
if (ComP2Map == null)
{
ComP2Map = new Dictionary<int, int>();
string[] arrayList = CompressAxis_P2_List.Split(';');
foreach (string str in arrayList)
{
string[] arrStr = str.Split('#');
if (arrStr.Length == 2)
{
int ioip = Convert.ToInt32(arrStr[0]);
int length = Convert.ToInt32(arrStr[1]);
ComP2Map.Add(ioip, length);
}
}
}
}
catch (Exception ex)
{
}
if (ComP2Map.ContainsKey(trayHeight))
{
return ComP2Map[trayHeight];
}
else
{
LogUtil.error("未找到料盘高度为【" + trayHeight + "】的压紧轴P2");
return -1;
}
}
public void UpdateComP2(int height, int value)
{
int oldP1 = GetComP2(height);
if (!oldP1.Equals(value))
{
if (ComP2Map.ContainsKey(height))
{
ComP2Map[height] = value;
}
else
{
ComP2Map.Add(height, value);
}
}
string msg = "";
foreach (int key in ComP2Map.Keys)
{
msg += key + "#" + ComP2Map[key] + ";";
}
this.CompressAxis_P2_List = msg;
}
private Dictionary<int, int> UpDownAxisP1Map = null;
public int GetUpDownP1(int trayHeight)
{
......@@ -630,11 +697,12 @@ namespace OnlineStore.LoadCSVLibrary
}
else
{
LogUtil.error("未找到料盘高度为【"+trayHeight+"】的升降轴P1");
LogUtil.error("未找到料盘高度为【"+trayHeight+"】的升降轴P1,查找最大高度的P1");
if (UpDownAxisP1Map.Count > 0)
{
List<int> list = new List<int>(UpDownAxisP1Map.Values);
return list[0];
List<int> list = new List<int>(UpDownAxisP1Map.Keys);
list = (from m in list orderby m descending select m).ToList<int>();
return UpDownAxisP1Map[list[0]];
}
}
......@@ -662,8 +730,18 @@ namespace OnlineStore.LoadCSVLibrary
this.UpDownAxis_P1_List = msg;
}
public int GetDefaultUpDownP1()
{
return GetUpDownP1(GetDefaultHeight());
}
public int GetDefaultHeight()
{
return GetUpDownP1(8);
int defaultH = 8;
if (Default_TrayWidth.Equals(13))
{
defaultH = 40;
}
return defaultH;
}
public ushort GetDILength(string ip)
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!