Commit 6848577d 张东亮

20230103

1 个父辈 a1f4eb60
......@@ -31,6 +31,10 @@
<!--是否打开托盘编码界面-->
<add key="DefaultPWD" value="123456" />
<add key="Server_Log_Open" value="0" />
<!--任务限制数量-->
<add key="TaskCnt" value="30" />
<!--横移3出库箱子等待超时时间-->
<add key="HY3_WaitTimeOut" value="30" />
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
......@@ -554,7 +554,8 @@ namespace OnlineStore.AssemblyLine
msg += t.ToStr() + "\r\n";
}
msg += "---------结束打印容器信息----------";
MessageBox.Show(msg, "容器信息列表");
var outTask = ContainerManager.getTrayList().FindAll(s => s.InOrOutStore.Equals(ContainerType.OutStore));
MessageBox.Show(msg, $"容器信息列表[{outTask?.Count??0}]/[{tray?.Count ?? 0}]");
}
......
......@@ -29,7 +29,7 @@ namespace OnlineStore.AssemblyLine
comboxType.Items.Clear();
foreach (EquipBase b in LineManager.Line.AllEquipMap.Values)
{
b.OpenRfid();
//b.OpenRfid();
List<string> value = RFIDManager.GetRFIP(b.DeviceID);
if (value != null && value.Count > 0)
{
......@@ -73,13 +73,13 @@ namespace OnlineStore.AssemblyLine
private void FrmRFIPEdit_FormClosed(object sender, FormClosedEventArgs e)
{
if (LineManager.Line.runStatus <= LineRunStatus.Wait)
{
foreach (EquipBase b in LineManager.Line.AllEquipMap.Values)
{
b.CloseRfid();
}
}
//if (LineManager.Line.runStatus <= LineRunStatus.Wait)
//{
// foreach (EquipBase b in LineManager.Line.AllEquipMap.Values)
// {
// b.CloseRfid();
// }
//}
}
}
}
......@@ -49,5 +49,6 @@ namespace OnlineStore.Common
public static string DisTraySave = "DisTraySave";
public static string ESS_Server = "ESS_Server";
public static string Webservice = "Webservice";
public static string HY3_WaitTimeOut = "HY3_WaitTimeOut";
}
}
......@@ -169,7 +169,7 @@ namespace OnlineStore.Common
{
LogUtil.error("POST [" + url + "] ERROR:" + e.ToString(), 101);
}
if (!resultMsg.Contains("null") && resultMsg.Length != 0)
if (resultMsg.Length != 0)//!resultMsg.Contains("null") &&
{
return true;
}
......
......@@ -81,8 +81,8 @@ namespace OnlineStore.DeviceLibrary.ESS
{
ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.IN_ON_AGV);
}
else if (essModel.status.Equals("cancel"))
ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.ERROR);
//else if (essModel.status.Equals("cancel"))
// ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.ERROR);
}
else if(essModel.eventType?.Equals("task")??false)
{
......@@ -90,8 +90,8 @@ namespace OnlineStore.DeviceLibrary.ESS
{
ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.FINISHED);
}
else if (essModel.status.Equals("cancel"))
ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.ERROR);
//else if (essModel.status.Equals("cancel"))
// ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.WAIT);
}
}
else if (essModel.taskCode?.ToLower().StartsWith("out") ?? false)
......@@ -102,8 +102,8 @@ namespace OnlineStore.DeviceLibrary.ESS
{
ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.OUT_ON_AGV);
}
else if (essModel.status.Equals("cancel"))
ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.ERROR);
//else if (essModel.status.Equals("cancel"))
// ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.ERROR);
}
else if (essModel.eventType?.Equals("task") ?? false)
{
......@@ -117,8 +117,8 @@ namespace OnlineStore.DeviceLibrary.ESS
// LineManager.StartStationInStore(info.InoutParam);
//}
}
else if (essModel.status.Equals("cancel"))
ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.ERROR);
//else if (essModel.status.Equals("cancel"))
// ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.ERROR);
}
}
......
......@@ -57,7 +57,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(LineMoveStep.HY_R_01StopMove);
LogInfo("开始复位,横移线体停止 ");
LineStop(MoveInfo);
if (IsHY2() &&IOValue(IO_Type.HY_BoxCheck).Equals(IO_VALUE.HIGH))
if (IsHY2() && IOValue(IO_Type.HY_BoxCheck).Equals(IO_VALUE.HIGH))
{
JackingDown(MoveInfo);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
......@@ -275,6 +275,8 @@ namespace OnlineStore.DeviceLibrary
{
UpdateContainerCode();
}
bool hy3ToDischarge = false;
int hy3WaitTime = ConfigAppSettings.GetIntValue(Setting_Init.HY3_WaitTimeOut);
protected override void BoxProcess()
{
if (MoveInfo.IsInWait)
......@@ -327,34 +329,52 @@ namespace OnlineStore.DeviceLibrary
ContainerInfo trayInfo = ContainerManager.GetTrayInfo(CurContainerId);
if (trayInfo?.InOrOutStore == ContainerType.InStore)//入库
{
if (IsDischargeIdle())
{
JackingDown(MoveInfo);
}
else
{
JackingUp(MoveInfo);
}
}
else
{
JackingUp(MoveInfo);
}
}
else if (MoveInfo.IsStep(LineMoveStep.HY34_GetBoxInfo))
{
MoveInfo.NextMoveStep(LineMoveStep.HY35_CheckDownriver);
LogInfo(" 检查下游状态");
ContainerInfo trayInfo = ContainerManager.GetTrayInfo(CurContainerId);
if (trayInfo?.InOrOutStore == ContainerType.InStore)//入库
{
if (IsDischargeIdle())
{
MoveInfo.NextMoveStep(LineMoveStep.HY35_CheckDownriver);
LogInfo("入库容器,出料工位空闲,流到出料工位");
JackingDown(MoveInfo);
hy3ToDischarge = true;
}
else if(MoveInfo.IsTimeOut(hy3WaitTime))
{
MoveInfo.NextMoveStep(LineMoveStep.HY35_CheckDownriver);
LogInfo($"入库容器,等待{hy3WaitTime}秒超时,直接流转");
JackingUp(MoveInfo);
hy3ToDischarge = false;
}
}
else
{
MoveInfo.NextMoveStep(LineMoveStep.HY35_CheckDownriver);
LogInfo("出库容器,直接流转");
JackingUp(MoveInfo);
hy3ToDischarge = false;
}
}
else if (MoveInfo.IsStep(LineMoveStep.HY35_CheckDownriver))
{
ContainerInfo trayInfo = ContainerManager.GetTrayInfo(CurContainerId);
if (trayInfo?.InOrOutStore == ContainerType.InStore)//入库
{
if (IsDischargeIdle())
if (hy3ToDischarge)//入库
{
MoveInfo.NextMoveStep(LineMoveStep.HY36_ReleaseBox);
ClearSpecifiedWarnMsg("等待出料工位空闲超时");
......@@ -363,11 +383,7 @@ namespace OnlineStore.DeviceLibrary
StopDown(MoveInfo);
LineManager.StartDisChargeMove();
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
else if (MoveInfo.IsTimeOut(30))
{
SetWarnMsg("等待出料工位空闲超时");
}
}
else
{
......@@ -386,12 +402,11 @@ namespace OnlineStore.DeviceLibrary
SetWarnMsg("等待横移4空闲超时");
}
}
}
else if (MoveInfo.IsStep(LineMoveStep.HY36_ReleaseBox))
{
ContainerInfo trayInfo = ContainerManager.GetTrayInfo(CurContainerId);
if (trayInfo?.InOrOutStore == ContainerType.InStore)//入库
if (hy3ToDischarge)//入库
{
if (BoxReachDischarge())
{
......@@ -435,7 +450,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(LineMoveStep.HY21_WaitBoxCheck);
LogInfo($"等待容器到位");
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_BoxCheck, IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
}
else if (MoveInfo.IsStep(LineMoveStep.HY21_WaitBoxCheck))
{
......@@ -454,11 +469,11 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(LineMoveStep.HY23_WaitBoxLeave))
{
MoveInfo.NextMoveStep(LineMoveStep.HY24_JackingUp);
if (LineManager.IsFeedingHasBox())
{
LogInfo($"入料工位有容器,顶升不动作");
}
else
//if (LineManager.IsFeedingHasBox())
//{
// LogInfo($"入料工位有容器,顶升不动作");
//}
//else
{
LogInfo($"入料工位无容器,顶升上升");
JackingUp(MoveInfo);
......
......@@ -800,21 +800,16 @@ namespace OnlineStore.DeviceLibrary
return msg;
}
private bool conIsPro = false;
private object conIsPro = new object();
private DateTime conLastTime = DateTime.Now;
private DateTime callOutLastTime = DateTime.Now;
private void ServerConTimer_Elapsed(object sender, ElapsedEventArgs e)
{
TimeSpan span = DateTime.Now - conLastTime;
if (conIsPro && span.TotalSeconds < 30)
if(Monitor.TryEnter(conIsPro))
{
return;
}
try
{
conIsPro = true;
conLastTime = DateTime.Now;
#region 异常上报
#region 异常上报 未使用
//List<AlarmMsg> alarmList = new List<AlarmMsg>();
//foreach (EquipBase equip in AllEquipMap.Values)
//{
......@@ -874,6 +869,10 @@ namespace OnlineStore.DeviceLibrary
RobotStates states = SServerManager.GetRobotState();
if (LineManager.RobotIsIdle(states) || LineManager.CheckRobotTrayIsInstore(states))
{
TimeSpan span1 = DateTime.Now - callOutLastTime;
if (span1.TotalSeconds > 15)
{
callOutLastTime = DateTime.Now;
foreach (var item in outTask)
{
ContainerManager.AddOrUpdateContainerInfo(item.barcode);
......@@ -881,6 +880,8 @@ namespace OnlineStore.DeviceLibrary
}
}
}
//发送呼叫任务
ContainerManager.HandlePendingTask();
//上报容器状态
......@@ -892,7 +893,8 @@ namespace OnlineStore.DeviceLibrary
}
finally
{
conIsPro = false;
Monitor.Exit(conIsPro);
}
}
}
......
......@@ -166,12 +166,23 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(LineMoveStep.SI_05_WaitBoxLeave);
LogInfo($"等待出库容器被拿走");
AddWaitBoxCheck(false);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(15000));
MoveInfo.OneWaitCanEndStep = true;
}
else if (MoveInfo.IsStep(LineMoveStep.SI_05_WaitBoxLeave))
{
if(IOValue(IO_Type.Stop_BoxCheck).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(LineMoveStep.SI_08_StopDown);
LogInfo($"出库容器被拿走超时,放行");
StopDown(MoveInfo);
}
else
{
MoveInfo.NextMoveStep(LineMoveStep.SI_06_WaitBoxAtStation);
LogInfo($"出库容器被拿走,等待容器到达工作台");
}
}
else if (MoveInfo.IsStep(LineMoveStep.SI_06_WaitBoxAtStation))
{
EquipBase equipBase = GetOutEquip();
......@@ -187,28 +198,30 @@ namespace OnlineStore.DeviceLibrary
}
}
ClearSpecifiedWarnMsg($"等待容器到达下游");
if (MoveInfo.IsTimeOut(30))
if (MoveInfo.IsTimeOut(15))
{
MoveInfo.NextMoveStep(LineMoveStep.SI_07_AllStopDown);
if (ContainerManager.GetInTaskCnt(DeviceID) > 0)
{
LogInfo($"容器到达工作台30秒超时,该工位将有出库容器到达,前阻挡下降");
FrontStopDown(MoveInfo);
//if (ContainerManager.GetInTaskCnt(DeviceID) > 0)
//{
// LogInfo($"容器到达工作台30秒超时,该工位将有出库容器到达,前阻挡下降");
// FrontStopDown(MoveInfo);
}
else if (ContainerManager.GetOutTaskCnt(DeviceID) > 0)
{
LogInfo($"容器到达工作台30秒超时,该工位将有入库容器离开,阻挡下降");
StopDown(MoveInfo);
}
else if(DeviceID==5)
//}
//else if (ContainerManager.GetOutTaskCnt(DeviceID) > 0)
//{
// LogInfo($"容器到达工作台30秒超时,该工位将有入库容器离开,阻挡下降");
// StopDown(MoveInfo);
//}
//else
if(DeviceID==5)
{
LogInfo($"容器到达工作台30秒超时,前阻挡下降");
LogInfo($"容器到达工作台15秒超时,前阻挡下降");
FrontStopDown(MoveInfo);
}
else
{
LogInfo($"容器到达工作台30秒超时,所有阻挡下降");
LogInfo($"容器到达工作台15秒超时,所有阻挡下降");
StopDown(MoveInfo);
FrontStopDown(MoveInfo);
}
......@@ -220,17 +233,19 @@ namespace OnlineStore.DeviceLibrary
if (CurShelfId_Station.Equals(CurContainerId))
{
MoveInfo.NextMoveStep(LineMoveStep.SI_07_AllStopDown);
if (ContainerManager.GetInTaskCnt(DeviceID) > 0)
{
LogInfo($" 容器到达工作台,该工位将有出库容器到达,前阻挡下降");
FrontStopDown(MoveInfo);
}
else if (ContainerManager.GetOutTaskCnt(DeviceID) > 0)
{
LogInfo($"容器到达工作台,该工位将有入库容器离开,阻挡下降");
StopDown(MoveInfo);
}
else if (DeviceID == 5)
//if (ContainerManager.GetInTaskCnt(DeviceID) > 0)
//{
// LogInfo($" 容器到达工作台,该工位将有出库容器到达,前阻挡下降");
// FrontStopDown(MoveInfo);
//}
//else if (ContainerManager.GetOutTaskCnt(DeviceID) > 0)
//{
// LogInfo($"容器到达工作台,该工位将有入库容器离开,阻挡下降");
// StopDown(MoveInfo);
//}
//else
if (DeviceID == 5)
{
LogInfo($"箱子到达工作台,前阻挡下降");
FrontStopDown(MoveInfo);
......@@ -272,17 +287,19 @@ namespace OnlineStore.DeviceLibrary
}
ClearSpecifiedWarnMsg($"等待容器到达下游");
MoveInfo.NextMoveStep(LineMoveStep.SI_10_FrontStopDown);
if (ContainerManager.GetInTaskCnt(DeviceID) > 1)
{
LogInfo($"该工位将有出库容器到达,阻挡上升,前阻挡下降");
StopUp(MoveInfo);
FrontStopDown(MoveInfo);
}
else if (ContainerManager.GetOutTaskCnt(DeviceID) > 0)
{
LogInfo($"该工位将有入库容器离开,前阻挡保持上升");
}
else if (DeviceID == 5)//工位5放行一个容器后前阻挡上升
//if (ContainerManager.GetInTaskCnt(DeviceID) > 1)
//{
// LogInfo($"该工位将有出库容器到达,阻挡上升,前阻挡下降");
// StopUp(MoveInfo);
// FrontStopDown(MoveInfo);
//}
//else if (ContainerManager.GetOutTaskCnt(DeviceID) > 0)
//{
// LogInfo($"该工位将有入库容器离开,前阻挡保持上升");
//}
//else
if (DeviceID == 5)//工位5放行一个容器后前阻挡上升
{
LogInfo($"阻挡上升");
StopUp(MoveInfo);
......
......@@ -39,8 +39,8 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo.NextMoveStep(LineMoveStep.SO_02_WaitBoxInToLine);
AddWaitBoxCheck(true);
WaitTime(3000);
//MoveInfo.OneWaitCanEndStep = true;
WaitTime(15000);
MoveInfo.OneWaitCanEndStep = true;
LogInfo($"等待箱子离开工作站");
}
else if (MoveInfo.IsStep(LineMoveStep.SO_02_WaitBoxInToLine))
......
......@@ -172,7 +172,7 @@ namespace OnlineStore.DeviceLibrary
}
public static void StartStationInStore(InOutParam inOutParam)
{
if(Line?.AllEquipMap.ContainsKey(inOutParam.DeviceId)??false)
if (Line?.AllEquipMap.ContainsKey(inOutParam.DeviceId) ?? false)
{
Line?.AllEquipMap[inOutParam.DeviceId].StartInStoreMove(inOutParam);
}
......@@ -196,18 +196,22 @@ namespace OnlineStore.DeviceLibrary
{
try
{
if(robotStates !=null && robotStates.robots!=null)
if (robotStates != null && robotStates.robots != null)
{
foreach (var item in robotStates.robots)
{
if (!item.state.Equals("IDLE")) continue;
var fullTray = item.trays.FindAll(s => s.containerCode != null);
if (fullTray == null) return true;
if (fullTray == null || fullTray.Count == 0)
{
LogUtil.info($"机器人空闲且背篓为空,允许发送出库任务:【{JsonHelper.SerializeObject(item)}】");
return true;
}
}
}
}
catch(Exception ex)
catch (Exception ex)
{
LogUtil.error("RobotTrayIsEmpty", ex);
}
......@@ -233,10 +237,13 @@ namespace OnlineStore.DeviceLibrary
{
var instore = ContainerManager.GetTrayInfo(tray.containerCode);
if (instore != null && instore.InOrOutStore.Equals(ContainerType.InStore))
{
LogUtil.info($"机器人背篓有入库容器,允许发送出库任务:【{JsonHelper.SerializeObject(item)}】【{JsonHelper.SerializeObject(instore)}】");
return true;
}
}
}
}
}
}
......@@ -246,13 +253,18 @@ namespace OnlineStore.DeviceLibrary
}
return false;
}
static int taskCnt = ConfigAppSettings.GetIntValue("TaskCnt");
/// <summary>
/// 检查容器任务数是否超限
/// 检查容器出库任务数是否超限
/// </summary>
/// <returns></returns>
public static bool CheckTaskCntIsInLimit()
{
return ContainerManager.getTrayList().Count <= 30;
var outTask = ContainerManager.getTrayList().FindAll(s => s.InOrOutStore.Equals(ContainerType.OutStore));
if (taskCnt > 0)
return outTask?.Count <= taskCnt;//30
else
return outTask?.Count <= 8;//30
}
#endregion
}
......
......@@ -48,18 +48,18 @@ namespace OnlineStore.DeviceLibrary
/// <returns></returns>
public static int CntofContainerOnLine()
{
try
{
List<ContainerInfo> containers= getTrayList().FindAll(s=>(s.Status.Equals(TaskStatus.IN_ON_LINE) || s.Status.Equals(TaskStatus.OUT_ON_LINE)));
if(containers!=null)
{
return containers.Count;
}
}
catch (Exception ex)
{
LogUtil.error($"CntofContainerOnLine", ex);
}
//try
//{
// List<ContainerInfo> containers= getTrayList().FindAll(s=>(s.Status.Equals(TaskStatus.IN_ON_LINE) || s.Status.Equals(TaskStatus.OUT_ON_LINE)));
// if(containers!=null)
// {
// return containers.Count;
// }
//}
//catch (Exception ex)
//{
// LogUtil.error($"CntofContainerOnLine", ex);
//}
return 0;
}
/// <summary>
......@@ -84,7 +84,7 @@ namespace OnlineStore.DeviceLibrary
{
foreach (var item in getTrayList())
{
bool rtn = SServerManager.UpdateLocInfo("ContainerManager", item.ContainerValidCode, item.Status, item.CurLoc);
bool rtn = SServerManager.UpdateLocInfo("ContainerManager", item.ContainerValidCode, item.Status, item.CurLoc,out bool canRemove);
if (rtn)
{
if (item.Status.Equals(TaskStatus.ERROR))
......@@ -95,7 +95,12 @@ namespace OnlineStore.DeviceLibrary
else if (item.Status.Equals(TaskStatus.FINISHED))
{
bool res = containerInfoMap.TryRemove(item.ContainerValidCode, out ContainerInfo containerInfo);
LogUtil.info($"任务完成【{res}】:【{JsonHelper.SerializeObject(containerInfo)}】");
LogUtil.info($"任务完成,自动删除该任务【{res}】:【{JsonHelper.SerializeObject(containerInfo)}】");
}
else if(canRemove)
{
bool res = containerInfoMap.TryRemove(item.ContainerValidCode, out ContainerInfo containerInfo);
LogUtil.info($"任务不存在,自动删除该任务【{res}】:【{JsonHelper.SerializeObject(containerInfo)}】");
}
}
}
......@@ -454,7 +459,6 @@ namespace OnlineStore.DeviceLibrary
static object saveObj = new object();
static void SaveMapToFile()
{
LogUtil.info("SaveMapToFile");
if (Monitor.TryEnter(saveObj, 500))
{
try
......
......@@ -22,12 +22,12 @@ namespace OnlineStore.DeviceLibrary
{
if (RfidMap.ContainsKey(ip))
{
return;
if (RfidMap[ip].IsConn)
RfidMap[ip].Close();
RfidMap.TryRemove(ip, out PuYueRFID_C2S puYueRFID_C2S);
}
PuYueRFID_C2S rfid = new PuYueRFID_C2S(ip, true);
//rfid.StartAddr = 0x20;
//rfid.Length = 16;
rfid.ID_Changed_Event += Rfid_ID_Changed_Event;
//rfid.ID_Changed_Event += Rfid_ID_Changed_Event;
if (rfid.IsConn)
rfid.Close();
else
......
......@@ -12,6 +12,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Tab;
namespace OnlineStore.DeviceLibrary
{
......@@ -314,7 +315,6 @@ namespace OnlineStore.DeviceLibrary
}
return list;
}
/// <summary>
/// B 获取出库任务列表
/// </summary>
......@@ -420,9 +420,10 @@ namespace OnlineStore.DeviceLibrary
/// <param name="status">状态</param>
/// <param name="locInfo">位置</param>
/// <returns></returns>
public static bool UpdateLocInfo(string deviceName, string barcode, string status, string locInfo = "")
public static bool UpdateLocInfo(string deviceName, string barcode, string status, string locInfo ,out bool canRemove)
{
string msg = "";
canRemove = false;
try
{
if (String.IsNullOrEmpty(barcode))
......@@ -452,22 +453,25 @@ namespace OnlineStore.DeviceLibrary
}
else if (serverResult.code.Equals(303).Equals(true))
{
canRemove = true;
// code: 0为正常,其他为异常, msg: 消息, data: 为空
msg = deviceName + " UpdateTrayLoc 任务已完成【" + barcode + "】【" + status + "】【" + locInfo + "】 :" + "【" + serverResult.code + "】" + serverResult.msg;
LogUtil.info(msg);
//LogUtil.info(msg);
return true;
}
else if (serverResult.code.Equals(0).Equals(false))
else if (serverResult.code.Equals(0).Equals(true))
{
// code: 0为正常,其他为异常, msg: 消息, data: 为空
msg = deviceName + " UpdateTrayLoc【" + barcode + "】【" + status + "】【" + locInfo + "】 :" + "【" + serverResult.code + "】" + serverResult.msg;
// LogUtil.info(msg);
return true;
}
if (!msg.Equals(""))
{
LogUtil.error(msg);
return false;
}
return true;
}
catch (Exception ex)
{
......@@ -489,7 +493,9 @@ namespace OnlineStore.DeviceLibrary
try
{
string path = ess_server + Addr_GetRobotState;
if (HttpHelper.Post(path, "", out bool isTimueOut, out string outMsg))
Dictionary<string, object> tmp = new Dictionary<string, object>();
string param = JsonHelper.SerializeObject(tmp);
if (HttpHelper.Post(path, param, out bool isTimueOut, out string outMsg))
{
ResultData resultData = JsonHelper.DeserializeJsonToObject<ResultData>(outMsg);
if (resultData != null)
......
......@@ -354,10 +354,14 @@ public class PuYueRFID_C2S
}
}
object locRead = new object();
public bool ReadByte(short address, short length, out byte[] data)
{
data = null;
if (Monitor.TryEnter(locRead))
{
try
{
if (length > 64)
throw new Exception("最大读取64个字节");
data = null;
......@@ -399,7 +403,7 @@ public class PuYueRFID_C2S
seqadd();
tcpClient.Client.Send(by);
Thread.Sleep(5);
ulength = tcpClient?.Client?.Receive(result)??0;
ulength = tcpClient?.Client?.Receive(result) ?? 0;
}
catch (SocketException se)
......@@ -434,6 +438,13 @@ public class PuYueRFID_C2S
if (tcpClient.Client.Available > 0)
_ = tcpClient.Client.Receive(result);
}
}finally
{
Monitor.Exit(locRead);
}
}
return false;
}
/// <summary>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!