Commit 3547a0c6 LN

1

1 个父辈 179c6ed8
......@@ -377,6 +377,10 @@ namespace OnlineStore.DeviceLibrary
{
return true;
}
if (MoveInfo.MoveType.Equals(LineMoveType.None).Equals(false))
{
return true;
}
if (SW12_MoveInfo.MoveType.Equals(LineMoveType.None).Equals(false))
{
return true;
......
......@@ -88,17 +88,13 @@ namespace OnlineStore.DeviceLibrary
{
if (balserNameList.Contains(cameraName))
{
bool result = BaslerCamera.Instance.IsOpen;
if (!result)
{
result = BaslerCamera.Instance.Open(cameraName);
LogUtil.info("打开相机:" + cameraName + "(" + result + ")");
}
bool result = BaslerCamera.Instance.Open(cameraName);
// LogUtil.info("打开相机:" + cameraName + "(" + result + ")");
if (result)
{
BaslerCamera.Instance.GrabOne();
bitm = BaslerCamera.Instance.Image;
//BaslerCamera.Instance.Close();
BaslerCamera.Instance.Close();
}
else
{
......@@ -107,17 +103,13 @@ namespace OnlineStore.DeviceLibrary
}
else if (hikNameList.Contains(cameraName))
{
bool result = HIKCamera.Instance.IsOpen;
if (!result)
{
result = HIKCamera.Instance.Open(cameraName);
LogUtil.info("打开相机:" + cameraName + "(" + result + ")");
}
bool result = HIKCamera.Instance.Open(cameraName);
// LogUtil.info("打开相机:" + cameraName + "(" + result + ")");
if (result)
{
HIKCamera.Instance.GrabOne();
bitm = HIKCamera.Instance.Image;
//HIKCamera.Instance.Close();
HIKCamera.Instance.Close();
}
else
{
......
......@@ -38,7 +38,8 @@ namespace OnlineStore.DeviceLibrary
{
return true;
}
}return false;
}
return false;
}
/// <summary>
/// 移栽装置拦截托盘时, 判断是否可以入库,入库执行可以入库,出库过程中不能入库
......@@ -54,7 +55,7 @@ namespace OnlineStore.DeviceLibrary
if (span.TotalSeconds < ClientKeepSecond && box.SAlarmType.Equals(LineAlarmType.None))
{
LineRunStatus runs = (LineRunStatus)box.SRunStatus;
if (runs.Equals(LineRunStatus.Runing))
{
return true;
......@@ -74,18 +75,39 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 判断库位是否验证成功
/// </summary>
public static bool RightInPosId(int id,string posId)
public static bool RightInPosId(int id, string posId)
{
BoxInfo box = GetBoxInfo(id);
if (box != null)
{
TimeSpan span = DateTime.Now - box.LastMsgTime;
if (span.TotalSeconds < ClientKeepSecond )
if (span.TotalSeconds < ClientKeepSecond)
{
if (box.WaitInStoreList != null && box.WaitInStoreList.Contains(posId))
{
return true;
}
}
}
}
return false;
}
public static bool IsInStorePro(int id)
{
BoxInfo box = GetBoxInfo(id);
TimeSpan span = DateTime.Now - box.LastMsgTime;
if (box != null && span.TotalSeconds < ClientKeepSecond)
{
LineStatus status = (LineStatus)box.SStatus;
LineRunStatus runs = (LineRunStatus)box.SRunStatus;
if (runs.Equals(LineRunStatus.Busy))
{
if (status.Equals(LineStatus.InStoreEnd) || status.Equals(LineStatus.InStoreExecute))
{
return true;
}
}
}
return false;
......@@ -101,34 +123,13 @@ namespace OnlineStore.DeviceLibrary
if (box != null)
{
TimeSpan span = DateTime.Now - box.LastMsgTime;
if (span.TotalSeconds < ClientKeepSecond&&box.HasTray.Equals(0)&&box.SAlarmType.Equals(LineAlarmType.None) )
if (span.TotalSeconds < ClientKeepSecond && box.HasTray.Equals(0) && box.SAlarmType.Equals(LineAlarmType.None))
{
LineRunStatus runs = (LineRunStatus)box.SRunStatus;
if (runs.Equals(LineRunStatus.Runing))
{
return true;
}
}
}
return false;
}
public static bool IsInStorePro(int id)
{
BoxInfo box = GetBoxInfo(id);
TimeSpan span = DateTime.Now - box.LastMsgTime;
if (box != null && span.TotalSeconds < ClientKeepSecond)
{
LineStatus status = (LineStatus)box.SStatus;
LineRunStatus runs = (LineRunStatus)box.SRunStatus;
if (runs.Equals(LineRunStatus.Busy))
{
if (status.Equals(LineStatus.InStoreEnd) || status.Equals(LineStatus.InStoreExecute))
{
return true;
}
}
}
......@@ -147,7 +148,7 @@ namespace OnlineStore.DeviceLibrary
if (span.TotalSeconds < ClientKeepSecond)
{
if (LineManager.Line.CanIntore(box.ID))
{
{
result += box.CId + ",";
}
}
......@@ -176,7 +177,7 @@ namespace OnlineStore.DeviceLibrary
}
}
public static void StopServer()
{
try
......@@ -192,15 +193,15 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(LOGGER, "关闭 监听出错:" + ex.ToString());
}
}
public static bool UpdateBoxDebug(int id,int isDebug)
public static bool UpdateBoxDebug(int id, int isDebug)
{
if (ClientMap.ContainsKey(id))
{
Dictionary<string,object> paramList =new Dictionary<string, object>();
Dictionary<string, object> paramList = new Dictionary<string, object>();
paramList.Add(S_Cmd, cmd_updateDebug);
int canOutStore = LineManager.Line.CanOutStore(id) ? 1 : 0;
paramList.Add(S_CanOutStore, canOutStore);
paramList.Add(S_IsDebug, isDebug);
paramList.Add(S_IsDebug, isDebug);
string msg = ToParamStr(paramList);
Client client = ClientMap[id];
bool result = SendStrToClient(client, msg);
......@@ -228,7 +229,7 @@ namespace OnlineStore.DeviceLibrary
bool result = SendStrToClient(client, msg);
if (!result)
{
LogUtil.error("StartInStore【" + id+"】【"+msg+"】失败");
LogUtil.error("StartInStore【" + id + "】【" + msg + "】失败");
}
}
return false;
......@@ -236,7 +237,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 获取整个料仓的状态
/// </summary>
public static Operation GetInStoreOperation(string message)
public static Operation GetInStoreOperation(string message)
{
//构建发送给服务器的对象
Operation lineOperation = new Operation();
......@@ -273,21 +274,22 @@ namespace OnlineStore.DeviceLibrary
}
else
{
// LogUtil.info("CheckInStorePos【" + id + "】【" + msg + "】发送成功");
// LogUtil.info("CheckInStorePos【" + id + "】【" + msg + "】发送成功");
}
}
}catch(Exception ex)
}
catch (Exception ex)
{
LogUtil.error("CheckInStorePos【" + id + "】【" + param.ToStr() + "】失败");
}
return false;
}
private static bool SendStrToClient(Client client, string sendMsg)
private static bool SendStrToClient(Client client, string sendMsg)
{
if (client != null && client.ClientSocket.Connected)
{
......@@ -296,7 +298,7 @@ namespace OnlineStore.DeviceLibrary
client.ClientSocket.Send(sendBuffer);
return true;
}
return false;
}
private static string ToParamStr(Dictionary<string, object> paramList)
......@@ -306,7 +308,7 @@ namespace OnlineStore.DeviceLibrary
return result + "\r";
}
private static object MapLock = "";
private static void SaveBoxClient(int id,BoxInfo box,Client client)
private static void SaveBoxClient(int id, BoxInfo box, Client client)
{
lock (MapLock)
{
......@@ -324,19 +326,19 @@ namespace OnlineStore.DeviceLibrary
}
}
private static void tcp_ReviceMsgEvent(Client client, string msg)
{
{
try
{
if (String.IsNullOrEmpty(msg))
{
return;
}
ProcessMsg(client, msg);
ProcessMsg(client, msg);
}
catch (Exception ex)
{
LogUtil.error("处理料仓消息【"+msg+"】出错:"+ ex.ToString());
LogUtil.error("处理料仓消息【" + msg + "】出错:" + ex.ToString());
}
}
......@@ -349,14 +351,14 @@ namespace OnlineStore.DeviceLibrary
LogUtil.debug("收到【" + add + "】的消息【" + msg + "】");
StoreSendBean storeSMsg = JsonHelper.DeserializeJsonToObject<StoreSendBean>(msg);
if ( storeSMsg==null)
if (storeSMsg == null)
{
LogUtil.error("收到【" + add + "】的消息【" + msg + "】,解析失败");
}
else
{
int id = storeSMsg.StoreId;
BoxInfo box = new BoxInfo(storeSMsg.StoreId,storeSMsg.Cid,storeSMsg.Seq,storeSMsg.SStatus,storeSMsg.SRunStatus,storeSMsg.DoorHasTray,storeSMsg.AlarmType,storeSMsg.WaitInStoreList);
BoxInfo box = new BoxInfo(storeSMsg.StoreId, storeSMsg.Cid, storeSMsg.Seq, storeSMsg.SStatus, storeSMsg.SRunStatus, storeSMsg.DoorHasTray, storeSMsg.AlarmType, storeSMsg.WaitInStoreList);
SaveBoxClient(id, box, client);
string cmd = storeSMsg.Cmd;
......@@ -385,16 +387,16 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error("SendHeartBack【" + id + "】【" + msg + "】失败");
}
return true;
}
return false;
}
private static char cmd_spilt = ';';
private static char cmd_spilt = ';';
private static string cmd_heart = "heart";
private static string cmd_outend = "outend";
private static string cmd_startIn = "starIn";
private static string cmd_updateDebug = "updateDebug";
private static string cmd_updateDebug = "updateDebug";
public static string cmd_checStartIn = "cmd_checStartIn";
......@@ -444,4 +446,4 @@ namespace OnlineStore.DeviceLibrary
public List<string> WaitInStoreList = new List<string>();
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!