From 4ba2eba294e2e32d4e09cd29f4162e72eae4ef9e Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期二, 10 六月 2025 23:29:56 +0800
Subject: [PATCH] 2
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/CTU_AGVController .cs | 88 +++++++++++++++++++++++++++++++++++++++++--
1 files changed, 83 insertions(+), 5 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/CTU_AGVController .cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/CTU_AGVController .cs"
index 4003aba..9ecc331 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/CTU_AGVController .cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/CTU_AGVController .cs"
@@ -14,6 +14,7 @@
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_Tasks;
+using WIDESEAWCS_Tasks.ConveyorLineJob;
using static Dm.net.buffer.ByteArrayBuffer;
namespace WIDESEAWCS_Server.Controllers
@@ -174,6 +175,7 @@
var task = _taskRepository.QueryFirst(x => agvUpdateModel.TaskCode == x.AgvTaskNum);
//鏄惁瀛樺湪杈撻�佺嚎浣撳緟AGV鎼繍浠诲姟
var taskExecutes = _taskRepository.QueryData(x => x.NextAddress == task.CurrentAddress && x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt() && x.TaskType == TaskTypeEnum.InProduct.ObjToInt());
+ var taskExecutesFL = _taskRepository.QueryData(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && x.DeviceCode=="AGV_FL" && !string.IsNullOrEmpty(x.DeviceCode));
if (task == null) throw new Exception($"鏈壘鍒颁换鍔�,浠诲姟鍙枫�恵agvUpdateModel.TaskCode}銆�");
switch (agvUpdateModel.Method.ToUpper())
@@ -283,13 +285,82 @@
_taskRepository.UpdateData(task);
}
}
+ else //鏇存敼杈呮枡鍙栬揣
+ {
+ //鏄惁瀛樺湪杈撻�佺嚎浣撳緟AGV鎼繍浠诲姟
+ if (taskExecutesFL.Count > 0)
+ {
+ //璋冪敤AGV棰勮皟搴︽帴鍙�
+ AgvScheduleTaskDTO agvScheduleTask = new AgvScheduleTaskDTO()
+ {
+ PositionCode = "8001",
+ NextTask = "90",
+ UseableLayers = "1",
+ CacheCount = "1",
+ Update = "0",
+ AgvTyp = "10",
+ PreTaskQty = "1",
+ ReqCode = Guid.NewGuid().ToString().Replace("-", ""),
+ ReqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+ };
+ WebResponseContent contentFL = _taskService.AgvPreScheduleTask(agvScheduleTask);
+ if (!contentFL.Status)
+ {
+ agvResponseContent.Code = "1";
+ agvResponseContent.Message = contentFL.Message;
+ return agvResponseContent;
+ }
+ }
+ else //绾夸綋鏃犱换鍔�
+ {
+ //璋冪敤AGV棰勮皟搴︽帴鍙�
+ AgvScheduleTaskDTO agvScheduleTask = new AgvScheduleTaskDTO()
+ {
+ PositionCode = "8001",
+ NextTask = "15",
+ UseableLayers = "1",
+ CacheCount = "1",
+ Update = "0",
+ AgvTyp = "10",
+ PreTaskQty = "1",
+ ReqCode = Guid.NewGuid().ToString().Replace("-", ""),
+ ReqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+ };
+ WebResponseContent contentFL = _taskService.AgvPreScheduleTask(agvScheduleTask);
+ if (!contentFL.Status)
+ {
+ agvResponseContent.Code = "1";
+ agvResponseContent.Message = contentFL.Message;
+ return agvResponseContent;
+ }
+ }
+ //鑾峰彇璋冨叆鍙傛暟
+ AGVBoxApplyPassDTO boxApplyPassDTO = new AGVBoxApplyPassDTO()
+ {
+ ReqCode = Guid.NewGuid().ToString().Replace("-", ""),
+ ReqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+ TaskCode = task.AgvTaskNum
+ };
+ boxApplyPassDTO.Type = "1";
+ //璇锋眰鏂欑鍥炶皟鎺ュ彛
+ WebResponseContent content = _taskService.AgvBoxApplyPass(boxApplyPassDTO);
+ if (content.Status && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
+ {
+ _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing);
+ }
+ else
+ {
+ task.ExceptionMessage = content.Message;
+ _taskService.UpdateTask(task, TaskStatusEnum.Exception);
+ }
+ }
break;
case "APPLYFROMAGV":
//鏇存敼鎴愬搧鍑篈GV鏀捐揣浠诲姟鐘舵��
- if (task.TaskType == TaskTypeEnum.OutProduct.ObjToInt())
- {
+ //if (task.TaskType == TaskTypeEnum.OutProduct.ObjToInt())
+ //{
_taskService.UpdateTask(task, TaskStatusEnum.AGV_WaitToExecute);
- }
+ //}
break;
case "OUTBIN":
if (task.TaskType == TaskTypeEnum.InProduct.ObjToInt() || task.TaskType == TaskTypeEnum.InProductBack.ObjToInt())
@@ -374,7 +445,7 @@
/// <param name="code"></param>
/// <returns></returns>
[HttpPost, HttpGet, Route("PutFinish"), AllowAnonymous]
- public WebResponseContent PutFinish(string code)
+ public WebResponseContent PutFinish(string code,string barCode="",string taskNum="")
{
try
{
@@ -390,8 +461,15 @@
}
OtherDevice otherDevice = (OtherDevice)device;
+
+ if (!barCode.IsNullOrEmpty() && !taskNum.IsNullOrEmpty())
+ {
+ otherDevice.SetValue(W_ConveyorLineFLDB.Barcode, barCode, stationManger.StationCode);
+ Thread.Sleep(500);
+ otherDevice.SetValue(W_ConveyorLineFLDB.TaskNum, taskNum, stationManger.StationCode);
+ Thread.Sleep(500);
+ }
otherDevice.SetValue(GroundStationDBName.W_PutFinish, true, stationManger.StationCode);
-
return WebResponseContent.Instance.OK();
}
catch (Exception ex)
--
Gitblit v1.9.3