From 9e884640643ff361d41b3d46515a054de031546e Mon Sep 17 00:00:00 2001 From: icewint Date: Thu, 25 Jul 2024 12:41:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=86=99=E5=87=BA?= =?UTF-8?q?=E5=BA=93=E4=BB=BB=E5=8A=A1=E6=97=B6=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=B8=85=E7=90=86=E7=AB=99=E5=8F=B0?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WcsService/StackerConveyService.cs | 24 +++++++++---------- .../Service/WcsService/StackerService.cs | 8 +++---- .../CirculationTask/Convey/UploadBoxArrive.cs | 10 ++++---- .../HisGetData/Pick1StandOutC3.cs | 2 +- .../HisGetData/Pick2StandOutC4.cs | 2 +- .../EquipOperation/Convey/ConveyOperation.cs | 3 ++- .../Entity/Stacker/StackerPlcTask.cs | 2 +- .../Stacker/StackerOperation.cs | 2 +- .../ExtendMethod/AppWcsTaskExtendMethod.cs | 14 +++++------ 9 files changed, 34 insertions(+), 33 deletions(-) diff --git a/WcsMain/ApiServe/Service/WcsService/StackerConveyService.cs b/WcsMain/ApiServe/Service/WcsService/StackerConveyService.cs index e185520..9e34caa 100644 --- a/WcsMain/ApiServe/Service/WcsService/StackerConveyService.cs +++ b/WcsMain/ApiServe/Service/WcsService/StackerConveyService.cs @@ -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(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); } diff --git a/WcsMain/ApiServe/Service/WcsService/StackerService.cs b/WcsMain/ApiServe/Service/WcsService/StackerService.cs index b467e0e..fe7a4b1 100644 --- a/WcsMain/ApiServe/Service/WcsService/StackerService.cs +++ b/WcsMain/ApiServe/Service/WcsService/StackerService.cs @@ -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 diff --git a/WcsMain/Business/CirculationTask/Convey/UploadBoxArrive.cs b/WcsMain/Business/CirculationTask/Convey/UploadBoxArrive.cs index 38157ee..16c9b26 100644 --- a/WcsMain/Business/CirculationTask/Convey/UploadBoxArrive.cs +++ b/WcsMain/Business/CirculationTask/Convey/UploadBoxArrive.cs @@ -35,20 +35,20 @@ public class UploadBoxArrive(AppConveyStandDao conveyStandDao, ConveyOperation c ConsoleLog.Info($"【提示】无拣选站台信息,监控已经停止"); return false; } - List tasks = new(); + List 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!); + conveyOperation.ClearStandCodeStatus(stand.StandId!); // 查询 条码 对应的任务 List? pickTasks = conveyTaskDao.Query(new AppConveyTask() @@ -60,7 +60,7 @@ public class UploadBoxArrive(AppConveyStandDao conveyStandDao, ConveyOperation c if (pickTasks == default || pickTasks.Count < 1) { ConsoleLog.Error($"【异常】拣选站台{stand.Area} 料箱:{code} 找不到对应任务"); - conveyOperation.ClearStandCodeStatus(stand.Area!); + conveyOperation.ClearStandCodeStatus(stand.StandId!); return; } var pickTask = pickTasks[0]; // 拣选任务 @@ -73,7 +73,7 @@ public class UploadBoxArrive(AppConveyStandDao conveyStandDao, ConveyOperation c Remark = "PLC上报料箱到达" }); // 发送wms料箱到达 - UploadPickStandRequest request = new UploadPickStandRequest() + UploadPickStandRequest request = new() { PickStand = stand.Area, VehicleNo = pickTask.VehicleNo, diff --git a/WcsMain/Business/Convey/HistoryDataHandler/HisGetData/Pick1StandOutC3.cs b/WcsMain/Business/Convey/HistoryDataHandler/HisGetData/Pick1StandOutC3.cs index b216fec..be3b031 100644 --- a/WcsMain/Business/Convey/HistoryDataHandler/HisGetData/Pick1StandOutC3.cs +++ b/WcsMain/Business/Convey/HistoryDataHandler/HisGetData/Pick1StandOutC3.cs @@ -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} 不存在一号台任务,环线运行"); diff --git a/WcsMain/Business/Convey/HistoryDataHandler/HisGetData/Pick2StandOutC4.cs b/WcsMain/Business/Convey/HistoryDataHandler/HisGetData/Pick2StandOutC4.cs index 81b2512..02aac63 100644 --- a/WcsMain/Business/Convey/HistoryDataHandler/HisGetData/Pick2StandOutC4.cs +++ b/WcsMain/Business/Convey/HistoryDataHandler/HisGetData/Pick2StandOutC4.cs @@ -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号台任务,环线运行"); diff --git a/WcsMain/EquipOperation/Convey/ConveyOperation.cs b/WcsMain/EquipOperation/Convey/ConveyOperation.cs index dcd18d8..454bd5c 100644 --- a/WcsMain/EquipOperation/Convey/ConveyOperation.cs +++ b/WcsMain/EquipOperation/Convey/ConveyOperation.cs @@ -129,7 +129,8 @@ public class ConveyOperation { var readData = readResult.Value; short status = Convert.ToInt16(CommonTool.Siemens.Trans(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) diff --git a/WcsMain/EquipOperation/Entity/Stacker/StackerPlcTask.cs b/WcsMain/EquipOperation/Entity/Stacker/StackerPlcTask.cs index 1f6fb1a..1055f0f 100644 --- a/WcsMain/EquipOperation/Entity/Stacker/StackerPlcTask.cs +++ b/WcsMain/EquipOperation/Entity/Stacker/StackerPlcTask.cs @@ -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, diff --git a/WcsMain/EquipOperation/Stacker/StackerOperation.cs b/WcsMain/EquipOperation/Stacker/StackerOperation.cs index 9981427..d87cbfb 100644 --- a/WcsMain/EquipOperation/Stacker/StackerOperation.cs +++ b/WcsMain/EquipOperation/Stacker/StackerOperation.cs @@ -97,7 +97,7 @@ public class StackerOperation // UpLength = Convert.ToSingle(CommonTool.Siemens.Trans(data, 28)), // 提升距离 // ForkCount = Convert.ToInt32(CommonTool.Siemens.Trans(data, 32)), // 货叉动作次数 // SubmitPlcId = Convert.ToInt32(CommonTool.Siemens.Trans(data, 36)), // 提交的任务 - // DeletePlcId = Convert.ToInt32(CommonTool.Siemens.Trans(data, 40)), // 删除的任务 + DeletePlcId = Convert.ToInt32(CommonTool.Siemens.Trans(data, 40)), // 删除的任务 Spare1 = Convert.ToInt32(CommonTool.Siemens.Trans(data, 44)), // 备用1 // Spare2 = Convert.ToInt16(CommonTool.Siemens.Trans(data, 48)), // 备用2 }; diff --git a/WcsMain/ExtendMethod/AppWcsTaskExtendMethod.cs b/WcsMain/ExtendMethod/AppWcsTaskExtendMethod.cs index 98c005e..645da84 100644 --- a/WcsMain/ExtendMethod/AppWcsTaskExtendMethod.cs +++ b/WcsMain/ExtendMethod/AppWcsTaskExtendMethod.cs @@ -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),