From 52ba6b195a4126df405ef453d52ba6eaab6521da Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期五, 17 四月 2026 17:37:32 +0800
Subject: [PATCH] 优化3-4楼提升机以及添加报错接口
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs | 106 ++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 97 insertions(+), 9 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs"
index bc292cc..fa1faeb 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs"
@@ -34,6 +34,11 @@
try
{
Dt_HKLocationInfo? hKLocationInfo = null;
+ int containerType = taskDTO.containerCode.Contains("LXM") ? (int)LocationTypeEnum.LargePallet : (int)LocationTypeEnum.SmallPallet;
+ if (taskType == (int)TaskTypeEnum.STURR)
+ {
+ var reslut = _stationInfo.Repository.QueryFirst(x => x.StationCode == taskDTO.fromLocationCode) ?? throw new Exception($"鏈壘鍒拌捣鐐硅揣浣嶃�恵taskDTO.fromLocationCode}銆�");
+ }
#region 鐐瑰埌鐐�
if (!string.IsNullOrEmpty(taskDTO.toLocationCode))
{
@@ -43,15 +48,15 @@
#endregion
//鑾峰彇璐т綅淇℃伅
else
- hKLocationInfo = _hKLocationInfoService.GetFreeLocationInfo(taskDTO.toAreaCode) ?? throw new Exception($"鏈壘鍒扮粓鐐瑰簱鍖恒�恵taskDTO.toAreaCode}銆戝彲鐢ㄧ┖璐т綅锛�");
- if (taskType==(int)TaskTypeEnum.Q1TSJ4)
+ hKLocationInfo = _hKLocationInfoService.GetFreeLocationInfo(taskDTO.toAreaCode, containerType) ?? throw new Exception($"鏈壘鍒扮粓鐐瑰簱鍖恒�恵taskDTO.toAreaCode}銆戝彲鐢ㄧ┖璐т綅锛�");
+ if (taskType == (int)TaskTypeEnum.Q1TSJ4)
{
var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "TSJ") as OtherDevice;
if (device.IsConnected)
{
var reslu = device.GetValue<HoistEnum, string>(HoistEnum.Emptycontainernumber);
var result = reslu?.TrimEnd('\0')?.Substring(2);
- if (reslu== taskDTO.containerCode&&result!=null)
+ if (reslu == taskDTO.containerCode && result != null)
{
throw new Exception($"褰撳墠鐨勬枡绠卞彿涓簕reslu}涓巤taskDTO.containerCode}鏂欑鍙蜂笉鍖归厤");
}
@@ -126,11 +131,19 @@
WebResponseContent content = new WebResponseContent();
try
{
+ //4妤煎簱鍐呭埌鎻愬崌鏈�
Dt_HKLocationInfo? hKLocationInfo = _hKLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.fromLocationCode) ?? throw new Exception($"鏈壘鍒拌捣鐐瑰簱浣嶃�恵taskDTO.fromLocationCode}銆戯紒");
if (hKLocationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt()) throw new Exception($"璧风偣搴撲綅銆恵taskDTO.fromLocationCode}銆戝綋鍓嶅簱浣嶇姸鎬佷笉鍙嚭搴擄紒");
if (hKLocationInfo.PalletCode != taskDTO.containerCode) throw new Exception($"璧风偣搴撲綅銆恵taskDTO.fromLocationCode}銆戠粦瀹氭枡绠卞彿銆恵hKLocationInfo.PalletCode}銆戜笌浠诲姟鏂欑鍙枫�恵taskDTO.containerCode}銆戜笉鍖归厤锛�");
- //搴撳唴鍒板簱澶栫殑鐐瑰埌鐐逛换鍔★紝鏄惁闇�瑕佸垽鏂揣浣嶇姸鎬侊紵
-
+ //搴撳唴鍒扮幇杈圭殑鐐瑰埌鐐逛换鍔★紝鏄惁闇�瑕佸垽鏂揣浣嶇姸鎬侊紵
+ if (taskType == (int)TaskTypeEnum.STU0003)
+ {
+ var reslut = _stationInfo.Repository.QueryFirst(x => x.StationCode == taskDTO.toLocationCode) ?? throw new Exception($"鏈壘鍒扮粓鐐硅揣浣嶃�恵taskDTO.toLocationCode}銆�");
+ if (reslut.StationStatus != (int)LocationStatusEnum.Free)
+ {
+ throw new Exception($"缁堢偣绔欏彴銆恵taskDTO.toLocationCode}銆戠姸鎬佷笉涓虹┖闂诧紒");
+ }
+ }
Dt_Task dt_Task = new Dt_Task()
{
TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
@@ -242,12 +255,19 @@
try
{
var tasktype = (TaskTypeEnum)Enum.GetValues(typeof(TaskTypeEnum)).GetValue(task.TaskType - 1);
-
hIKROBOTTaskSubmit.initPriority = task.Grade;
+ if (task.PalletCode == "MR-Q3-600LE-D(M)")
+ {
+ hIKROBOTTaskSubmit.robotType = "19"; //娴峰悍 杞繍杞�
+ }
+ else if (task.PalletCode == "MR-Q3-600LE-D(M)(YWGP)")
+ {
+ hIKROBOTTaskSubmit.robotType = "20"; //娴峰悍 绌烘墭鐩樿溅锛屼竴妤煎埌鍏ゼ锛�6妤煎埌涓�妤�
+ }
+ hIKROBOTTaskSubmit.taskType = tasktype.ToString();
+ ExtraDto extraDto = new ExtraDto();
hIKROBOTTaskSubmit.robotTaskCode = task.WMSTaskNum;
- hIKROBOTTaskSubmit.taskType = tasktype.ToString(); ExtraDto extraDto = new ExtraDto();
- if (task.TaskType != (int)TaskTypeEnum.MOVE &&task.TaskType != (int)TaskTypeEnum.Q3RK && task.TaskType != (int)TaskTypeEnum.Q3CK &&
- task.TaskType != (int)TaskTypeEnum.F01)
+ if (task.TaskType != (int)TaskTypeEnum.MOVE && task.TaskType != (int)TaskTypeEnum.Q3RK && task.TaskType != (int)TaskTypeEnum.Q3CK && task.TaskType != (int)TaskTypeEnum.F01)
{
CarrierInfoDto carrierInfoDto = new CarrierInfoDto()
{
@@ -353,6 +373,26 @@
hIKROBOTTaskSubmit.targetRoute.Add(targetRoute);
}
break;
+ case TaskTypeEnum.STUPTBY:
+ {
+ TargetRouteDto target = new TargetRouteDto()
+ {
+ code = task.CurrentAddress,
+ operation = "DELIVERY",//鍙栬揣
+ seq = 0,
+ type = "STORAGE",
+ };
+ TargetRouteDto targetRoute = new TargetRouteDto()
+ {
+ code = task.NextAddress,
+ operation = "DELIVERY",//閫佽揣
+ seq = 1,
+ type = "STORAGE",
+ };
+ hIKROBOTTaskSubmit.targetRoute.Add(target);
+ hIKROBOTTaskSubmit.targetRoute.Add(targetRoute);
+ }
+ break;
case TaskTypeEnum.CPMoveInventory:
break;
default:
@@ -425,5 +465,53 @@
return content;
}
+
+
+ /// <summary>
+ /// 娴峰悍璁惧鎶ヨ
+ /// </summary>
+ /// <param name="hKDeviceAalarmDTO"></param>
+ /// <returns></returns>
+ public WebResponseContent HKDeviceAlarm(HKDeviceAalarmDTO hKDeviceAalarmDTO)
+ {
+ WebResponseContent content = new WebResponseContent();
+ WMSReturn wMSReturn = null;
+ HKDeviceAalarmDTO hIKROBOTDeviceAlarm = null;
+ try
+ {
+ Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(HKDeviceAalarmDTO)) ?? throw new Exception("鏈壘鍒颁笂鎶ユ捣搴稟GV璁惧鎶ヨ鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
+ hIKROBOTDeviceAlarm = new HKDeviceAalarmDTO()
+ {
+ robotTaskCode = hKDeviceAalarmDTO.robotTaskCode,
+ taskWarnCode = hKDeviceAalarmDTO.taskWarnCode,
+ startTime = hKDeviceAalarmDTO.startTime,
+ singleRobotCode = hKDeviceAalarmDTO.singleRobotCode,
+ errorCode = hKDeviceAalarmDTO.errorCode,
+ errorMsg = hKDeviceAalarmDTO.errorMsg,
+ extra = hKDeviceAalarmDTO.extra,
+ };
+
+ string response = HttpHelper.Post(apiInfo.ApiAddress,hIKROBOTDeviceAlarm.Serialize());
+ wMSReturn = response.DeserializeObject<WMSReturn>();
+ if (wMSReturn.success == true && wMSReturn.message == "success")
+ {
+ content.OK("涓婃姤娴峰悍AGV璁惧鎶ヨ淇℃伅鎴愬姛");
+ }
+ else
+ {
+ content.Error(wMSReturn.message);
+ }
+ }
+ catch (Exception ex)
+ {
+ content.Error(ex.Message);
+ }
+ finally
+ {
+ _trackloginfoService.AddTrackLog(hIKROBOTDeviceAlarm, content, "涓婃姤娴峰悍AGV璁惧鎶ヨ淇℃伅", "", "");
+ }
+ return content;
+ }
+
}
}
--
Gitblit v1.9.3