Compare commits

..

2 Commits

17 changed files with 64 additions and 50 deletions

View File

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

View File

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

View File

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

View File

@ -45,8 +45,16 @@ public class ResolveWmsTask(AppWmsTaskDao wmsTaskDao, SendWmsTaskStatus sendWmsT
private void ResolveTask(AppWmsTask wmsTask)
{
/* 校验起点终点是否在点位表 */
if (wmsTask.TaskType == (int)WmsTaskTypeEnum.inTask)
{
wmsTask.Origin ??= "R";
}
if (wmsTask.TaskType == (int)WmsTaskTypeEnum.outTask)
{
wmsTask.Destination ??= "C";
}
bool checkResult = CommonData.AppLocations.ExistWmsLocation(wmsTask.Origin, wmsTask.Destination);
if(!checkResult)
if (!checkResult)
{
wmsTaskDao.Update(new()
{
@ -268,7 +276,7 @@ public class ResolveWmsTask(AppWmsTaskDao wmsTaskDao, SendWmsTaskStatus sendWmsT
/// </summary>
/// <param name="wmsTask"></param>
/// <returns></returns>
private List<AppWcsTask>? TransOtherTaskToWcsTask(AppWmsTask wmsTask)
private List<AppWcsTask>? TransOtherTaskToWcsTask(AppWmsTask _)
{
return default;
}

View File

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

View File

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

View File

@ -34,7 +34,7 @@ public class PickStandGetData(ConveyOperation conveyOperation, DataBaseData data
string errText = conveyOperation.WriteTask(area, plcTask);
if (string.IsNullOrEmpty(errText))
{
ConsoleLog.Success($"拣选站台:{area} 读码失败写入PLC成功{plcTask}");
ConsoleLog.Warning($"拣选站台:{area} 读码失败写入PLC成功{plcTask}");
return;
}
ConsoleLog.Warning($"【警告】拣选站台:{area} 读码失败写入PLC失败{plcTask},信息:{errText}");

View File

@ -32,7 +32,7 @@ public class PickStandP5(ConveyOperation conveyOperation, DataBaseData dataBaseD
string errText = conveyOperation.WriteTask(area, plcTask);
if (string.IsNullOrEmpty(errText))
{
ConsoleLog.Success($"拣选站台:{area} 读码失败写入PLC成功{plcTask}");
ConsoleLog.Warning($"拣选站台:{area} 读码失败写入PLC成功{plcTask}");
return;
}
ConsoleLog.Warning($"【警告】拣选站台:{area} 读码失败写入PLC失败{plcTask},信息:{errText}");

View File

@ -14,6 +14,9 @@ namespace WcsMain.Business.Convey.HistoryDataHandler.HisGetData;
/// <summary>
/// 入库异常异常口判定 ---- 卡特专用 ---- 苏州卡特
/// </summary>
/// <remarks>
/// R3
/// </remarks>
public class StackerInErr(ConveyOperation conveyOperation, DataBaseData dataBaseData, AppWcsTaskDao wcsTaskDao) : IBaseGetData
{
/// <summary>
@ -30,7 +33,7 @@ public class StackerInErr(ConveyOperation conveyOperation, DataBaseData dataBase
string errText = conveyOperation.WriteTask(area, plcTask);
if (string.IsNullOrEmpty(errText))
{
ConsoleLog.Success($"入库异常口:{area} 读码失败写入PLC成功{plcTask}");
ConsoleLog.Warning($"入库异常口:{area} 读码失败写入PLC成功{plcTask}");
return;
}
ConsoleLog.Warning($"【警告】入库异常口:{area} 读码失败写入PLC失败{plcTask},信息:{errText}");

View File

@ -15,7 +15,7 @@ namespace WcsMain.Business.Convey.HistoryDataHandler.HisGetData;
/// 入库分流 ---- 卡特专用 ---- 苏州卡特
/// </summary>
/// <remarks>
/// R2
/// R2,R4
/// </remarks>
public class StackerInSpliter(ConveyOperation conveyOperation, DataBaseData dataBaseData, AppWcsTaskDao wcsTaskDao) : IBaseGetData
{
@ -34,7 +34,7 @@ public class StackerInSpliter(ConveyOperation conveyOperation, DataBaseData data
string errText = conveyOperation.WriteTask(area, plcTask);
if(string.IsNullOrEmpty(errText) )
{
ConsoleLog.Success($"入库分流:{area} 读码失败写入PLC成功{plcTask}");
ConsoleLog.Warning($"入库分流:{area} 读码失败写入PLC成功{plcTask}");
return;
}
ConsoleLog.Warning($"【警告】入库分流:{area} 读码失败写入PLC失败{plcTask},信息:{errText}");

View File

@ -32,7 +32,7 @@ public class StackerOutC1(ConveyOperation conveyOperation, DataBaseData dataBase
string errText = conveyOperation.WriteTask(area, plcTask);
if (string.IsNullOrEmpty(errText))
{
ConsoleLog.Success($"出库分流:{area} 读码失败写入PLC成功{plcTask}");
ConsoleLog.Warning($"出库分流:{area} 读码失败写入PLC成功{plcTask}");
return;
}
ConsoleLog.Warning($"【警告】出库分流:{area} 读码失败写入PLC失败{plcTask},信息:{errText}");

View File

@ -25,7 +25,7 @@ public class StackerOutErrC2(ConveyOperation conveyOperation, DataBaseData dataB
string errText = conveyOperation.WriteTask(area, plcTask);
if (string.IsNullOrEmpty(errText))
{
ConsoleLog.Success($"出库异常口:{area} 读码失败写入PLC成功{plcTask}");
ConsoleLog.Warning($"出库异常口:{area} 读码失败写入PLC成功{plcTask}");
return;
}
ConsoleLog.Warning($"【警告】出库异常口:{area} 读码失败写入PLC失败{plcTask},信息:{errText}");

View File

@ -55,7 +55,9 @@ public class AppConveyTaskDao
.WhereIF(conveyTask.Location != default, w => w.Location == conveyTask.Location)
.WhereIF(conveyTask.ArriveLocation != default, w => w.ArriveLocation == conveyTask.ArriveLocation)
.WhereIF(conveyTask.CreatePerson != default, w => w.CreatePerson == conveyTask.CreatePerson)
.WhereIF(conveyTask.Remark != default, w => w.Remark == conveyTask.Remark);
.WhereIF(conveyTask.Remark != default, w => w.Remark == conveyTask.Remark)
.OrderBy(o => o.CreateTime);
return sqlFuc.ToList();
}
catch(Exception ex)

View File

@ -129,7 +129,8 @@ public class ConveyOperation
{
var readData = readResult.Value;
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;
}
catch (Exception ex)

View File

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

View File

@ -97,7 +97,7 @@ public class StackerOperation
// UpLength = Convert.ToSingle(CommonTool.Siemens.Trans<float>(data, 28)), // 提升距离
// ForkCount = Convert.ToInt32(CommonTool.Siemens.Trans<int>(data, 32)), // 货叉动作次数
// 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
// Spare2 = Convert.ToInt16(CommonTool.Siemens.Trans<short>(data, 48)), // 备用2
};

View File

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