Commit 05c38db6 刘韬

agv接入

1 个父辈 39de335a
......@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OnlineStore.Common
{
......@@ -10,7 +10,7 @@ namespace OnlineStore.Common
/// 记录配置的key
/// </summary>
public class Setting_Init
{
{
public static string Server_Log_Open = "Server_Log_Open";
/// <summary>
/// 系统启动时自动启动料仓,=1时自动启动,并隐藏窗口,=0时不需要
......@@ -19,9 +19,9 @@ namespace OnlineStore.Common
/// <summary>
/// 系统主界面标题
/// </summary>
public static string App_Title = "App_Title";
public static string App_Title = "App_Title";
public static string http_server = "http.server";
public static string Store_CID = "Store_CID";
public static string Store_CID = "Store_CID";
/// <summary>
/// 料仓数量
......@@ -31,7 +31,7 @@ namespace OnlineStore.Common
/// 料仓类型,1=在线料仓
/// </summary>
public static string Store_Type = "Store_Type";
public static string BOX_ConfigPath = "BOX_ConfigPath";
public static string Store_Position_Config = "Store_Position_Config";
/// <summary>
......@@ -56,7 +56,7 @@ namespace OnlineStore.Common
/// 配置文件路径 Data Matrix ECC 200.dcm
/// </summary>
public static string CodeParamPath = "CodeParamPath";
/// <summary>
/// 进出轴最大待机点,需要小于3000
/// </summary>
......@@ -67,7 +67,7 @@ namespace OnlineStore.Common
/// 出库等待料盘拿走的时间,秒
/// </summary>
public static string OutStoreWaitSeconds = "OutStoreWaitSeconds";
/// <summary>
/// 温控器类型,0=壁挂王字壳温湿度变送器,1=妙昕温湿度记录仪
......@@ -80,15 +80,15 @@ namespace OnlineStore.Common
public static string LineServerIp = "LineServerIp";
public static string LineServerPort = "LineServerPort";
public static string ACBaudRate = "ACBaudRate";
public static string Store_ConfigPath = "Store_ConfigPath";
public static string UseBuzzer = "UseBuzzer";
public static string UseBuzzer = "UseBuzzer";
public static string Tool_P3_Offset = "Tool_P3_Offset";
public static string Tool_P4_Offset = "Tool_P4_Offset";
public static string Tool_P5_Offset = "Tool_P5_Offset";
......@@ -96,7 +96,7 @@ namespace OnlineStore.Common
public static string Tool_TargetSpeed = "Tool_TargetSpeed";
public static string Tool_TargetPosition = "Tool_TargetPosition";
public static string CodeCount = "CodeCount";
public static string CurrShelfNum = "CurrShelfNum";
......@@ -108,6 +108,8 @@ namespace OnlineStore.Common
public static string AgvServerPort = "AgvServerPort";
public static string code_block_size_list = "code_block_size_list";
public static string InstoreEndSendShelf = "InstoreEndSendShelf";
public static string OutstoreEndSendShelf= "OutstoreEndSendShelf";
public static string LastOutShelfType= "LastOutShelfType";
}
}
......@@ -56,9 +56,12 @@
<add key="CurrShelfNum" value="-1"/>
<!--当前料架信息-料架类型,0=空料架,1=入库料架,2=出库料架-->
<add key="CurrShelfType" value="-1"/>
<add key="LastOutShelfType" value="1"/>
<add key="HasT4Axis" value="true"/>
<add key="AgvServerIp" value="192.168.11.11"/>
<add key="Code_Block_Size_List" value="17,19"/>
<add key="InstoreEndSendShelf" value="1" />
<add key="OutstoreEndSendShelf" value="1" />
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
......@@ -61,9 +61,11 @@ namespace OnlineStore.DUOStore
//store.UseBuzzer = chbUseBuzzer.Checked;
this.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title);
chbAutoRun.Checked = (ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun).Equals(1));
chbInstoreEnd.Checked = (ConfigAppSettings.GetIntValue(Setting_Init.InstoreEndSendShelf).Equals(1));
chbOutstoreEnd.Checked = (ConfigAppSettings.GetIntValue(Setting_Init.OutstoreEndSendShelf).Equals(1));
LoadListView();
chbInstoreEnd.Checked = store.InstoreEndSendShelf;
chbOutstoreEnd.Checked = store.OutstoreEndSendShelf;
store.InstoreEndSendShelf=chbInstoreEnd.Checked;
store.OutstoreEndSendShelf=chbOutstoreEnd.Checked;
LoadOk = true;
//LogUtil.logBox = this.logBox;
store.BoxMap[1].camera_event += FrmStore_camera_event;
......@@ -719,7 +721,7 @@ namespace OnlineStore.DUOStore
{
return;
}
ConfigAppSettings.SaveValue(Setting_Init.InstoreEndSendShelf, chbInstoreEnd.Checked?1:0);
store.InstoreEndSendShelf = chbInstoreEnd.Checked;
LogUtil.info(store.Name + " 切换 入库完成送出料架=" + store.InstoreEndSendShelf);
}
......@@ -734,7 +736,7 @@ namespace OnlineStore.DUOStore
{
return;
}
ConfigAppSettings.SaveValue(Setting_Init.OutstoreEndSendShelf, chbOutstoreEnd.Checked ? 1 : 0);
store.OutstoreEndSendShelf = chbOutstoreEnd.Checked;
LogUtil.info(store.Name + " 切换 入库完成送出料架=" + store.OutstoreEndSendShelf);
......
......@@ -14,6 +14,7 @@ namespace OnlineStore.DUOStore
{
static class Program
{
#region 方法四:使用的Win32函数的声明
/// <summary>
......@@ -56,6 +57,7 @@ namespace OnlineStore.DUOStore
//string path = @"http://localhost:4090/rest/api/v1/station/status";
//HttpHelper.PostOperation(path, new Operation());
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
......
......@@ -14,6 +14,7 @@ namespace OnlineStore.DeviceLibrary
private static int ServerPort = ConfigAppSettings.GetIntValue(Setting_Init.AgvServerPort);
private static Agv.AgvClient agvClient;
public static Dictionary<string, Agv.ClientAction> actionMap = new Dictionary<string, Agv.ClientAction>();
public static Dictionary<string, Agv.ClientShelf> shelfMap = new Dictionary<string, Agv.ClientShelf>();
public static List<string> NodeList = new List<string>();
private static bool isInit = false;
public static void Init()
......@@ -25,19 +26,23 @@ namespace OnlineStore.DeviceLibrary
isInit = true;
agvClient = new Agv.AgvClient();
agvClient.Received += AgvClient_Received;
NodeList.Add(StoreManager.Config.AgvInName);
NodeList.Add(StoreManager.Config.AgvOutName);
agvClient.Connected += AgvClient_Connected;
//NodeList.Add(StoreManager.Config.AgvInName);
//NodeList.Add(StoreManager.Config.AgvOutName);
}
actionMap = new Dictionary<string, Agv.ClientAction>();
shelfMap = new Dictionary<string, Agv.ClientShelf>();
foreach (string key in NodeList)
{
actionMap.Add(key, Agv.ClientAction.None);
actionMap.Add(key, Agv.ClientAction.None);
shelfMap.Add(key, Agv.ClientShelf.None);
}
agvClient.Connect(ServerIp, ServerPort);
foreach (string str in NodeList)
foreach (string id in NodeList)
{
SetStatus(str,"");
LogUtil.info("agv init ,SetStatus[" + str + "]=none ");
//SetStatus(id, "");
agvClient.SetStatus(id);
LogUtil.info("agv init ,SetStatus[" + id + "]=none ");
}
SetCancelState(false);
}
......@@ -49,7 +54,7 @@ namespace OnlineStore.DeviceLibrary
private static void AgvClient_Connected(bool status)
{
LogUtil.info($"AgvClient_Connected:{status}");
//LogUtil.info($"AgvClient_Connected:{status}");
}
private static void AgvClient_Received(Node node)
......@@ -70,7 +75,7 @@ namespace OnlineStore.DeviceLibrary
{
agvClient.CancelState = cancel;
}
public static void SetStatus(string id, string shelfId, ClientAction action = ClientAction.None, ClientLevel level = ClientLevel.Low, bool isMust = false)
public static void SetStatus(string id, string shelfId, ClientAction action = ClientAction.None, ClientLevel level = ClientLevel.Low, ClientShelf clientShelf=ClientShelf.Empty)
{
if (agvClient == null)
return;
......@@ -84,9 +89,10 @@ namespace OnlineStore.DeviceLibrary
}
}
agvClient.SetStatus(id, "", shelfId, action, level);
agvClient.SetStatus(id, "", shelfId, action, level, clientShelf);
UpdateAction(id, action);
LogUtil.info("AgvClient SetStatus id:" + id + ",shelfId:" + shelfId + ",action:" + action.ToString() + ",level:" + level.ToString());
UpdateShelf(id, clientShelf);
LogUtil.info("AgvClient SetStatus id:" + id + ",shelfId:" + shelfId + ",action:" + action.ToString() + ",level:" + level.ToString() + ",clientShelf:" + clientShelf.ToString());
}
......@@ -129,29 +135,29 @@ namespace OnlineStore.DeviceLibrary
public static bool SetToNone(string id, string shelfId = "")
{
Agv.ClientAction currA = GetAction(id);
if (currA.Equals(Agv.ClientAction.None) || currA.Equals(Agv.ClientAction.NeedLeave) || currA.Equals(Agv.ClientAction.NeedEnter))
{
//if (currA.Equals(Agv.ClientAction.None) || currA.Equals(Agv.ClientAction.NeedLeave) || currA.Equals(Agv.ClientAction.NeedEnter))
//{
SetStatus(id, shelfId, Agv.ClientAction.None);
return true;
}
return false;
//}
// return false;
}
public static bool NeedEnter(string id, string shelfId)
public static bool NeedEnter(string id, string shelfId, ClientShelf clientShelf)
{
Agv.ClientAction currA = GetAction(id);
if (currA.Equals(Agv.ClientAction.None) || currA.Equals(Agv.ClientAction.NeedLeave) || currA.Equals(Agv.ClientAction.NeedEnter))
if (currA.Equals(Agv.ClientAction.None) || currA.Equals(Agv.ClientAction.NeedEnter))
{
SetStatus(id, shelfId, Agv.ClientAction.NeedEnter);
SetStatus(id, shelfId, Agv.ClientAction.NeedEnter,ClientLevel.High, clientShelf);
return true;
}
return false;
}
public static bool NeedLeave(string id, string shelfId)
public static bool NeedLeave(string id, string shelfId,ClientShelf clientShelf)
{
Agv.ClientAction currA = GetAction(id);
if (currA.Equals(Agv.ClientAction.None) || currA.Equals(Agv.ClientAction.NeedLeave) || currA.Equals(Agv.ClientAction.NeedEnter))
{
SetStatus(id, shelfId, Agv.ClientAction.NeedLeave);
SetStatus(id, shelfId, Agv.ClientAction.NeedLeave,ClientLevel.High, clientShelf);
return true;
}
return false;
......@@ -164,6 +170,14 @@ namespace OnlineStore.DeviceLibrary
return actionMap[NodeName];
}
return Agv.ClientAction.None;
}
public static Agv.ClientShelf GetShelf(string NodeName)
{
if (shelfMap.ContainsKey(NodeName))
{
return shelfMap[NodeName];
}
return Agv.ClientShelf.None;
}
public static void UpdateAction(string name, Agv.ClientAction action)
{
......@@ -176,6 +190,17 @@ namespace OnlineStore.DeviceLibrary
actionMap.Add(name, action);
}
}
public static void UpdateShelf(string name, Agv.ClientShelf action)
{
if (shelfMap.ContainsKey(name))
{
shelfMap[name] = action;
}
else
{
shelfMap.Add(name, action);
}
}
public static void Dispose()
{
try
......
......@@ -94,6 +94,7 @@
<Compile Include="device\IO\HCIOManager.cs" />
<Compile Include="device\RFIDManagercs.cs" />
<Compile Include="duoStore\BoxBean_Camera.cs" />
<Compile Include="duoStore\DUOStoreBean_LineRunMonitor.cs" />
<Compile Include="duoStore\DUOStoreBean_RaiseStation.cs" />
<Compile Include="duoStore\AxisBean.cs" />
<Compile Include="duoStore\BoxBean.cs" />
......
......@@ -64,7 +64,7 @@ namespace OnlineStore.DeviceLibrary
if (String.IsNullOrEmpty(ip).Equals(false))
{
string outValue = readAll.Read(ip);
System.Threading.Thread.Sleep(300);
if (isClear)
{
readAll.Clear(ip);
......
......@@ -265,6 +265,23 @@ namespace OnlineStore.DeviceLibrary
HuichuanLibrary.HCBoardManager.SetAxBacklash(MiddleAxis.Config.GetAxisValue(),Config.MiddleAxis_Reverse_Offset, MiddleAxis.Config.HomeLowSpeed,-1);
LogInfo(MoveInfo.MoveType + ": 完成");
MoveEndP();
if (IOValue(IO_Type.InDoor_Check).Equals(IO_VALUE.HIGH) && IsDebug.Equals(false))
{
LogInfo("发现入口有无信息料");
InOutParam inOutParam = new InOutParam(MoveType.InStore);
inOutParam.InStoreNg = true;
inOutParam.TargetPosition = 1;
inOutParam.moveType = MoveType.InStore;
inOutParam.PlateH = 56;
StoreManager.LoadInoutParam(inOutParam, MoveType.InStore, true, this);
runStatus = StoreRunStatus.Busy;
storeStatus = StoreStatus.InStoreExecute;
MoveInfo.NewMove(MoveType.InStore, inOutParam);
MoveInfo.NextMoveStep(StoreMoveStep.SI_01_InoutToP1);
}
break;
default: break;
}
......
......@@ -79,12 +79,12 @@ namespace OnlineStore.DeviceLibrary
(!runStatus.Equals(StoreRunStatus.Runing))
|| (!MoveInfo.MoveType.Equals(MoveType.None)))
{
LogUtil.error(Name + " 启动库出错,忙碌或报警中 ,storeStatus=" + runStatus + ",MoveType=" + MoveInfo.MoveType + ",isInSuddenDown=" + isInSuddenDown + ",isNoAirCheck" + isNoAirCheck);
LogUtil.error(Name + " 启动库出错,忙碌或报警中 ,storeStatus=" + runStatus + ",MoveType=" + MoveInfo.MoveType + ",isInSuddenDown=" + isInSuddenDown + ",isNoAirCheck" + isNoAirCheck);
return false;
}
if (IOValue(IO_Type.InDoor_Check).Equals(IO_VALUE.LOW))
if (!AutoInout.autoNext && IOValue(IO_Type.InDoor_Check).Equals(IO_VALUE.LOW))
{
LogUtil.error(Name + " 启动库出错,入口没有检测到料盘, 任务取消");
LogUtil.error(Name + " 启动库出错,入口没有检测到料盘, 任务取消");
StoreManager.cancelPutInTask(Name, param.WareCode);
return true;
}
......@@ -549,11 +549,19 @@ namespace OnlineStore.DeviceLibrary
#endregion
else if (MoveInfo.IsStep(StoreMoveStep.SO_07_FixtureCheck))
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_08_InoutToP2);
InOutStoreLog(outType + "进出轴到P2 [" + moveP.InOut_P2 + "]");
InoutAxis.AbsMove(MoveInfo, moveP.InOut_P2, Config.InOutAxis_P2_Speed);
ClearTimeoutAlarm("进出轴可以到P2");
bool waitLeftStore = false;
if (StoreManager.Store.HasT4Axis && ID == 2 && StoreManager.Store.MoveInfo.MoveParam!=null && StoreManager.Store.MoveInfo.MoveParam.TargetBox==1)
{
if (StoreManager.Store.MoveInfo.MoveStep >= StoreMoveStep.LO_11_BatchAxisDown && StoreManager.Store.MoveInfo.MoveStep <= StoreMoveStep.LO_16_MiddleToP1)
waitLeftStore = true;
}
if (!waitLeftStore) {
MoveInfo.NextMoveStep(StoreMoveStep.SO_08_InoutToP2);
InOutStoreLog(outType + "进出轴到P2 [" + moveP.InOut_P2 + "]");
InoutAxis.AbsMove(MoveInfo, moveP.InOut_P2, Config.InOutAxis_P2_Speed);
ClearTimeoutAlarm("进出轴可以到P2");
}
}
else if (MoveInfo.IsStep(StoreMoveStep.SO_08_InoutToP2))
{
......
......@@ -253,7 +253,7 @@ namespace OnlineStore.DeviceLibrary
}
return false;
}
public string LastVisualRfid = "";
//public string LastVisualRfid = "";
private void ReviceOutStoreProcess(Operation resultOperation)
{
DateTime time = DateTime.Now;
......@@ -265,13 +265,13 @@ namespace OnlineStore.DeviceLibrary
string[] posIdArray = data[ParamDefine.posId].Split(splitChar);
string[] plateWArray = data[ParamDefine.plateW].Split(splitChar);
string[] plateHArray = data[ParamDefine.plateH].Split(splitChar);
if (string.IsNullOrEmpty(LastVisualRfid))
if (string.IsNullOrEmpty(StoreManager.LastVisualRfid))
{
LastVisualRfid = data[ParamDefine.rfid];
StoreManager.LastVisualRfid = data[ParamDefine.rfid];
}
else if (LastVisualRfid != data[ParamDefine.rfid])
else if (StoreManager.LastVisualRfid != data[ParamDefine.rfid])
{
LogUtil.error(Name + $" 上一个工单还未结束LastVisualRfid={LastVisualRfid}, CurrentVisualRfid={data[ParamDefine.rfid]}");
LogUtil.error(Name + $" 上一个工单还未结束LastVisualRfid={StoreManager.LastVisualRfid}, CurrentVisualRfid={data[ParamDefine.rfid]}");
return;
}
bool urgentReel = FormUtil.GetBoolData(data, ParamDefine.urgentReel);
......
......@@ -98,7 +98,6 @@ namespace OnlineStore.DeviceLibrary
AgvClient.NodeList.Add(Config.AgvInName);
AgvClient.NodeList.Add(Config.AgvOutName);
IOManager.Init();
CodeManager.LoadConfig();
......@@ -108,12 +107,10 @@ namespace OnlineStore.DeviceLibrary
HasT4Axis = Convert.ToBoolean(ConfigAppSettings.GetValue(Setting_Init.HasT4Axis));
Task.Factory.StartNew(delegate
{
RFIDManager.Open();
IOManager.instance.ConnectionIOList(ioList);
AxisManager.Init();
//AgvClient.Init();
AgvClient.Init();
IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.LOW);
IOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW);
......@@ -186,6 +183,7 @@ namespace OnlineStore.DeviceLibrary
}
LogUtil.info(Name + "开始启动 ,启动时间:" + StartTime.ToString());
IOMove(IO_Type.Device_Led, IO_VALUE.HIGH);
RFIDManager.Open();
runStatus = StoreRunStatus.HomeMoving;
StartTime = DateTime.Now;
StartResetMove();
......@@ -279,8 +277,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StoreMoveStep.LR_02_LineRun);
LogUtil.info(Name + "复位 " + MoveInfo.MoveStep + " :流水线转动3秒");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
LineRun(MoveInfo);
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH, false, 5000);
LineRun("reset", 5);
}
else if (MoveInfo.IsStep(StoreMoveStep.LR_02_LineRun))
......@@ -396,7 +393,7 @@ namespace OnlineStore.DeviceLibrary
T4_InOut_Axis.SuddenStop();
CloseAllAxis();
LineStop();
LineStop("n");
}
public override void StopRun()
{
......@@ -725,11 +722,11 @@ namespace OnlineStore.DeviceLibrary
{
LowProcess = true;
LogUtil.info(Name + "从料架堆积处放一个料架到后端");
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH, false, 30000);
LineRun("shelfout", 30);
//IOMove(IO_Type.Line_Stop3_Buffer, IO_VALUE.HIGH, false, 2000);
if (WaitIo(IO_Type.Line_OutCheck, IO_VALUE.HIGH, 30000, "堆积处放料架到后端"))
{
LineStop();
LineStop("shelfout");
}
LowProcess = false;
});
......@@ -747,7 +744,7 @@ namespace OnlineStore.DeviceLibrary
}
public void OneShelfOutProcess()
{
try
/*try
{
if (IOValue(IO_Type.Line_OutCheck).Equals(IO_VALUE.HIGH) &&
IOValue(IO_Type.Line_Run).Equals(IO_VALUE.LOW) &&
......@@ -778,20 +775,55 @@ namespace OnlineStore.DeviceLibrary
catch (Exception ex)
{
LogUtil.error(Name + " OneShelfOutProcess 出错:" + ex.ToString());
}
}
}*/
//左侧下层需要放个料架
Task.Run(() =>
{
LogUtil.info(Name + "Agv送出一个料架");
LineRun("agvout", 30);
IOMove(IO_Type.Line_Stop4_Out, IO_VALUE.HIGH, false, 1000);
if (WaitIo(IO_Type.Line_OutCheck, IO_VALUE.LOW, 30000, "送出一个料架"))
{
LineRun("agvout",15);
Task.Delay(5*1000);
AgvClient.SetStatus(StoreManager.Config.AgvOutName, "", Agv.ClientAction.FinishLeave);
_ = Task.Run(() => {
Task.Delay(2000);
AgvClient.SetStatus(StoreManager.Config.AgvInName, "", Agv.ClientAction.None);
});
}
});
}
#endregion
Agv.ClientShelf AgvNeedInshelf = Agv.ClientShelf.None;
Agv.ClientShelf AgvNeedOutshelf = Agv.ClientShelf.None;
void IOMinoitor() {
if (IOValue(IO_Type.Line_WaitCheck).Equals(IO_VALUE.LOW) && AgvClient.GetAction(Config.AgvInName) == Agv.ClientAction.None)
if (IOValue(IO_Type.Line_WaitCheck).Equals(IO_VALUE.LOW) && AgvClient.GetAction(Config.AgvInName) == Agv.ClientAction.None
&& MoveInfo.MoveType.Equals(MoveType.None) && BoxMap[1].waitOutStoreList.Count==0 && BoxMap[2].waitOutStoreList.Count == 0)
{
AgvClient.NeedEnter(Config.AgvInName,"");
AgvNeedInshelf = Agv.ClientShelf.Full;
AgvClient.NeedEnter(Config.AgvInName,"", AgvNeedInshelf);
LogUtil.info(Name + "IOMinoitor AgvClient.NeedEnter" + Config.AgvInName+ ",AgvNeedInshelf:" + AgvNeedInshelf);
//AgvNeedInshelf = Agv.ClientShelf.None;
}
if (IOValue(IO_Type.Line_OutCheck).Equals(IO_VALUE.HIGH) && AgvClient.GetAction(Config.AgvOutName) == Agv.ClientAction.None)
{
var rfiddevice = RFIDManager.GetShelfId(Config.Out_Rfid_IP);
var rfid = rfiddevice.NumStr();
AgvClient.NeedLeave(Config.AgvOutName, rfid);
if (AgvNeedOutshelf == Agv.ClientShelf.None) {
if (ConfigAppSettings.GetIntValue(Setting_Init.LastOutShelfType) == 1)
AgvNeedOutshelf = Agv.ClientShelf.Full;
else
AgvNeedOutshelf = Agv.ClientShelf.Empty;
}
AgvClient.NeedLeave(Config.AgvOutName, rfid, AgvNeedOutshelf);
LogUtil.info(Name + $"AgvClient.NeedLeave:{Config.AgvOutName},rfid:{rfid},AgvNeedOutshelf:{AgvNeedOutshelf}");
AgvNeedOutshelf = Agv.ClientShelf.None;
}
else if (IOValue(IO_Type.Line_OutCheck).Equals(IO_VALUE.LOW) && AgvClient.GetAction(Config.AgvOutName) != Agv.ClientAction.MayLeave && AgvClient.GetAction(Config.AgvOutName) != Agv.ClientAction.None) {
AgvClient.SetToNone(Config.AgvOutName);
LogUtil.info(Name + $"AgvClient.SetToNone:{Config.AgvOutName}");
}
}
......@@ -800,7 +832,7 @@ namespace OnlineStore.DeviceLibrary
if (IOValue(IO_Type.Line_OutCheck).Equals(IO_VALUE.HIGH))
{
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH, false, 4000);
LineRun("releashelf", 4);
IOMove(IO_Type.Line_Stop4_Out, IO_VALUE.HIGH, false, 1000);
LogUtil.info(Name + "料串手动出库,放行区放行");
return true;
......@@ -812,7 +844,7 @@ namespace OnlineStore.DeviceLibrary
&& IOValue(IO_Type.TopCylinder_Down).Equals(IO_VALUE.HIGH)
)
{
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH, false, 3000);
LineRun("releashelf", 4);
IOMove(IO_Type.Line_Stop2_Work, IO_VALUE.HIGH, false, 2000);
LogUtil.info(Name + "料串手动出库, 工作区放行");
return true;
......@@ -839,7 +871,7 @@ namespace OnlineStore.DeviceLibrary
{
move.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_Run, IO_VALUE.HIGH));
}
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH);
LineRun("n", 999);
}
public void LineStop(StoreMoveInfo move=null )
......@@ -848,7 +880,7 @@ namespace OnlineStore.DeviceLibrary
{
move.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_Run, IO_VALUE.LOW));
}
IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
LineStop("n");
}
public void OpenGate(StoreMoveInfo move = null) {
......
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
namespace OnlineStore.DeviceLibrary
{
partial class DUOStoreBean
{
Timer lineTimer = null;
Dictionary<string, DateTime> linrunlist = new Dictionary<string, DateTime>();
void LineInit() {
if (lineTimer == null) {
lineTimer = new Timer(300);
lineTimer.Elapsed += LineTimer_Elapsed;
lineTimer.Start();
GC.KeepAlive(lineTimer);
}
}
private void LineTimer_Elapsed(object sender, ElapsedEventArgs e)
{
if (canStopLine(out _))
IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
}
/// <summary>
/// 控制线体运转
/// </summary>
/// <param name="id">需求方标识</param>
/// <param name="seconds">秒数</param>
void LineRun(string id, int seconds) {
LineInit();
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH);
lock (linrunlist)
{
if (!string.IsNullOrEmpty(id) && seconds > 0)
{
if (linrunlist.ContainsKey(id))
linrunlist[id] = DateTime.Now.AddSeconds(seconds);
else
{
linrunlist.Add(id, DateTime.Now.AddSeconds(seconds));
}
LogUtil.info(Name + $" {id} 请求链条运行 {seconds}秒.");
}
}
}
void LineStop(string id = "") {
lock (linrunlist)
{
if (!string.IsNullOrEmpty(id))
{
if (linrunlist.ContainsKey(id))
linrunlist.Remove(id);
LogUtil.info(Name + $" {id} 请求立刻停止线体.");
}
}
if (!canStopLine(out string msg))
LogUtil.info(Name + $" {Name}");
// IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
}
bool canStopLine(out string msg)
{
msg = "";
bool canStop = true;
lock (linrunlist)
{
foreach (var x in linrunlist.ToList()) {
if (x.Value > DateTime.Now)
{
canStop = false;
msg = Name + $" {x.Key} 不允许停止线体 需求停止时间 {x.Value.ToString()}.";
//LogUtil.info(Name + $" {x.Key} 不允许停止线体 需求停止时间 {x.Value.ToString()}.");
}
else {
LogUtil.info(Name + $" {x.Key} 请求时间已过期,删除.");
linrunlist.Remove(x.Key);
}
}
}
return canStop;
}
}
}
......@@ -20,6 +20,9 @@ namespace OnlineStore.DeviceLibrary
public static Dictionary<int, BaseConfig> allConfigMap = null;
private static bool isInit = false;
public static bool IsConnectServer = !ConfigAppSettings.GetValue(Setting_Init.http_server).Equals("");
public static string LastVisualRfid = "";
public StoreManager()
{
}
......@@ -105,6 +108,7 @@ namespace OnlineStore.DeviceLibrary
CSVPositionReader<ACBoxPosition>.AddCSVFile(positionConfigFile);
}
CSVPositionReader<ACBoxPosition>.AddCSVFile(Path.Combine(appPath, @"StoreConfig\FixPositions.csv"));
AgvClient.Init();
LogUtil.info("加载料仓完成!");
}
......@@ -513,7 +517,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(deviceName + " " + ex.ToString());
}
return 99999;
return 0;
}
//public static void SendPosToStoreCheck(string deviceName, InOutParam param)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!