Commit 9734331e 张东亮

入库高度计算逻辑更改

1 个父辈 20bd8c63
......@@ -3,7 +3,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OnlineStore.Common
{
......@@ -18,8 +18,8 @@ namespace OnlineStore.Common
/// <summary>
/// 系统主界面标题
/// </summary>
public static string App_Title = "App_Title";
public static string App_Title = "App_Title";
/// <summary>
/// 摄像机名称
/// </summary>
......@@ -38,11 +38,30 @@ namespace OnlineStore.Common
public static string FixBuffInfo = "FixBuffInfo";
[MyConfigComment("进出轴运动负载阈值")]
public static MyConfig<float> Device_InOutMaxLoadRate=50;
public static MyConfig<float> Device_InOutMaxLoadRate = 50;
[MyConfigComment("管理员密码")]
public static MyConfig<string> User_AdminPassword = "123456";
[MyConfigComment("启用管理员密码")]
public static MyConfig<bool> User_Enable = false;
#region 料盘高度计算参数
[MyConfigComment("启用自定义厚度计算策略")]
public static MyConfig<bool> Switch_UseCustHeightList = true;
/// <summary>
/// 宽度15料盘,厚度自减mm
/// </summary>
[MyConfigComment("宽度15料盘,厚度自减mm")]
public static MyConfig<int> Param_CalHeight_Width15HeightSubVal = 2;
/// <summary>
/// 宽度13料盘,厚度自减mm
/// </summary>
[MyConfigComment("宽度13料盘,厚度自减mm")]
public static MyConfig<int> Param_CalHeight_Width13HeightSubVal = 1;
[MyConfigComment("如果计算出的厚度小于指定值,都归类为8mm")]
public static MyConfig<int> Param_CalHeight_Height8MaxVal = 12;
[MyConfigComment("自定义厚度列表")]
public static MyConfig<string[]> Param_CalHeight_HeightList = new string[] { "12=12#16", "16=16#24", "24=24#32", "32=32#44", "44=44#56", "56=56#60" };
#endregion
}
}
......@@ -160,6 +160,7 @@ namespace DeviceLibrary
var DelSpeed = Config.DelSpeed > 0 ? Config.DelSpeed : targetSpeed * 4;
AxisManager.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPosition, targetSpeed, AddSpeed, DelSpeed);// Config.AddSpeed, Config.DelSpeed);
}
LogUtil.info(AxisName + $" AbsMove:{targetPosition},{targetSpeed}");
}
public void SpeedMove(int targetSpeed)
......
......@@ -646,11 +646,11 @@ namespace DeviceLibrary
//ok = false;
StringDoorSuddenStop();
}
//else if (!lastStringSafetyStatus)
//{
// StringDoor.ResumeSingle();
// lastStringSafetyStatus = true;
//}
else if (!lastStringDoorSafetyStatus)
{
// StringDoor.ResumeSingle();
lastStringDoorSafetyStatus = true;
}
}
if (!ConfigHelper.Config.Get("Device_Disable_DoorSafeCheck", false))
{
......@@ -711,9 +711,10 @@ namespace DeviceLibrary
}
}
}
bool lastStringDoorSafetyStatus=true;
void StringDoorSuddenStop()
{
//if (lastSafeCheckStatus)
if (lastStringDoorSafetyStatus)
{
AxisBean axis = StringDoor.axisBean;
AxisBean.StopMultiAxis(new List<AxisBean> { axis });
......@@ -723,6 +724,7 @@ namespace DeviceLibrary
{
ResetMoveInfo.NewMove(MoveStep.H01_HomeReset);
}
lastStringDoorSafetyStatus=false;
}
}
/// <summary>
......
......@@ -104,9 +104,9 @@ namespace DeviceLibrary
break;
case MoveStep.ReelClamp_04:
ClampMoveInfo.NextMoveStep(MoveStep.ReelClamp_05);
ClampMoveInfo.log($"关闭翻板门,检测盘宽");
//CylinderMove(ClampMoveInfo, IO_Type.StringPosChecker_Home, IO_Type.StringPosChecker_Work, IO_VALUE.HIGH);
ClampMoveInfo.MoveParam.PlateW = GetWidth();
ClampMoveInfo.log($"关闭翻板门,检测盘宽={ClampMoveInfo.MoveParam.PlateW}");
CloseFlipDoor(ClampMoveInfo);
break;
case MoveStep.ReelClamp_05:
......@@ -122,8 +122,8 @@ namespace DeviceLibrary
else
{
ClampErrorCount = 0;
ReelGetted();
ClampMoveInfo.log($"检测到盘,盘宽:{ClampMoveInfo.MoveParam.PlateW},通知料串料已取走");
ReelGetted();
}
break;
case MoveStep.ReelClamp_WaitGaugeHeight:
......
......@@ -217,7 +217,7 @@ namespace DeviceLibrary
StringState = StringStateE.OutStore;
if (ConfigHelper.Config.Get("Device_String_StandbyAtBottom", true) && OutStoreJobList.Count == 0 && ServerCM.queueTaskCount <= 0 && boxTransport.IsComplateOrFree)
{
SetReelHeight(GetHeight(StringMoveInfo));
SetReelHeight(GetHeight(ClampMoveInfo));
StringMoveInfo.log($"当前空料串, 并且没有出库任务, 料串下降待机");
StringMoveInfo.NextMoveStep(MoveStep.StringOut_01);
}
......@@ -572,6 +572,9 @@ namespace DeviceLibrary
string LastCode = "";
private int GetHeight(MoveInfo moveInfo)
{
int w15SubVal = Setting_Init.Param_CalHeight_Width15HeightSubVal;
int w13SubVal = Setting_Init.Param_CalHeight_Width13HeightSubVal;
int w8MaxVal = Setting_Init.Param_CalHeight_Height8MaxVal;
int LastHeight = 0;
int AxisChangeValue = Config.Batch_PoToMM;
//计算高度
......@@ -579,6 +582,8 @@ namespace DeviceLibrary
StartMovePosition += RealPulse;
float height = (float)Math.Ceiling(1F * Math.Abs(EndMovePosition - StartMovePosition) / AxisChangeValue);
string buchongStr = "";
string prefix = $"料盘高度计算({moveInfo.Name})--";
LogUtil.info($"{prefix}计算的原始厚度 {height}mm");
if (Batch_Axis.IsInPosition(Config.Batch_P2))
{
buchongStr = $"(最后一盘料已补充{Config.LastTrayAddHeight})";
......@@ -586,38 +591,95 @@ namespace DeviceLibrary
}
if (moveInfo.MoveParam.PlateW == 15)
{
height -= 2;
height -= w15SubVal;
LogUtil.info($"{prefix}宽度15料盘,厚度自减{w15SubVal}mm");
}
else if (moveInfo.MoveParam.PlateW == 13)
{
height -= 1;
height -= w13SubVal;
LogUtil.info($"{prefix}宽度13料盘,厚度自减{w13SubVal}mm");
}
//如果检测出<=15,都按照8计算
if (height < 12)
else
{
LogUtil.info($"{prefix}宽度为{moveInfo.MoveParam.PlateW}mm");
}
if (height < w8MaxVal)
{
LastHeight = 8;
LogUtil.info($"{prefix}计算出的厚度小于{w8MaxVal},认为是8mm料盘");
}
else
{
List<int> heightList = new List<int> { 8, 12, 16, 24, 32, 44, 56 };
float minCha = float.MaxValue;
foreach (int h in heightList)
if (Setting_Init.Switch_UseCustHeightList)
{
float curCha = Math.Abs(height - h);
if (curCha < minCha)
try
{
LastHeight = h;
minCha = curCha;
string[] heights = Setting_Init.Param_CalHeight_HeightList;
foreach (var item in heights)
{
string[] s1 = item.Split('=');
int curHeight;
int min, max;
curHeight = int.Parse(s1[0]);
string[] s2 = s1[1].Split('#');
min = int.Parse(s2[0]);
max = int.Parse(s2[1]);
if (height >= min && height < max)
{
LastHeight = curHeight;
break;
}
}
}
catch (Exception e)
{
LogUtil.error($"{prefix}使用自定义高度列表异常", e);
List<int> heightList = new List<int> { 8, 12, 16, 24, 32, 44, 56 };
float minCha = float.MaxValue;
foreach (int h in heightList)
{
float curCha = Math.Abs(height - h);
if (curCha < minCha)
{
LastHeight = h;
minCha = curCha;
}
}
// List<int> heightList = new List<int> { 8, 12, 16, 24, 32, 44, 56 };
// foreach (int h in heightList)
// {
// if (height > h)
// {
// LastHeight = h;
// }
// }
}
}
else
{
List<int> heightList = new List<int> { 8, 12, 16, 24, 32, 44, 56 };
float minCha = float.MaxValue;
foreach (int h in heightList)
{
float curCha = Math.Abs(height - h);
if (curCha < minCha)
{
LastHeight = h;
minCha = curCha;
}
}
}
}
if (LastHeight <= 8) { LastHeight = 8; }
//string code = CodeManager.ProcessCode(LastCodeList);
string msg = Name + $" 计算盘高:上升前 [" + StartMovePosition + $"]实时[ " + EndMovePosition + $"]差值[" + (EndMovePosition - StartMovePosition) + $"]系数[" + AxisChangeValue + $"] 计算后" + buchongStr + "[" + height + "]" + $",归类为【" + LastHeight + $"mm】条码【" + LastCode + "】";
string msg = Name + prefix+"上升前 [" + StartMovePosition + "]实时[ " + EndMovePosition + "]差值[" + (EndMovePosition - StartMovePosition) + "]系数[" + AxisChangeValue + "] 计算后" + "[" + height + "]," + buchongStr + ",归类为【" + LastHeight + "mm】条码【" + LastCode + "】";
LogUtil.info(msg);
return LastHeight;
}
public void StringDoorOpen(MoveInfo moveInfo)
{
if (StringDoor != null)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!