From 531c6e89dc07bb6997e6249a6cd9f53a9bd474a5 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期一, 23 三月 2026 10:31:54 +0800
Subject: [PATCH] 出库逻辑变更
---
项目代码/WCS/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs | 519 ++++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 420 insertions(+), 99 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs"
index 3c93ccd..05a3d45 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs"
@@ -2,12 +2,16 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Text;
+using System.Text.RegularExpressions;
using WIDESEA_DTO.Agv;
+using WIDESEA_External.Model;
+using WIDESEAWCS_Common.APIEnum;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Enums;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_Core.LogHelper;
+using WIDESEAWCS_DTO;
using WIDESEAWCS_DTO.Agv;
using WIDESEAWCS_IBasicInfoRepository;
using WIDESEAWCS_ITaskInfoRepository;
@@ -20,6 +24,7 @@
using WIDESEAWCS_Tasks;
using WIDESEAWCS_Tasks.ConveyorLineJob;
using WIDESEAWCS_Tasks.DBNames;
+using WIDESEAWCS_Tasks.StackPlateJob;
using static Dm.net.buffer.ByteArrayBuffer;
namespace WIDESEAWCS_Server.Controllers
@@ -68,7 +73,7 @@
}
else//鍑哄簱鏀捐揣璇锋眰
{
- var content = PutRequest(task.NextAddress, task.PalletType);
+ var content = PutRequest(task.NextAddress, task);
if (!content.Status)
{
throw new Exception(content.Message);
@@ -87,7 +92,7 @@
}
else//鍏ュ簱鏀捐揣璇锋眰
{
- var content = PutRequest(task.NextAddress, task.TaskNum);
+ var content = PutRequest(task.NextAddress, task);
if (!content.Status)
{
throw new Exception(content.Message);
@@ -257,7 +262,7 @@
{
throw new Exception($"{task.NextAddress}AGV绔欏彴鏈畾涔�");
}
- if (task.TaskType == TaskTypeEnum.PrintYLInbound.ObjToInt() || task.TaskType == TaskTypeEnum.PrintYLBackInbound.ObjToInt())
+ if (task.TaskType == TaskTypeEnum.PrintYLInbound.ObjToInt() || task.TaskType == TaskTypeEnum.PrintYLBackInbound.ObjToInt() || task.TaskType == TaskTypeEnum.EmptyStackPlate.ObjToInt())
{
List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == task.TaskType && task.NextAddress == x.StartPosi);
Dt_Router router = routers.FirstOrDefault();
@@ -273,6 +278,10 @@
_taskService.UpdateTask(task, TaskStatusEnum.AGV_Finish);
PutFinish(oldAddress, task.TaskNum);
}
+ else if (task.TaskType == TaskTypeEnum.WFBLMYLBackInbound.ObjToInt() || task.TaskType == TaskTypeEnum.WFBYLInbound.ObjToInt() || task.TaskType == TaskTypeEnum.WFBLMYLInbound.ObjToInt())
+ {
+ _taskService.TaskCompleted(task.TaskNum);
+ }
else
{
task.CurrentAddress = dt_Station.StationCode;
@@ -286,7 +295,7 @@
else
{
_taskService.TaskCompleted(task.TaskNum);
- if (task.TaskType==TaskTypeEnum.PrintYLOutbound.ObjToInt())
+ if (task.TaskType==TaskTypeEnum.PrintYLOutbound.ObjToInt() || task.TaskType == TaskTypeEnum.OutCarton.ObjToInt())
{
PutFinish(task.NextAddress);
}
@@ -310,7 +319,7 @@
/// <param name="palletType"></param>
/// <returns></returns>
[HttpPost, HttpGet, Route("PutRequest"), AllowAnonymous]
- public WebResponseContent PutRequest(string code, int taskNum)
+ public WebResponseContent PutRequest(string code, Dt_Task task)
{
WebResponseContent content = new WebResponseContent();
try
@@ -320,65 +329,132 @@
{
return content.Error($"鏈壘鍒扮珯鍙伴厤缃�");
}
+ #region todo:涓存椂閫昏緫
+ if (stationManger.StationDeviceCode=="MES")
+ {
+
+ RequestAGVArriveDTO requestAGVArriveDTO =new RequestAGVArriveDTO()
+ {
+ SD_WorkCentreAgvArriveNoticeInfo=new List<AgvArriveNotice> { new AgvArriveNotice()
+ {
+ DispatchPlanMaterialId=task.DispatchPlanId,
+ WorkCentreCode=task.WorkCentreCode,
+ LocationCode=code,
+ CallId=Guid.NewGuid().ToString().Replace("-","")
+ } }
+ };
+ MESResponse response = _taskService.MESAvgArriveNotice(requestAGVArriveDTO).DeserializeObject<MESResponse>() ?? throw new Exception("鏈幏鍙栧埌杩斿洖淇℃伅");
+ if (!response.Result)
+ {
+ throw new Exception($"璋冪敤MES灏忚溅鍏佽鏀捐揣鎶ラ敊,MES杩斿洖淇℃伅"+ Regex.Replace(response.Msg, @"\\u([0-9a-fA-F]{4})", match =>{
+ return ((char)Convert.ToInt32(match.Groups[1].Value, 16)).ToString();
+ }));
+ }
+ if (response.Obj)
+ {
+ return content.Error($"鍏佽鍙栨枡");
+ }
+ else
+ {
+ return content.Error($"绂佹鏀炬枡");
+ }
+
+ }
+ #endregion
IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode);
if (device == null)
{
return content.Error($"鏈壘鍒板搴旇澶�");
}
+ if (device.DeviceCode.Contains("Plate"))
+ {
+ CommonConveyorLine commonConveyorLine = (CommonConveyorLine)device;
+ StackPlateTaskCommandCommand command = commonConveyorLine.ReadCustomer<StackPlateTaskCommandCommand>(device.DeviceCode);
- OtherDevice otherDevice = (OtherDevice)device;
+ if (command != null && command.State == 2 && command.InteractiveSignal == 1)
+ {
+ return content.OK("鍏佽鏀炬枡");
+ }
+ else
+ {
+ return content.Error("绂佹鏀炬枡");
+ }
+ }
+ else
+ {
- if (device.DeviceCode.Contains("CP"))//鎴愬搧杈撻�佺嚎
- {
- short Command = otherDevice.GetValue<R_ConveyorLineCPDB, short>(R_ConveyorLineCPDB.Command, stationManger.StationCode);
- if (Command == 3)
+ OtherDevice otherDevice = (OtherDevice)device;
+
+ if (device.DeviceCode.Contains("CP"))//鎴愬搧杈撻�佺嚎
{
- content.OK("鍏佽鏀炬枡");
+ short Command = otherDevice.GetValue<R_ConveyorLineCPDB, short>(R_ConveyorLineCPDB.Command, stationManger.StationCode);
+ if (Command == 3)
+ {
+ content.OK("鍏佽鏀炬枡");
+ }
+ else
+ {
+ return content.Error("绂佹鏀炬枡");
+ }
}
- else
+ else if (device.DeviceCode.Contains("Coveryor"))//鎺ラ┏鍙�
{
- return content.Error("绂佹鏀炬枡");
+ bool RequestPut = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_RequestPut, stationManger.StationDeviceCode);
+ if (!RequestPut)
+ {
+ otherDevice.SetValue(CoveryorDB.C_InTaskNum, task.TaskNum, stationManger.StationDeviceCode);
+ otherDevice.SetValue(CoveryorDB.C_RequestPut, true, stationManger.StationDeviceCode);
+ Thread.Sleep(1000);
+ }
+ bool AllowFinish = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_AllowFinish, stationManger.StationDeviceCode);
+ if (AllowFinish)
+ {
+ content.OK("鍏佽鏀炬枡");
+ }
+ else
+ {
+ return content.Error("绂佹鏀炬枡");
+ }
+ }
+ else if (device.DeviceCode.Contains("Retract"))//浼哥缉璐у弶
+ {
+ bool RequestPut = otherDevice.GetValue<RetractDB, bool>(RetractDB.Ret_RequestPut, stationManger.StationDeviceCode);
+ if (!RequestPut)
+ {
+ otherDevice.SetValue(RetractDB.Ret_TargetAddress, Convert.ToInt16(stationManger.StationCode), stationManger.StationDeviceCode);
+ otherDevice.SetValue(RetractDB.Ret_RequestPut, true, stationManger.StationDeviceCode);
+ Thread.Sleep(1000);
+ }
+ bool AllowFinish = otherDevice.GetValue<RetractDB, bool>(RetractDB.Ret_AllowFinish, stationManger.StationDeviceCode);
+ if (AllowFinish)
+ {
+ content.OK("鍏佽鏀炬枡");
+ }
+ else
+ {
+ return content.Error("绂佹鏀炬枡");
+ }
+ }
+ else if (device.DeviceCode.Contains("TrussDixieCup"))//妗佹灦
+ {
+
+ bool RequestPut = otherDevice.GetValue<W_TrussDixieCupDB, bool>(GetTrussDixieCupOutReq(stationManger.StackerCraneStationCode), stationManger.StationDeviceCode);
+ if (!RequestPut)
+ {
+ otherDevice.SetValue(GetTrussDixieCupOutReq(stationManger.StackerCraneStationCode), true, stationManger.StationDeviceCode);
+ Thread.Sleep(1000);
+ }
+ bool AllowFinish = otherDevice.GetValue<R_TrussDixieCupDB, bool>(GetDixieCupPutOut(stationManger.StackerCraneStationCode), stationManger.StationDeviceCode);
+ if (AllowFinish)
+ {
+ content.OK("鍏佽鏀炬枡");
+ }
+ else
+ {
+ return content.Error("绂佹鏀炬枡");
+ }
}
}
- else if (device.DeviceCode.Contains("Coveryor"))//鎺ラ┏鍙�
- {
- bool RequestPut = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_RequestPut, stationManger.StationDeviceCode);
- if (!RequestPut)
- {
- otherDevice.SetValue(CoveryorDB.C_InTaskNum, taskNum, stationManger.StationDeviceCode);
- otherDevice.SetValue(CoveryorDB.C_RequestPut, true, stationManger.StationDeviceCode);
- Thread.Sleep(1000);
- }
- bool AllowFinish = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_AllowFinish, stationManger.StationDeviceCode);
- if (AllowFinish)
- {
- content.OK("鍏佽鏀炬枡");
- }
- else
- {
- return content.Error("绂佹鏀炬枡");
- }
- }
- else if (device.DeviceCode.Contains("Retract"))//浼哥缉璐у弶
- {
- bool RequestPut = otherDevice.GetValue<RetractDB, bool>(RetractDB.Ret_RequestPut, stationManger.StationDeviceCode);
- if (!RequestPut)
- {
- otherDevice.SetValue(RetractDB.Ret_TargetAddress, Convert.ToInt16(stationManger.StationCode), stationManger.StationDeviceCode);
- otherDevice.SetValue(RetractDB.Ret_RequestPut, true, stationManger.StationDeviceCode);
- Thread.Sleep(1000);
- }
- bool AllowFinish = otherDevice.GetValue<RetractDB, bool>(RetractDB.Ret_AllowFinish, stationManger.StationDeviceCode);
- if (AllowFinish)
- {
- content.OK("鍏佽鏀炬枡");
- }
- else
- {
- return content.Error("绂佹鏀炬枡");
- }
- }
-
return content;
}
catch (Exception ex)
@@ -408,21 +484,148 @@
{
return WebResponseContent.Instance.Error($"鏈壘鍒板搴旇澶�");
}
-
- OtherDevice otherDevice = (OtherDevice)device;
- if (device.DeviceCode.Contains("Coveryor"))//鎺ラ┏鍙�
+ if (device.DeviceCode.Contains("Plate"))
{
- otherDevice.SetValue(CoveryorDB.C_PutFinish, true, stationManger.StationDeviceCode);
+ CommonConveyorLine commonConveyorLine = (CommonConveyorLine)device;
+ commonConveyorLine.SetValue(StackPlateDBName.WriteInteractiveSignal, Convert.ToInt16(1), device.DeviceCode);
+ return WebResponseContent.Instance.OK();
}
- else if (device.DeviceCode.Contains("Retract"))//浼哥缉璐у弶
+ else
{
- otherDevice.SetValue(RetractDB.Ret_PutFinish, true, stationManger.StationDeviceCode);
+ OtherDevice otherDevice = (OtherDevice)device;
+ if (device.DeviceCode.Contains("Coveryor"))//鎺ラ┏鍙�
+ {
+ otherDevice.SetValue(CoveryorDB.C_PutFinish, true, stationManger.StationDeviceCode);
+ }
+ else if (device.DeviceCode.Contains("Retract"))//浼哥缉璐у弶
+ {
+ otherDevice.SetValue(RetractDB.Ret_PutFinish, true, stationManger.StationDeviceCode);
+ }
+ else if (device.DeviceCode.Contains("TrussDixieCup"))//绾告澂妗佹灦
+ {
+ otherDevice.SetValue(GetTrussDixieCupPuted(stationManger.StackerCraneStationCode), true, stationManger.StationDeviceCode);
+ }
}
return WebResponseContent.Instance.OK();
}
catch (Exception ex)
{
return WebResponseContent.Instance.Error(ex.Message);
+ }
+ }
+ /// <summary>
+ /// 鑾峰彇妗佹灦鏀炬枡淇″彿
+ /// </summary>
+ private W_TrussDixieCupDB GetTrussDixieCupPuted(string StationCode)
+ {
+ switch (StationCode)
+ {
+ case "1":
+ return W_TrussDixieCupDB.W_DixieCupPuted1;
+ case "2":
+ return W_TrussDixieCupDB.W_DixieCupPuted2;
+ case "3":
+ return W_TrussDixieCupDB.W_DixieCupPuted3;
+ case "4":
+ return W_TrussDixieCupDB.W_DixieCupPuted4;
+ default:
+ throw new Exception("鏈畾涔夊伐浣�");
+ }
+ }
+ /// <summary>
+ /// 鑾峰彇妗佹灦鍙栨枡鏂欎俊鍙�
+ /// </summary>
+ private W_TrussDixieCupDB GetTrussDixieCupTaked(string StationCode)
+ {
+ switch (StationCode)
+ {
+ case "1":
+ return W_TrussDixieCupDB.W_DixieCupTaked1;
+ case "2":
+ return W_TrussDixieCupDB.W_DixieCupTaked2;
+ case "3":
+ return W_TrussDixieCupDB.W_DixieCupTaked3;
+ case "4":
+ return W_TrussDixieCupDB.W_DixieCupTaked4;
+ default:
+ throw new Exception("鏈畾涔夊伐浣�");
+ }
+ }
+ /// <summary>
+ /// 鑾峰彇妗佹灦璇锋眰杩涗俊鍙�
+ /// </summary>
+ private W_TrussDixieCupDB GetTrussDixieCupOutReq(string StationCode)
+ {
+ switch (StationCode)
+ {
+ case "1":
+ return W_TrussDixieCupDB.W_DixieCupReqPut1;
+ case "2":
+ return W_TrussDixieCupDB.W_DixieCupReqPut2;
+ case "3":
+ return W_TrussDixieCupDB.W_DixieCupReqPut3;
+ case "4":
+ return W_TrussDixieCupDB.W_DixieCupReqPut4;
+ default:
+ throw new Exception("鏈畾涔夊伐浣�");
+ }
+ }
+ /// <summary>
+ /// 鑾峰彇妗佹灦璇锋眰杩涗俊鍙�
+ /// </summary>
+ private W_TrussDixieCupDB GetTrussDixieCupInReq(string StationCode)
+ {
+ switch (StationCode)
+ {
+ case "1":
+ return W_TrussDixieCupDB.W_DixieCupReqTake1;
+ case "2":
+ return W_TrussDixieCupDB.W_DixieCupReqTake2;
+ case "3":
+ return W_TrussDixieCupDB.W_DixieCupReqTake3;
+ case "4":
+ return W_TrussDixieCupDB.W_DixieCupReqTake4;
+ default:
+ throw new Exception("鏈畾涔夊伐浣�");
+ }
+ }
+
+ /// <summary>
+ /// 鑾峰彇妗佹灦杩涘叆淇″彿
+ /// </summary>
+ private R_TrussDixieCupDB GetDixieCupPutOut(string StationCode)
+ {
+ switch (StationCode)
+ {
+ case "1":
+ return R_TrussDixieCupDB.R_DixieCupPutOut1;
+ case "2":
+ return R_TrussDixieCupDB.R_DixieCupPutOut2;
+ case "3":
+ return R_TrussDixieCupDB.R_DixieCupPutOut3;
+ case "4":
+ return R_TrussDixieCupDB.R_DixieCupPutOut4;
+ default:
+ throw new Exception("鏈畾涔夊伐浣�");
+ }
+ }
+ /// <summary>
+ /// 鑾峰彇妗佹灦杩涘叆淇″彿
+ /// </summary>
+ private R_TrussDixieCupDB GetDixieCupTakeIn(string StationCode)
+ {
+ switch (StationCode)
+ {
+ case "1":
+ return R_TrussDixieCupDB.R_DixieCupTakeIn1;
+ case "2":
+ return R_TrussDixieCupDB.R_DixieCupTakeIn2;
+ case "3":
+ return R_TrussDixieCupDB.R_DixieCupTakeIn3;
+ case "4":
+ return R_TrussDixieCupDB.R_DixieCupTakeIn4;
+ default:
+ throw new Exception("鏈畾涔夊伐浣�");
}
}
@@ -448,46 +651,79 @@
{
return WebResponseContent.Instance.Error($"鏈壘鍒板搴旇澶噞stationManger.StationDeviceCode}");
}
-
- OtherDevice otherDevice = (OtherDevice)device;
-
- if (otherDevice.DeviceCode.Contains("CP"))//鎴愬搧杈撻�佺嚎
+ if (device.DeviceCode.Contains("Plate"))
{
- short Command = otherDevice.GetValue<R_ConveyorLineCPDB, short>(R_ConveyorLineCPDB.Command, stationManger.StationCode);
- if (Command == 2)
+ CommonConveyorLine commonConveyorLine = (CommonConveyorLine)device;
+ StackPlateTaskCommandCommand command = commonConveyorLine.ReadCustomer<StackPlateTaskCommandCommand>(device.DeviceCode);
+
+ if (command != null&&command.State == 2 && command.InteractiveSignal == 2)
{
- content.OK("鍏佽鍙栨枡");
+ return content.OK("鍏佽鍙栨枡");
}
else
{
return content.Error("绂佹鍙栨枡");
}
}
- else if (device.DeviceCode.Contains("Coveryor"))//鎺ラ┏鍙�
+ else
{
- bool AllowTake = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_AllowTake, stationManger.StationDeviceCode);
- if (AllowTake)
- {
- content.OK("鍏佽鍙栨枡");
- }
- else
- {
- return content.Error("绂佹鍙栨枡");
- }
- }
- else if (device.DeviceCode.Contains("Retract"))//浼哥缉璐у弶
- {
- bool AllowTake = otherDevice.GetValue<RetractDB, bool>(RetractDB.Ret_AllowTake, stationManger.StationDeviceCode);
- if (AllowTake)
- {
- content.OK("鍏佽鍙栨枡");
- }
- else
- {
- return content.Error("绂佹鍙栨枡");
- }
- }
+ OtherDevice otherDevice = (OtherDevice)device;
+ if (otherDevice.DeviceCode.Contains("CP"))//鎴愬搧杈撻�佺嚎
+ {
+ short Command = otherDevice.GetValue<R_ConveyorLineCPDB, short>(R_ConveyorLineCPDB.Command, stationManger.StationCode);
+ if (Command == 2)
+ {
+ content.OK("鍏佽鍙栨枡");
+ }
+ else
+ {
+ return content.Error("绂佹鍙栨枡");
+ }
+ }
+ else if (device.DeviceCode.Contains("Coveryor"))//鎺ラ┏鍙�
+ {
+ bool AllowTake = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_AllowTake, stationManger.StationDeviceCode);
+ if (AllowTake)
+ {
+ content.OK("鍏佽鍙栨枡");
+ }
+ else
+ {
+ return content.Error("绂佹鍙栨枡");
+ }
+ }
+ else if (device.DeviceCode.Contains("Retract"))//浼哥缉璐у弶
+ {
+ bool AllowTake = otherDevice.GetValue<RetractDB, bool>(RetractDB.Ret_AllowTake, stationManger.StationDeviceCode);
+ if (AllowTake)
+ {
+ content.OK("鍏佽鍙栨枡");
+ }
+ else
+ {
+ return content.Error("绂佹鍙栨枡");
+ }
+ }
+ else if (device.DeviceCode.Contains("TrussDixieCup"))
+ {
+ bool RequestPut = otherDevice.GetValue<W_TrussDixieCupDB, bool>(GetTrussDixieCupInReq(stationManger.StackerCraneStationCode), stationManger.StationDeviceCode);
+ if (!RequestPut)
+ {
+ otherDevice.SetValue(GetTrussDixieCupInReq(stationManger.StackerCraneStationCode), true, stationManger.StationDeviceCode);
+ Thread.Sleep(1000);
+ }
+ bool AllowFinish = otherDevice.GetValue<R_TrussDixieCupDB, bool>(GetDixieCupTakeIn(stationManger.StackerCraneStationCode), stationManger.StationDeviceCode);
+ if (AllowFinish)
+ {
+ content.OK("鍏佽鍙栨枡");
+ }
+ else
+ {
+ return content.Error("绂佹鍙栨枡");
+ }
+ }
+ }
return content;
}
catch (Exception ex)
@@ -496,7 +732,6 @@
}
}
- //[HttpPost, HttpGet, Route("TakeFinish"), AllowAnonymous]
/// <summary>
/// 鍙栬揣瀹屾垚
/// </summary>
@@ -517,19 +752,31 @@
{
return WebResponseContent.Instance.Error($"鏈壘鍒板搴旇澶�");
}
-
- OtherDevice otherDevice = (OtherDevice)device;
- if (device.DeviceCode.Contains("CP"))
+ if (device.DeviceCode.Contains("Plate"))
{
- otherDevice.SetValue(W_ConveyorLineCPDB.W_Command, 2, stationManger.StationCode);
+ CommonConveyorLine commonConveyorLine = (CommonConveyorLine)device;
+ commonConveyorLine.SetValue(StackPlateDBName.WriteInteractiveSignal, Convert.ToInt16(2), device.DeviceCode);
+ return WebResponseContent.Instance.OK();
}
- else if (device.DeviceCode.Contains("Coveryor"))
+ else
{
- otherDevice.SetValue(CoveryorDB.C_TakeFinish, true, stationManger.StationDeviceCode);
- }
- else if (device.DeviceCode.Contains("Retract"))//浼哥缉璐у弶
- {
- otherDevice.SetValue(RetractDB.Ret_TakeFinish, true, stationManger.StationDeviceCode);
+ OtherDevice otherDevice = (OtherDevice)device;
+ if (device.DeviceCode.Contains("CP"))
+ {
+ otherDevice.SetValue(W_ConveyorLineCPDB.W_Command, 2, stationManger.StationCode);
+ }
+ else if (device.DeviceCode.Contains("Coveryor"))
+ {
+ otherDevice.SetValue(CoveryorDB.C_TakeFinish, true, stationManger.StationDeviceCode);
+ }
+ else if (device.DeviceCode.Contains("Retract"))//浼哥缉璐у弶
+ {
+ otherDevice.SetValue(RetractDB.Ret_TakeFinish, true, stationManger.StationDeviceCode);
+ }
+ else if (device.DeviceCode.Contains("TrussDixieCup"))//绾告澂妗佹灦
+ {
+ otherDevice.SetValue(GetTrussDixieCupTaked(stationManger.StackerCraneStationCode), true, stationManger.StationDeviceCode);
+ }
}
return WebResponseContent.Instance.OK();
@@ -539,5 +786,79 @@
return WebResponseContent.Instance.Error(ex.Message);
}
}
+ /// <summary>
+ /// AGV纭瀹屾垚鎺ュ彛(鍙栨斁)
+ /// </summary>
+ /// <param name="code"></param>
+ /// <returns></returns>
+ [HttpPost, HttpGet, Route("AGVFinish"), AllowAnonymous]
+ public WebResponseContent AGVFinish(string address,int taskNum)
+ {
+ try
+ {
+ Dt_Task task = _taskRepository.QueryFirst(x=>x.TaskNum==taskNum && x.DeviceCode=="AGV");
+ if (task==null)
+ {
+ return WebResponseContent.Instance.Error($"{taskNum}AGV浠诲姟涓嶅瓨鍦�");
+ }
+ //鑾峰彇瀵瑰簲鐨勫潗鏍囩偣
+ Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x=>x.AGVStationCode== address);
+ if (stationManger==null)
+ {
+ return WebResponseContent.Instance.Error($"{address}AGV鍦板潃缂栧彿涓嶅瓨鍦�");
+ }
+ if (task.TaskState == TaskStatusEnum.AGV_Executing.ObjToInt())//鍙栬揣
+ {
+ if (task.CurrentAddress != stationManger.StationCode)
+ {
+ return WebResponseContent.Instance.Error($"{taskNum}AGV浠诲姟鍙栬揣鍦板潃缂栧彿涓嶆槸{address}");
+ }
+ AgvFinishDTO agvFinishDTO = new AgvFinishDTO()
+ {
+ ReceiveTaskID = task.TaskNum.ToString(),
+ Variables = new List<PointDetail>()
+ {
+ new PointDetail()
+ {
+ Code="isPick",
+ Value="true"
+ }
+ }
+ };
+ //鍙戦�丄GV瀹屾垚閫氱煡
+ WebResponseContent content = _taskService.AGVFinish(agvFinishDTO);
+ if (!content.Status)
+ throw new Exception(content.Message);
+ }
+ else//鏀捐揣
+ {
+ if (task.NextAddress != stationManger.StationCode)
+ {
+ return WebResponseContent.Instance.Error($"{taskNum}AGV浠诲姟鏀捐揣鍦板潃缂栧彿涓嶆槸{address}");
+ }
+ AgvFinishDTO agvFinishDTO = new AgvFinishDTO()
+ {
+ ReceiveTaskID = task.TaskNum.ToString(),
+ Variables = new List<PointDetail>()
+ {
+ new PointDetail()
+ {
+ Code="isDown",
+ Value="true"
+ }
+ }
+ };
+ //鍙戦�丄GV瀹屾垚閫氱煡
+ WebResponseContent content = _taskService.AGVFinish(agvFinishDTO);
+ if (!content.Status)
+ throw new Exception(content.Message);
+ }
+ return WebResponseContent.Instance.OK();
+ }
+ catch (Exception ex)
+ {
+ return WebResponseContent.Instance.Error(ex.Message);
+ }
+ }
}
}
--
Gitblit v1.9.3