<fix>修复写出库任务时的问题,修复清理站台状态失败的问题

This commit is contained in:
葛林强 2024-07-25 12:41:21 +08:00
parent cf6adc6027
commit 9e88464064
9 changed files with 34 additions and 33 deletions

View File

@ -8,6 +8,7 @@ using WcsMain.EquipOperation.Convey;
using WcsMain.EquipOperation.StackerConvey; using WcsMain.EquipOperation.StackerConvey;
using WcsMain.Plugins; using WcsMain.Plugins;
using WcsMain.WcsAttribute.AutoFacAttribute; using WcsMain.WcsAttribute.AutoFacAttribute;
using static Dm.net.buffer.ByteArrayBuffer;
namespace WcsMain.ApiServe.Service.WcsService; namespace WcsMain.ApiServe.Service.WcsService;
@ -41,26 +42,25 @@ public class StackerConveyService(AppStackerConveyDao stackerConveyDao, ConveyOp
foreach (var stackerConvey in stackerConveys) foreach (var stackerConvey in stackerConveys)
{ {
StackerConveyStatusResponse stackerConveyStatusResponse = ObjectCopy.CopyProperties<AppStackerConvey, StackerConveyStatusResponse>(stackerConvey); StackerConveyStatusResponse stackerConveyStatusResponse = ObjectCopy.CopyProperties<AppStackerConvey, StackerConveyStatusResponse>(stackerConvey);
// 读取允许取放货状态
// ---- 取货站台
if (stackerConvey.LocationType == 1)
{
stackerConveyStatusResponse.AllowAction = conveyOperation.AllowGetVehicle(stackerConvey.WcsLocation![..1]);
stackerConveyStatusResponse.Message = "查询成功"; stackerConveyStatusResponse.Message = "查询成功";
// 读取条码 // 读取条码
(string? errText, string? code) = conveyOperation.ReadConveyCode(stackerConvey.WcsLocation); (string? errText, string? code) = conveyOperation.ReadConveyCode(stackerConvey.WcsLocation);
if(!string.IsNullOrEmpty(errText)) if (!string.IsNullOrEmpty(errText))
{ {
stackerConveyStatusResponse.Message = errText; stackerConveyStatusResponse.Message = errText;
responseData.Add(stackerConveyStatusResponse);
continue;
} }
stackerConveyStatusResponse.Code = code; stackerConveyStatusResponse.Code = code;
// 读取允许取放货状态
// ---- 取货站台
if(stackerConvey.LocationType == 1)
{
stackerConveyStatusResponse.AllowAction = conveyOperation.AllowGetVehicle(stackerConvey.WcsLocation![..1]);
} }
if(stackerConvey.LocationType == 2) if(stackerConvey.LocationType == 2)
{ {
stackerConveyStatusResponse.AllowAction = conveyOperation.AllowSetVehicle(stackerConvey.WcsLocation![..1]); stackerConveyStatusResponse.AllowAction = conveyOperation.AllowSetVehicle(stackerConvey.WcsLocation![..1]);
stackerConveyStatusResponse.Code = "-";
} }
responseData.Add(stackerConveyStatusResponse); responseData.Add(stackerConveyStatusResponse);
} }

View File

@ -53,14 +53,14 @@ public class StackerService(AppStackerDao stackerDao, StackerOperation stackerOp
if(string.IsNullOrEmpty(errMsg) && stackerInfo != default) if(string.IsNullOrEmpty(errMsg) && stackerInfo != default)
{ {
stackerStatusResponse.Message = "查询成功"; stackerStatusResponse.Message = "查询成功";
stackerStatusResponse.PlcId = stackerInfo.PlcId.ToString(); stackerStatusResponse.PlcId = stackerInfo.PlcId.ToString() + "/" + stackerInfo.Spare1.ToString();
stackerStatusResponse.ControlModel = stackerInfo.ControlModel.ToString(); stackerStatusResponse.ControlModel = ((int)stackerInfo.ControlModel).ToString();
stackerStatusResponse.StackerStatusEquip = stackerInfo.StackerStatus.ToString(); stackerStatusResponse.StackerStatusEquip = ((int)stackerInfo.StackerStatus).ToString();
stackerStatusResponse.Queue = stackerInfo.Row; stackerStatusResponse.Queue = stackerInfo.Row;
stackerStatusResponse.Line = stackerInfo.Line; stackerStatusResponse.Line = stackerInfo.Line;
stackerStatusResponse.Layer = stackerInfo.Layer; stackerStatusResponse.Layer = stackerInfo.Layer;
stackerStatusResponse.Depth = stackerInfo.Depth; stackerStatusResponse.Depth = stackerInfo.Depth;
stackerStatusResponse.Code = stackerInfo.Code.ToString(); stackerStatusResponse.Code = stackerInfo.Code.ToString() + "/" + stackerInfo.DeletePlcId.ToString();
stackerStatusResponse.ErrCode = stackerInfo.ErrCode; stackerStatusResponse.ErrCode = stackerInfo.ErrCode;
} }
else else

View File

@ -35,20 +35,20 @@ public class UploadBoxArrive(AppConveyStandDao conveyStandDao, ConveyOperation c
ConsoleLog.Info($"【提示】无拣选站台信息,监控已经停止"); ConsoleLog.Info($"【提示】无拣选站台信息,监控已经停止");
return false; return false;
} }
List<Task> tasks = new(); List<Task> tasks = [];
foreach (AppConveyStand stand in _pickStands) foreach (AppConveyStand stand in _pickStands)
{ {
Thread.Sleep(20); Thread.Sleep(20);
Task task = new(() => Task task = new(() =>
{ {
string code = conveyOperation.ReadStandCode(stand.Area!); string code = conveyOperation.ReadStandCode(stand.StandId!);
code = Regex.Replace(code, "\\W", ""); code = Regex.Replace(code, "\\W", "");
if (string.IsNullOrEmpty(code)) if (string.IsNullOrEmpty(code))
{ {
return; return;
} }
ConsoleLog.Info($"【提示】料箱:{code} 已经到达拣选站台:{stand.Area}"); ConsoleLog.Info($"【提示】料箱:{code} 已经到达拣选站台:{stand.Area}");
conveyOperation.ClearStandCodeStatus(stand.Area!); conveyOperation.ClearStandCodeStatus(stand.StandId!);
// 查询 条码 对应的任务 // 查询 条码 对应的任务
List<AppConveyTask>? pickTasks = conveyTaskDao.Query(new AppConveyTask() List<AppConveyTask>? pickTasks = conveyTaskDao.Query(new AppConveyTask()
@ -60,7 +60,7 @@ public class UploadBoxArrive(AppConveyStandDao conveyStandDao, ConveyOperation c
if (pickTasks == default || pickTasks.Count < 1) if (pickTasks == default || pickTasks.Count < 1)
{ {
ConsoleLog.Error($"【异常】拣选站台{stand.Area} 料箱:{code} 找不到对应任务"); ConsoleLog.Error($"【异常】拣选站台{stand.Area} 料箱:{code} 找不到对应任务");
conveyOperation.ClearStandCodeStatus(stand.Area!); conveyOperation.ClearStandCodeStatus(stand.StandId!);
return; return;
} }
var pickTask = pickTasks[0]; // 拣选任务 var pickTask = pickTasks[0]; // 拣选任务
@ -73,7 +73,7 @@ public class UploadBoxArrive(AppConveyStandDao conveyStandDao, ConveyOperation c
Remark = "PLC上报料箱到达" Remark = "PLC上报料箱到达"
}); });
// 发送wms料箱到达 // 发送wms料箱到达
UploadPickStandRequest request = new UploadPickStandRequest() UploadPickStandRequest request = new()
{ {
PickStand = stand.Area, PickStand = stand.Area,
VehicleNo = pickTask.VehicleNo, VehicleNo = pickTask.VehicleNo,

View File

@ -78,7 +78,7 @@ public class Pick1StandOutC3(ConveyOperation conveyOperation, DataBaseData dataB
return; return;
} }
/* 判断拣选任务中有没有 1 号台的任务,若有则给一号路向 */ /* 判断拣选任务中有没有 1 号台的任务,若有则给一号路向 */
var pickStand1Task = conveyTasks.Find(f => f.Location == "P1"); var pickStand1Task = conveyTasks.Find(f => f.Location == "ASRS-#1");
if(pickStand1Task == default) // 不存在 1 号台任务 if(pickStand1Task == default) // 不存在 1 号台任务
{ {
ConsoleLog.Warning($"【警告】一区出口:{area} 箱码:{msg} 不存在一号台任务,环线运行"); ConsoleLog.Warning($"【警告】一区出口:{area} 箱码:{msg} 不存在一号台任务,环线运行");

View File

@ -106,7 +106,7 @@ public class Pick2StandOutC4(ConveyOperation conveyOperation, DataBaseData dataB
else // 6~9 站台pick2 区域) else // 6~9 站台pick2 区域)
{ {
/* 检查有没有 6 站台的任务 */ /* 检查有没有 6 站台的任务 */
var pickStand6Task = conveyTasks.Find(f => f.Location == "P6"); var pickStand6Task = conveyTasks.Find(f => f.Location == "ASRS-#6");
if (pickStand6Task == default) // 不存在 6 号台任务 if (pickStand6Task == default) // 不存在 6 号台任务
{ {
ConsoleLog.Warning($"【警告】二区出口:{area} 箱码:{msg} 不存在6号台任务环线运行"); ConsoleLog.Warning($"【警告】二区出口:{area} 箱码:{msg} 不存在6号台任务环线运行");

View File

@ -129,7 +129,8 @@ public class ConveyOperation
{ {
var readData = readResult.Value; var readData = readResult.Value;
short status = Convert.ToInt16(CommonTool.Siemens.Trans<short>(readData, 0)); // PLC 返回任务状态 short status = Convert.ToInt16(CommonTool.Siemens.Trans<short>(readData, 0)); // PLC 返回任务状态
string code = Regex.Replace(Encoding.ASCII.GetString(readData, 2, 20), "\\W", ""); if (status == 0) return string.Empty;
string code = Regex.Replace(Encoding.ASCII.GetString(readData, 0, 20), "\\W", "");
return code; return code;
} }
catch (Exception ex) catch (Exception ex)

View File

@ -133,7 +133,7 @@ public class StackerPlcTask
GetDeep = 1, GetDeep = 1,
SetQueue = 2, SetQueue = 2,
SetLine = Convert.ToInt16(forkId), SetLine = Convert.ToInt16(forkId),
SetLayer = 2, SetLayer = 3,
SetDeep = 1, SetDeep = 1,
Size = 0, Size = 0,
Weight = 0, Weight = 0,

View File

@ -97,7 +97,7 @@ public class StackerOperation
// UpLength = Convert.ToSingle(CommonTool.Siemens.Trans<float>(data, 28)), // 提升距离 // UpLength = Convert.ToSingle(CommonTool.Siemens.Trans<float>(data, 28)), // 提升距离
// ForkCount = Convert.ToInt32(CommonTool.Siemens.Trans<int>(data, 32)), // 货叉动作次数 // ForkCount = Convert.ToInt32(CommonTool.Siemens.Trans<int>(data, 32)), // 货叉动作次数
// SubmitPlcId = Convert.ToInt32(CommonTool.Siemens.Trans<int>(data, 36)), // 提交的任务 // SubmitPlcId = Convert.ToInt32(CommonTool.Siemens.Trans<int>(data, 36)), // 提交的任务
// DeletePlcId = Convert.ToInt32(CommonTool.Siemens.Trans<int>(data, 40)), // 删除的任务 DeletePlcId = Convert.ToInt32(CommonTool.Siemens.Trans<int>(data, 40)), // 删除的任务
Spare1 = Convert.ToInt32(CommonTool.Siemens.Trans<int>(data, 44)), // 备用1 Spare1 = Convert.ToInt32(CommonTool.Siemens.Trans<int>(data, 44)), // 备用1
// Spare2 = Convert.ToInt16(CommonTool.Siemens.Trans<short>(data, 48)), // 备用2 // Spare2 = Convert.ToInt16(CommonTool.Siemens.Trans<short>(data, 48)), // 备用2
}; };

View File

@ -92,12 +92,12 @@ public static class AppWcsTaskExtendMethod
OutTunnelId = Convert.ToInt16(stackerId), OutTunnelId = Convert.ToInt16(stackerId),
SetStand = 0, SetStand = 0,
GetQueue = Convert.ToInt16(originDetail.Queue), GetQueue = Convert.ToInt16(originDetail.Queue),
GetLine = Convert.ToInt16(originDetail.Queue), GetLine = Convert.ToInt16(originDetail.Line),
GetLayer = Convert.ToInt16(originDetail.Queue), GetLayer = Convert.ToInt16(originDetail.Layer),
GetDeep = Convert.ToInt16(originDetail.Queue), GetDeep = Convert.ToInt16(originDetail.Depth),
SetQueue = 2, SetQueue = 2,
SetLine = Convert.ToInt16(forkId), SetLine = Convert.ToInt16(forkId),
SetLayer = 2, SetLayer = 3,
SetDeep = 1, SetDeep = 1,
Size = Convert.ToInt16(wcsTask.VehicleSize), Size = Convert.ToInt16(wcsTask.VehicleSize),
Weight = Convert.ToInt16(wcsTask.Weight), Weight = Convert.ToInt16(wcsTask.Weight),
@ -126,9 +126,9 @@ public static class AppWcsTaskExtendMethod
OutTunnelId = Convert.ToInt16(stackerId), OutTunnelId = Convert.ToInt16(stackerId),
SetStand = 0, SetStand = 0,
GetQueue = Convert.ToInt16(originDetail.Queue), GetQueue = Convert.ToInt16(originDetail.Queue),
GetLine = Convert.ToInt16(originDetail.Queue), GetLine = Convert.ToInt16(originDetail.Line),
GetLayer = Convert.ToInt16(originDetail.Queue), GetLayer = Convert.ToInt16(originDetail.Layer),
GetDeep = Convert.ToInt16(originDetail.Queue), GetDeep = Convert.ToInt16(originDetail.Depth),
SetQueue = Convert.ToInt16(destinationDetail.Queue), SetQueue = Convert.ToInt16(destinationDetail.Queue),
SetLine = Convert.ToInt16(destinationDetail.Line), SetLine = Convert.ToInt16(destinationDetail.Line),
SetLayer = Convert.ToInt16(destinationDetail.Layer), SetLayer = Convert.ToInt16(destinationDetail.Layer),