Commit a61cf585 张东亮

软件更新后,工位2等待时间超时清理后会闪退

1 个父辈 4d7548cc
...@@ -386,7 +386,7 @@ namespace OnlineStore.AssemblyLine ...@@ -386,7 +386,7 @@ namespace OnlineStore.AssemblyLine
//ClearMemory(); //ClearMemory();
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("LogM Error: ", ex); //LogUtil.error("LogM Error: ", ex);
} }
} }
object showLockObj = new object(); object showLockObj = new object();
......
...@@ -10,6 +10,7 @@ using System.Runtime.InteropServices; ...@@ -10,6 +10,7 @@ using System.Runtime.InteropServices;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using OnlineStore.DeviceLibrary; using OnlineStore.DeviceLibrary;
using System.Runtime.ExceptionServices;
namespace OnlineStore.AssemblyLine namespace OnlineStore.AssemblyLine
{ {
...@@ -52,6 +53,7 @@ namespace OnlineStore.AssemblyLine ...@@ -52,6 +53,7 @@ namespace OnlineStore.AssemblyLine
/// 应用程序的主入口点。 /// 应用程序的主入口点。
/// </summary> /// </summary>
[STAThread] [STAThread]
[HandleProcessCorruptedStateExceptions]
static void Main(string[] Args) static void Main(string[] Args)
{ {
//string code = " (X: 380,Y: 148) L00000000000WG9D19055;E20191230 0180;B7H.10618.5B1008082019123004000;R0080820191230E9600"; //string code = " (X: 380,Y: 148) L00000000000WG9D19055;E20191230 0180;B7H.10618.5B1008082019123004000;R0080820191230E9600";
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
<Compile Include="clientLine\HY\HY_Shunt.cs" /> <Compile Include="clientLine\HY\HY_Shunt.cs" />
<Compile Include="deviceLibrary\IO\NJSDot\SDotManager.cs" /> <Compile Include="deviceLibrary\IO\NJSDot\SDotManager.cs" />
<Compile Include="deviceLibrary\IO\NJSDot\NanjingSDotIO.cs" /> <Compile Include="deviceLibrary\IO\NJSDot\NanjingSDotIO.cs" />
<Compile Include="ESS\ESS_CancelBody.cs" />
<Compile Include="ESS\ESS_CreateTaskBody.cs" /> <Compile Include="ESS\ESS_CreateTaskBody.cs" />
<Compile Include="ESS\TaskStateInfo.cs" /> <Compile Include="ESS\TaskStateInfo.cs" />
<Compile Include="lineManager\ALineManager.cs" /> <Compile Include="lineManager\ALineManager.cs" />
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
internal class ESS_CancelBody
{
public List<string> taskCodes { get; set; }
}
}
...@@ -206,7 +206,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -206,7 +206,7 @@ namespace OnlineStore.DeviceLibrary
if (IOValue(IO_Type.AGV_BoxCheck).Equals(IO_VALUE.HIGH) && CheckStopWatch(trayCheckWait, TrayWaitTime, true)) if (IOValue(IO_Type.AGV_BoxCheck).Equals(IO_VALUE.HIGH) && CheckStopWatch(trayCheckWait, TrayWaitTime, true))
{ {
EquipBase equipBase = GetOutEquip(); EquipBase equipBase = GetOutEquip();
if (equipBase != null && equipBase.IsIdle(1)) if (equipBase != null && equipBase.IsIdle(1) && ContainerManager.CntofContainerOnLine() < 24)
{ {
ClearSpecifiedWarnMsg("等待下游"); ClearSpecifiedWarnMsg("等待下游");
waitNextIdleWatch.Stop(); waitNextIdleWatch.Stop();
...@@ -219,7 +219,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -219,7 +219,7 @@ namespace OnlineStore.DeviceLibrary
{ {
waitNextIdleWatch.Start(); waitNextIdleWatch.Start();
} }
if (waitNextIdleWatch.Elapsed.TotalSeconds >= 20) if (waitNextIdleWatch.Elapsed.TotalSeconds >= 60)
SetWarnMsg($"等待下游{equipBase.Name}空闲超时{FormUtil.GetSpanStr(waitNextIdleWatch.Elapsed)}"); SetWarnMsg($"等待下游{equipBase.Name}空闲超时{FormUtil.GetSpanStr(waitNextIdleWatch.Elapsed)}");
} }
} }
...@@ -305,7 +305,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -305,7 +305,7 @@ namespace OnlineStore.DeviceLibrary
else else
{ {
MoveInfo.NextMoveStep(LineMoveStep.FO_03_StopUp); MoveInfo.NextMoveStep(LineMoveStep.FO_03_StopUp);
LogInfo( "不存在下游,直接结束"); LogInfo("不存在下游,直接结束");
} }
} }
else if (MoveInfo.IsStep(LineMoveStep.FO_03_StopUp)) else if (MoveInfo.IsStep(LineMoveStep.FO_03_StopUp))
......
...@@ -283,6 +283,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -283,6 +283,10 @@ namespace OnlineStore.DeviceLibrary
PreContainerId = ""; PreContainerId = "";
CurContainerId = ""; CurContainerId = "";
} }
/// <summary>
/// 更新分拣台rfid
/// </summary>
/// <returns></returns>
internal RFIDData UpdateStationCode() internal RFIDData UpdateStationCode()
{ {
RFIDData ShelfId_Station = new RFIDData(); RFIDData ShelfId_Station = new RFIDData();
...@@ -298,6 +302,27 @@ namespace OnlineStore.DeviceLibrary ...@@ -298,6 +302,27 @@ namespace OnlineStore.DeviceLibrary
} }
return ShelfId_Station; return ShelfId_Station;
} }
internal bool GetStationCode(out string rfid)
{
rfid = "";
RFIDData ShelfId_Station = new RFIDData();
try
{
if (RFIDIP != null && RFIDIP.Count > 0)
{
//判断料架的编码是否正确
ShelfId_Station = RFIDManager.ReadRFID(RFIDIP[1]);
rfid = ShelfId_Station.StrData;
return ShelfId_Station.IsValidated();
}
}
catch (Exception ex)
{
LogUtil.error(Name + "UpdateStationCode 出错:", ex);
}
return false;
}
internal bool UpdateContainerCode() internal bool UpdateContainerCode()
{ {
RFIDData rfidData = RFIDManager.GetContainerCode(Name, DeviceID, 0); RFIDData rfidData = RFIDManager.GetContainerCode(Name, DeviceID, 0);
......
...@@ -844,6 +844,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -844,6 +844,12 @@ namespace OnlineStore.DeviceLibrary
if (data.IsValidated()) if (data.IsValidated())
{ {
map.Add($"s{equip.DeviceID}", data.StrData); map.Add($"s{equip.DeviceID}", data.StrData);
//自动上传出库料箱被其他工位拿走的状态
if(ContainerManager.GetOutStoreBox(data.ToContainerId()))
{
ContainerManager.UpdateTaskStatus(data.ToContainerId(), TaskStatus.FINISHED, $"s{equip.DeviceID}");
LogUtil.info($"出库容器被拿上工位s{equip.DeviceID},自动完成:{data.ToContainerId()}");
}
} }
else else
{ {
......
...@@ -87,7 +87,30 @@ namespace OnlineStore.DeviceLibrary ...@@ -87,7 +87,30 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.IsStep(LineMoveStep.SI_03_ReadAndCheckBox)) else if (MoveInfo.IsStep(LineMoveStep.SI_03_ReadAndCheckBox))
{ {
if (IsCurStationBox(curboxInfo)) if(GetStationCode(out string rfid))
{
EquipBase equipBase = GetOutEquip();
if (equipBase != null)
{
if (equipBase.IsIdle())
{
MoveInfo.NextMoveStep(LineMoveStep.SI_08_StopDown);
LogInfo($"分拣台有箱子{rfid},放行");
StopDown(MoveInfo);
}
else
{
MoveInfo.NextMoveStep(LineMoveStep.SI_09_WaitDownriverIdle);
LogInfo($"分拣台有箱子{rfid},等待下游{equipBase.Name}空闲再放行容器");
}
}
else
{
SetWarnMsg($"无下游信息,结束处理");
MoveEndS();
}
}
else if (IsCurStationBox(curboxInfo))
{ {
MoveInfo.NextMoveStep(LineMoveStep.SI_04_BoxArrive); MoveInfo.NextMoveStep(LineMoveStep.SI_04_BoxArrive);
LogInfo($" 该箱子是该工位出库容器,上报到达状态"); LogInfo($" 该箱子是该工位出库容器,上报到达状态");
......
...@@ -21,8 +21,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -21,8 +21,8 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.MoveParam = param; MoveInfo.MoveParam = param;
MoveInfo.NextMoveStep(LineMoveStep.SO_01_FrontStopUp); MoveInfo.NextMoveStep(LineMoveStep.SO_01_FrontStopUp);
FrontStopUp(MoveInfo); FrontStopUp(MoveInfo);
StopDown(MoveInfo); StopUp(MoveInfo);
LogInfo($"开始出库,前阻挡上升,阻挡下降"); LogInfo($"开始出库,前阻挡上升,阻挡上升");
return true; return true;
} }
protected override void OutStoreProcess() protected override void OutStoreProcess()
...@@ -39,19 +39,28 @@ namespace OnlineStore.DeviceLibrary ...@@ -39,19 +39,28 @@ namespace OnlineStore.DeviceLibrary
{ {
MoveInfo.NextMoveStep(LineMoveStep.SO_02_WaitBoxInToLine); MoveInfo.NextMoveStep(LineMoveStep.SO_02_WaitBoxInToLine);
AddWaitBoxCheck(true); AddWaitBoxCheck(true);
WaitTime(30000); WaitTime(3000);
MoveInfo.OneWaitCanEndStep = true; //MoveInfo.OneWaitCanEndStep = true;
LogInfo($"等待箱子离开工作站"); LogInfo($"等待箱子离开工作站");
} }
else if (MoveInfo.IsStep(LineMoveStep.SO_02_WaitBoxInToLine)) else if (MoveInfo.IsStep(LineMoveStep.SO_02_WaitBoxInToLine))
{ {
LogUtil.info("进入 SO_03_WaitTime 前");
MoveInfo.NextMoveStep(LineMoveStep.SO_03_WaitTime); MoveInfo.NextMoveStep(LineMoveStep.SO_03_WaitTime);
LogUtil.info("进入 SO_03_WaitTime 后"+$" barcode={MoveInfo?.MoveParam?.Containercode??""}");
ContainerManager.UpdateTaskStatus(MoveInfo.MoveParam.Containercode, TaskStatus.IN_ON_LINE); ContainerManager.UpdateTaskStatus(MoveInfo.MoveParam.Containercode, TaskStatus.IN_ON_LINE);
LogInfo($" 箱子离开工作站完成"); LogInfo($" 箱子到达线体,阻挡下降");
FrontStopDown(MoveInfo); StopDown(MoveInfo);
WaitTime(3000);
} }
else if (MoveInfo.IsStep(LineMoveStep.SO_03_WaitTime)) else if (MoveInfo.IsStep(LineMoveStep.SO_03_WaitTime))
{ {
MoveInfo.NextMoveStep(LineMoveStep.SO_04_FrontStopDown);
LogInfo($"前阻挡下降");
FrontStopDown(MoveInfo);
}
else if (MoveInfo.IsStep(LineMoveStep.SO_04_FrontStopDown))
{
MoveEndS(); MoveEndS();
} }
else else
......
...@@ -100,7 +100,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -100,7 +100,7 @@ namespace OnlineStore.DeviceLibrary
isInit = true; isInit = true;
string lineType = ConfigAppSettings.GetValue(Setting_Init.Line_Type); string lineType = ConfigAppSettings.GetValue(Setting_Init.Line_Type);
LogUtil.info(" 类型=" + lineType + ",开始加载 配置"); LogUtil.info("类型=" + lineType + ",开始加载 配置");
if (lineType == DeviceType.Line) if (lineType == DeviceType.Line)
{ {
string appPath = Application.StartupPath; string appPath = Application.StartupPath;
......
...@@ -5,10 +5,12 @@ using OnlineStore.LoadCSVLibrary; ...@@ -5,10 +5,12 @@ using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.Diagnostics.Eventing.Reader; using System.Diagnostics.Eventing.Reader;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
...@@ -41,6 +43,26 @@ namespace OnlineStore.DeviceLibrary ...@@ -41,6 +43,26 @@ namespace OnlineStore.DeviceLibrary
return new List<ContainerInfo>(containerInfoMap.Values); return new List<ContainerInfo>(containerInfoMap.Values);
} }
/// <summary> /// <summary>
/// 在线体上的料箱数量
/// </summary>
/// <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);
}
return 0;
}
/// <summary>
///处理未发送AGV任务的容器 ///处理未发送AGV任务的容器
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
...@@ -62,18 +84,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -62,18 +84,18 @@ namespace OnlineStore.DeviceLibrary
{ {
foreach (var item in getTrayList()) 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);
if (rtn) if (rtn)
{ {
if (item.Status.Equals(TaskStatus.ERROR)) if (item.Status.Equals(TaskStatus.ERROR))
{ {
bool res= containerInfoMap.TryRemove(item.ContainerValidCode, out ContainerInfo containerInfo); bool res = containerInfoMap.TryRemove(item.ContainerValidCode, out ContainerInfo containerInfo);
LogUtil.info($"容器状态上报成功,因任务异常,自动删除该任务【{res}】:【{JsonHelper.SerializeObject(containerInfo)}】"); LogUtil.info($"因任务异常,自动删除该任务【{res}】:【{JsonHelper.SerializeObject(containerInfo)}】");
} }
else if(item.Status.Equals(TaskStatus.FINISHED)) else if (item.Status.Equals(TaskStatus.FINISHED))
{ {
bool res = containerInfoMap.TryRemove(item.ContainerValidCode, out ContainerInfo containerInfo); bool res = containerInfoMap.TryRemove(item.ContainerValidCode, out ContainerInfo containerInfo);
LogUtil.info($"容器状态上报成功,任务完成【{res}】:【{JsonHelper.SerializeObject(containerInfo)}】"); LogUtil.info($"任务完成【{res}】:【{JsonHelper.SerializeObject(containerInfo)}】");
} }
} }
} }
...@@ -87,7 +109,35 @@ namespace OnlineStore.DeviceLibrary ...@@ -87,7 +109,35 @@ namespace OnlineStore.DeviceLibrary
} }
return null; return null;
} }
/// <summary>
/// 获取在线体上的出库箱子
/// </summary>
/// <param name="boxId"></param>
/// <returns>true,存在</returns>
public static bool GetOutStoreBox(string boxId)
{
ContainerInfo container = GetTrayInfo(boxId);
try
{
if (container != null)
{
if (container.InOrOutStore.Equals(ContainerType.OutStore))//&& (container.Status.Equals(TaskStatus.OUT_ON_LINE) || container.Status.Equals(TaskStatus.NEED_AWAY))
{
return true;
}
}
else
{
//LogUtil.error($"未找到容器信息: {boxId}");
return false;
}
}
catch (Exception ex)
{
LogUtil.error($"GetOutStoreBox {boxId}", ex);
}
return false;
}
/// <summary> /// <summary>
/// 站点是否有箱子准备进入 /// 站点是否有箱子准备进入
/// </summary> /// </summary>
...@@ -122,7 +172,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -122,7 +172,7 @@ namespace OnlineStore.DeviceLibrary
internal static bool StationHasOutTask(int deviceId, out InOutParam inOutParam) internal static bool StationHasOutTask(int deviceId, out InOutParam inOutParam)
{ {
inOutParam = new InOutParam(); inOutParam = new InOutParam();
if (GetOutTaskCnt(deviceId,out ContainerInfo containerInfo)) if (GetOutTaskCnt(deviceId, out ContainerInfo containerInfo))
{ {
inOutParam.Containercode = containerInfo.ContainerValidCode; inOutParam.Containercode = containerInfo.ContainerValidCode;
return true; return true;
...@@ -136,14 +186,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -136,14 +186,14 @@ namespace OnlineStore.DeviceLibrary
/// <returns></returns> /// <returns></returns>
internal static int GetOutTaskCnt(int deviceId) internal static int GetOutTaskCnt(int deviceId)
{ {
List<ContainerInfo> containerInfos = getTrayList().FindAll(s => s.InOrOutStore.Equals(ContainerType.InStore) List<ContainerInfo> containerInfos = getTrayList().FindAll(s => s.InOrOutStore.Equals(ContainerType.InStore)
&& s.InoutParam.DeviceId.Equals(deviceId) && (s.Status.Equals(TaskStatus.EXECUTING)|| s.Status.Equals(TaskStatus.WAIT))); && s.InoutParam.DeviceId.Equals(deviceId) && (s.Status.Equals(TaskStatus.EXECUTING) || s.Status.Equals(TaskStatus.WAIT)));
return containerInfos?.Count ?? 0; return containerInfos?.Count ?? 0;
} }
internal static bool GetOutTaskCnt(int deviceId,out ContainerInfo containerInfo) internal static bool GetOutTaskCnt(int deviceId, out ContainerInfo containerInfo)
{ {
containerInfo = getTrayList().Find(s => s.InOrOutStore.Equals(ContainerType.InStore) && s.InoutParam.DeviceId.Equals(deviceId) && s.Status.Equals(TaskStatus.EXECUTING)); containerInfo = getTrayList().Find(s => s.InOrOutStore.Equals(ContainerType.InStore) && s.InoutParam.DeviceId.Equals(deviceId) && s.Status.Equals(TaskStatus.EXECUTING));
return containerInfo !=null; return containerInfo != null;
} }
/// <summary> /// <summary>
/// 获取属于该工位的箱子 /// 获取属于该工位的箱子
...@@ -203,7 +253,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -203,7 +253,7 @@ namespace OnlineStore.DeviceLibrary
} }
else if (containerTarget.slotCode.Equals("s0"))//站点分拣台已有容器 else if (containerTarget.slotCode.Equals("s0"))//站点分拣台已有容器
{ {
return true;
} }
else //有入库的料 else //有入库的料
{ {
...@@ -237,12 +287,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -237,12 +287,13 @@ namespace OnlineStore.DeviceLibrary
} }
return false; return false;
} }
public static void AddOrUpdateContainerInfo(string containerCode) public static void AddOrUpdateContainerInfo(string containerCode)
{ {
if (string.IsNullOrEmpty(containerCode)) return; if (string.IsNullOrEmpty(containerCode)) return;
if(containerCode.EndsWith("A")|| containerCode.EndsWith("B")) if (containerCode.EndsWith("A") || containerCode.EndsWith("B"))
{ {
containerCode=containerCode.Substring(0,containerCode.Length-1); containerCode = containerCode.Substring(0, containerCode.Length - 1);
} }
if (containerInfoMap.ContainsKey(containerCode)) if (containerInfoMap.ContainsKey(containerCode))
{ {
...@@ -257,7 +308,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -257,7 +308,7 @@ namespace OnlineStore.DeviceLibrary
{ {
if (containerTarget.slotCode.Equals("0") || containerTarget.barcode.Equals("")) if (containerTarget.slotCode.Equals("0") || containerTarget.barcode.Equals(""))
{ {
UpdateContainerNumError(containerCode,"容器无目的地信息,请检查"); UpdateContainerNumError(containerCode, "容器无目的地信息,请检查");
return; return;
} }
UpdateContainerNumError("", ""); UpdateContainerNumError("", "");
...@@ -282,7 +333,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -282,7 +333,7 @@ namespace OnlineStore.DeviceLibrary
SaveMapToFile(); SaveMapToFile();
} }
} }
public static void AddOrUpdateContainerInfo(string stationName,string containerCode) public static void AddOrUpdateContainerInfo(string stationName, string containerCode)
{ {
if (string.IsNullOrEmpty(containerCode)) return; if (string.IsNullOrEmpty(containerCode)) return;
if (containerCode.EndsWith("A") || containerCode.EndsWith("B")) if (containerCode.EndsWith("A") || containerCode.EndsWith("B"))
...@@ -311,7 +362,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -311,7 +362,7 @@ namespace OnlineStore.DeviceLibrary
if (HasInstore(containerTarget, out string slotCode)) if (HasInstore(containerTarget, out string slotCode))
{ {
containerType = ContainerType.InStore; containerType = ContainerType.InStore;
int.TryParse(stationName.Substring(1), out deviceId); int.TryParse(stationName.Substring(1), out deviceId);
} }
else if (HasOutstore(containerTarget, out deviceId)) else if (HasOutstore(containerTarget, out deviceId))
{ {
...@@ -333,15 +384,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -333,15 +384,16 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
/// <param name="barcode"></param> /// <param name="barcode"></param>
/// <param name="status"></param> /// <param name="status"></param>
public static void UpdateTaskStatus(string barcode, string status,string loc="") public static void UpdateTaskStatus(string barcode, string status, string loc = "")
{ {
if (containerInfoMap.ContainsKey(barcode)) if (containerInfoMap.ContainsKey(barcode))
{ {
ContainerInfo containerInfo = containerInfoMap[barcode]; LogUtil.info($"已有缓存,更新容器状态:【{barcode}】【{status}】");
containerInfoMap[barcode].UpdateStatus(status,loc); containerInfoMap[barcode].UpdateStatus(status, loc);
} }
else else
{ {
LogUtil.info($"更新容器状态:【{barcode}】【{status}】");
AddOrUpdateContainerInfo(barcode); AddOrUpdateContainerInfo(barcode);
UpdateTaskStatus(barcode, status); UpdateTaskStatus(barcode, status);
} }
...@@ -401,6 +453,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -401,6 +453,7 @@ namespace OnlineStore.DeviceLibrary
static object saveObj = new object(); static object saveObj = new object();
static void SaveMapToFile() static void SaveMapToFile()
{ {
LogUtil.info("SaveMapToFile");
if (Monitor.TryEnter(saveObj, 500)) if (Monitor.TryEnter(saveObj, 500))
{ {
try try
......
...@@ -63,6 +63,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -63,6 +63,10 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
private static string Addr_createTask = "/task/create"; private static string Addr_createTask = "/task/create";
/// <summary> /// <summary>
/// ESS创建任务接口
/// </summary>
private static string Addr_cancelTask = "/task/cancel";
/// <summary>
/// 容器到达,发给ESS /// 容器到达,发给ESS
/// </summary> /// </summary>
/// <param name="essModel"></param> /// <param name="essModel"></param>
...@@ -208,7 +212,58 @@ namespace OnlineStore.DeviceLibrary ...@@ -208,7 +212,58 @@ namespace OnlineStore.DeviceLibrary
} }
return false; return false;
} }
/// <summary>
/// 取消出库任务
/// </summary>
/// <param name="containerInfos"></param>
/// <param name="debug"></param>
/// <returns></returns>
public static bool CancelOutStoreOrder(List<ContainerInfo> containerInfos, bool debug = false)
{
try
{
ESS_CancelBody body = new ESS_CancelBody();
body.taskCodes = new List<string>();
foreach (var item in containerInfos)
{
body.taskCodes.Add(item.TaskCode);
}
string param = JsonHelper.SerializeObject(body);
string path = ess_server + Addr_cancelTask;
if (HttpHelper.Post(path, param, out bool isTimueOut, out string outMsg))
{
ServerData1 server = JsonHelper.DeserializeJsonToObject<ServerData1>(outMsg);
if (server != null)
{
foreach (var item in containerInfos)
{
if (server.data.ContainsKey(item.TaskCode))
{
if (server.data[item.TaskCode].ToString().ToLower().Equals("ok"))
{
if (!debug)
ContainerManager.UpdateTaskStatus(item.ContainerValidCode, TaskStatus.EXECUTING);
}
}
}
LogUtil.info($"取消出库任务成功【{path}】【{param}】【{outMsg}】");
return true;
}
LogUtil.info($"取消出库任务失败,ESS返回失败【{path}】【{param}】【{outMsg}】");
return false;
}
else
{
LogUtil.error($"取消出库任务失败【{path}】【{param}】【{outMsg}】【{isTimueOut}】");
return false;
}
}
catch (Exception ex)
{
LogUtil.error($"取消出库任务异常:{JsonHelper.SerializeObject(containerInfos)}", ex);
}
return false;
}
#endregion #endregion
/// <summary> /// <summary>
...@@ -374,7 +429,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -374,7 +429,7 @@ namespace OnlineStore.DeviceLibrary
} }
if (string.IsNullOrEmpty(serverAddr)) if (string.IsNullOrEmpty(serverAddr))
{ {
LogUtil.error(deviceName + "UpdateTrayLoc [" + barcode + "] [" + status + "] :未找到服务器地址"); LogUtil.error(deviceName + " UpdateTrayLoc [" + barcode + "] [" + status + "] :未找到服务器地址");
return false; return false;
} }
...@@ -391,12 +446,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -391,12 +446,12 @@ namespace OnlineStore.DeviceLibrary
ServerData serverResult = JsonHelper.DeserializeJsonToObject<ServerData>(resultStr); ServerData serverResult = JsonHelper.DeserializeJsonToObject<ServerData>(resultStr);
if (serverResult == null) if (serverResult == null)
{ {
msg = deviceName + "UpdateTrayLoc【 " + barcode + "】【" + status + "】【" + locInfo + "】没有收到服务器反馈"; msg = deviceName + " UpdateTrayLoc【" + barcode + "】【" + status + "】【" + locInfo + "】没有收到服务器反馈";
} }
else if (serverResult.code.Equals(0).Equals(false)) else if (serverResult.code.Equals(0).Equals(false))
{ {
// code: 0为正常,其他为异常, msg: 消息, data: 为空 // code: 0为正常,其他为异常, msg: 消息, data: 为空
msg = deviceName + " UpdateTrayLoc【 " + barcode + "】【" + status + "】【" + locInfo + "】 :" + "[" + serverResult.code + "]" + serverResult.msg; msg = deviceName + " UpdateTrayLoc【" + barcode + "】【" + status + "】【" + locInfo + "】 :" + "[" + serverResult.code + "]" + serverResult.msg;
} }
if (!msg.Equals("")) if (!msg.Equals(""))
{ {
......
...@@ -321,6 +321,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -321,6 +321,7 @@ namespace OnlineStore.DeviceLibrary
/// 工位入库的料:等待一定时间 /// 工位入库的料:等待一定时间
/// </summary> /// </summary>
SO_03_WaitTime, SO_03_WaitTime,
SO_04_FrontStopDown,
#endregion #endregion
#region 入料工位-AGV #region 入料工位-AGV
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!