From 4d2b6fea8d08c95bd6bb2b8c2b1228383110457e Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期四, 09 四月 2026 12:48:46 +0800
Subject: [PATCH] 1
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs | 497 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 476 insertions(+), 21 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs"
index 64c6398..ac17fd7 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs"
@@ -1,8 +1,11 @@
-锘縰sing Magicodes.IE.Core;
+锘縰sing Autofac.Core;
+using Magicodes.IE.Core;
using NetTaste;
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Net.NetworkInformation;
+using System.Reflection.Metadata;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
@@ -13,7 +16,12 @@
using WIDESEAWCS_Core.Enums;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_DTO;
+using WIDESEAWCS_DTO.AGV.HIKROBOT;
+using WIDESEAWCS_DTO.RGV.FOURBOT;
+using WIDESEAWCS_DTO.WMS;
using WIDESEAWCS_Model.Models;
+using WIDESEAWCS_QuartzJob;
+using WIDESEAWCS_QuartzJob.DTO;
namespace WIDESEAWCS_TaskInfoService
{
@@ -30,11 +38,18 @@
/// <exception cref="NotImplementedException"></exception>
public WebResponseContent UpdateTaskStatus(object TaskDTO, DeviceTypeEnum deviceTypeEnum)
{
+
+ WebResponseContent content = new WebResponseContent();
+ GALAXISUpdateTaskStatus gALAXIS = new();
+ RGVReturnInfo Rgv = new();//鍥涘悜杞︿换鍔$姸鎬侀�氱煡
+ HIKROBOTTaskProcessReport hIKROBOT = new();//娴峰悍鏈哄櫒浜�
+ string deviceName = "";
try
{
if (deviceTypeEnum == DeviceTypeEnum.GALAXIS)
{
- GALAXISUpdateTaskStatus? gALAXIS = TaskDTO.Serialize().DeserializeObject<GALAXISUpdateTaskStatus>();
+ deviceName = "鍑箰澹�";
+ gALAXIS = TaskDTO.Serialize().DeserializeObject<GALAXISUpdateTaskStatus>();
if (gALAXIS == null) throw new Exception("鍙傛暟杞崲澶辫触锛�");
var task = BaseDal.QueryFirst(x => x.WMSTaskNum == gALAXIS.taskId);
if (task == null) throw new Exception($"鏈壘鍒颁换鍔�,浠诲姟缂栧彿銆恵gALAXIS.taskId}銆�");
@@ -48,24 +63,302 @@
break;
default:
task.TaskState = ReturnTaskStatus(gALAXIS.taskStatus, deviceTypeEnum);
- BaseDal.UpdateData(task);
+ if (gALAXIS.taskStatus == 10) TaskFeedback(task, 1);
+ else BaseDal.UpdateData(task);
break;
}
}
else if (deviceTypeEnum == DeviceTypeEnum.HIKROBOT)
{
+ deviceName = "娴峰悍";
+ hIKROBOT = TaskDTO.Serialize().DeserializeObject<HIKROBOTTaskProcessReport>();
+ if (hIKROBOT == null) throw new Exception("鍙傛暟杞崲澶辫触锛�");
+ var task = BaseDal.QueryFirst(x => x.WMSTaskNum == hIKROBOT.robotTaskCode);
+ if (task == null) throw new Exception($"鏈壘鍒颁换鍔�,浠诲姟缂栧彿銆恵hIKROBOT.robotTaskCode}銆�");
+ switch (hIKROBOT.extra.values.method)
+ {
+ case "start":
+ if (task.TaskState == (int)TaskStatusEnum.CallingHKtransportation && task.TaskType == (int)TaskTypeEnum.MOVE)
+ {
+ task.TaskState = (int)TaskStatusEnum.HktransportIng;
+ BaseDal.UpdateData(task);
+ }
+ else if (task.TaskType == (int)TaskTypeEnum.Q3CK|| task.TaskType == (int)TaskTypeEnum.Q3RK)
+ {
+ //UpdateStandStatus(task, task.SourceAddress, LocationStatusEnum.Lock);
+ task.TaskState = (int)TaskStatusEnum.Takeing;
+ TaskFeedback(task, 1);
+ }
+ else
+ {
+ task.TaskState = (int)TaskStatusEnum.Takeing;
+ TaskFeedback(task, 1);
+ }
+ break;
+ case "outbin"://绂诲紑璧风偣
+ {
+ if (task.TaskType == (int)TaskTypeEnum.Q3RK|| task.TaskType == (int)TaskTypeEnum.Q3CK)
+ {
+ UpdateStandStatus(task, task.SourceAddress, LocationStatusEnum.Free);
+ task.TaskState = TaskStatusEnum.TakeFinish.ObjToInt();
+ BaseDal.UpdateData(task);
+ TaskFeedback(task, 1);
+ }
+ else
+ {
+
+ TaskFromCompleted(task, deviceTypeEnum); //浠诲姟鐘朵綋鏀逛负3鍙栬揣瀹屾垚锛屾洿鏂拌捣鐐硅揣浣嶇姸鎬侊紝骞跺弽棣圵MS璧风偣瀹屾垚
+ }
+ ///鍒ゆ柇浠诲姟鏄惁璺熻澶囨湁鍏�
+ }
+ break;
+ case "finish"://绂诲紑鎻愬崌鏈�
+ {
+ //鍏ユ彁鍗囨満
+ if (task.TaskType == TaskTypeEnum.RK3F.ObjToInt() && task.TaskState == (int)TaskStatusEnum.CheckPalletCodeFinish)
+ {
+ var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "TSJ") as OtherDevice;
+ if (device == null) task.ExceptionMessage = "鏈壘鍒版彁鍗囨満淇℃伅";
+ else
+ {
+ DeviceProDTO? deviceProDTO = device.DeviceProDTOs.FirstOrDefault((DeviceProDTO x) => x.DeviceProParamName == HoistEnum.Inboundboxon.ToString());//鏀惧埌浣嶄簡
+ if (device.IsConnected)
+ device.SetValue(HoistEnum.Inboundboxon, 1);
+ else
+ task.ExceptionMessage = "鎻愬崌鏈轰俊鎭澶囪繛鎺ュけ璐�";
+ }
+ BaseDal.UpdateData(task);
+ }
+
+ //3 鍑烘彁鍗囨満 涔嬪墠鏄疉GV_ToExecute
+ else if (task.TaskType == TaskTypeEnum.CK3F.ObjToInt() && task.TaskState == (int)TaskStatusEnum.TakeFinish)
+ {
+ var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "TSJ") as OtherDevice;
+ if (device == null) task.ExceptionMessage = "鏈壘鍒版彁鍗囨満淇℃伅";
+ else
+ {
+ if (device.IsConnected)
+ device.SetValue(HoistEnum.Outboundboxon, 1);//鍑哄簱瀹屾垚
+ else
+ task.ExceptionMessage = "鎻愬崌鏈轰俊鎭澶囪繛鎺ュけ璐�";
+ }
+ BaseDal.UpdateData(task);
+ }
+ //鍥涙ゼ 鍑哄簱
+ else if ((task.TaskType == TaskTypeEnum.CHUKU1.ObjToInt() || task.TaskType == TaskTypeEnum.F04.ObjToInt()) && task.TaskState == (int)TaskStatusEnum.AGV_ToExecute)
+ {
+ var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "TSJ") as OtherDevice;
+ if (device == null) task.ExceptionMessage = "鏈壘鍒版彁鍗囨満淇℃伅";
+ else
+ {
+ if (device.IsConnected)
+ device.SetValue(HoistEnum.Emptyboxplacedinposition, 1);
+ else
+ task.ExceptionMessage = "鎻愬崌鏈轰俊鎭澶囪繛鎺ュけ璐�";
+ }
+ BaseDal.UpdateData(task);
+ }
+ // //鍥涙ゼ鍑烘彁鍗囨満 鍏ュ簱 涔嬪墠鏄疉GV_ToExecute //瑕佸啓鎴愬彇璐у畬鎴愮姸鎬乀akeFinish
+ if ((task.TaskType == TaskTypeEnum.Q1TSJ4.ObjToInt() || task.TaskType == TaskTypeEnum.F03.ObjToInt()) && task.TaskState == (int)TaskStatusEnum.AGV_ToExecute)
+ {
+ var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "TSJ") as OtherDevice;
+ if (device == null) task.ExceptionMessage = "鏈壘鍒版彁鍗囨満淇℃伅";
+ else
+ {
+ if (device.IsConnected)
+ //鍐欎互涓�涓嚭搴撳畬鎴愪俊鍙�
+ device.SetValue(HoistEnum.Outboundboxretrievalcompleted, 1, task.SourceAddress);
+ else
+ task.ExceptionMessage = "鎻愬崌鏈轰俊鎭澶囪繛鎺ュけ璐�";
+ }
+ BaseDal.UpdateData(task);
+ }
+ //璺ㄦゼ灞�
+ else if (task.TaskType == TaskTypeEnum.Q3RK.ObjToInt() || task.TaskType == TaskTypeEnum.Q3CK.ObjToInt() && task.TaskState == (int)TaskStatusEnum.TakeFinish)
+ {
+ if (task.TaskType == TaskTypeEnum.Q3RK.ObjToInt()|| task.TaskType == TaskTypeEnum.Q3RK.ObjToInt())
+ {
+ var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "F1") as OtherDevice;
+ if (device == null) task.ExceptionMessage = "鏈壘鍒拌川妫�闂ㄤ俊鎭�";
+ else
+ {
+ if (device.IsConnected)
+ //鍐欎互涓�涓嚭搴撳畬鎴愪俊鍙�
+ device.SetValue(QualityInspectionCommandEnum.RequestToEnter, false, task.TargetAddress);
+ else
+ task.ExceptionMessage = "璐ㄦ闂ㄤ俊鎭澶囪繛鎺ュけ璐�";
+ }
+
+ }
+ BaseDal.UpdateData(task);
+ }
+ }
+ break;
+ case "into"://鐢宠杩涘叆鎻愬崌鏈�
+ {
+ task.TaskState = (int)TaskStatusEnum.AGV_WaitToExecute;
+ BaseDal.UpdateData(task);
+ }
+ break;
+ case "wait"://鎵爜绛夊緟
+ {
+ //瑕佸厛寮�鍚壂鐮佷俊鍙�
+ var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "TSJ") as OtherDevice;
+ if (device == null) task.ExceptionMessage = "鏈壘鍒版彁鍗囨満淇℃伅";
+ else
+ {
+ if (device.IsConnected)
+ //鎵撳紑鎵爜鍣�
+ device.SetValue<HoistEnum, short>(HoistEnum.Codereadingtriggered, 1);
+ else
+ task.ExceptionMessage = "鎻愬崌鏈轰俊鎭澶囪繛鎺ュけ璐�";
+ }
+ task.TaskState = (int)TaskStatusEnum.CheckPalletCodeing;
+ BaseDal.UpdateData(task);
+ }
+ break;
+ case "end"://浠诲姟瀹屾垚閫氱煡
+ {
+ if (task.TaskType == (int)TaskTypeEnum.Q3RK || task.TaskType == (int)TaskTypeEnum.Q3CK|| task.TaskType == (int)TaskTypeEnum.MOVE)
+ {
+ task.TaskState = TaskStatusEnum.Finish.ObjToInt();
+ BaseDal.UpdateData(task);
+ TaskFeedback(task, 2);
+ BaseDal.DeleteAndMoveIntoHty(task, OperateTypeEnum.鑷姩瀹屾垚);
+ }
+ else
+ {
+ ///鍒ゆ柇浠诲姟鏄惁璺熻澶囨湁鍏�
+ TaskCompleted(task, deviceTypeEnum);
+ }
+ }
+ break;
+ case "intolift": //杩涘叆鐢垫
+ {
+ //鍏ゼ鍒颁竴妤肩殑鍏ュ簱浠诲姟
+ if (task.TaskType==(int)TaskTypeEnum.Q3RK||task.TaskType==(int)TaskTypeEnum.MOVE||task.TaskType==(int)TaskTypeEnum.F01)
+ {
+ task.TaskState = TaskStatusEnum.Hkintolift.ObjToInt();
+ BaseDal.UpdateData(task);
+ }
+ }
+ break;
+ case "leavelift": //绂诲紑鐢垫
+ {
+ if (task.TaskType == (int)TaskTypeEnum.Q3RK || task.TaskType == (int)TaskTypeEnum.MOVE || task.TaskType == (int)TaskTypeEnum.F01)
+ {
+ task.TaskState = TaskStatusEnum.HKleavelift.ObjToInt();
+ BaseDal.UpdateData(task);
+ }
+ }
+ break;
+ default:
+ throw new Exception("鏈畾涔夌殑鏂规硶鍚嶏紒");
+ //task.TaskState = ReturnTaskStatus(hIKROBOT.extra.values.method, deviceTypeEnum);
+ //BaseDal.UpdateData(task);
+ //break;
+ }
}
- else
+ else //鍥涘悜杞�
{
-
+ deviceName = "鍥涘悜杞�";
+ Rgv = TaskDTO.Serialize().DeserializeObject<RGVReturnInfo>();
+ if (Rgv == null) throw new Exception("鍙傛暟杞崲澶辫触锛�");
+ //var task = BaseDal.QueryFirst(x => x.RGVTaskId == Rgv.content.taskID);
+ var task = BaseDal.QueryFirst(x => x.PalletCode == Rgv.content.podID);
+ if (task == null) throw new Exception($"鏈壘鍒颁换鍔�,浠诲姟缂栧彿銆恵Rgv.content.taskID}銆�");
+ //绉诲簱
+ if (task.TaskType == TaskTypeEnum.CPMoveInventory.ObjToInt() && Rgv.messageType == 10 && Rgv.content.status == 4)
+ {
+ deviceName += "绉诲簱";
+ WMSMoveLocationFeedback wMSMoveLocationFeedback = new WMSMoveLocationFeedback()
+ {
+ containerCode = task.PalletCode,
+ fromStationCode = task.SourceAddress,
+ toLocationCode = task.TargetAddress
+ };
+ Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(WMSMoveLocationFeedback));
+ WMSReturn agvContent = null;
+ if (apiInfo == null) task.ExceptionMessage = "鏈壘鍒扮Щ搴撳畬鎴愬弽棣圵MS鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�";
+ else
+ {
+ task.TaskState = TaskStatusEnum.Finish.ObjToInt();
+ string response = HttpHelper.Post(apiInfo.ApiAddress, wMSMoveLocationFeedback.Serialize());
+ agvContent = response.DeserializeObject<WMSReturn>();
+ content.OK(data: agvContent);
+ if (agvContent.code != 200)
+ {
+ task.ExceptionMessage = agvContent.message;
+ content.Error(agvContent.message);
+ }
+ UpdateLocationStatus(task.TargetAddress, task.PalletCode, deviceTypeEnum, LocationStatusEnum.InStock);
+ BaseDal.DeleteAndMoveIntoHty(task, OperateTypeEnum.鑷姩瀹屾垚);
+ }
+ }
+ else
+ {
+ //绔欏彴鍒拌川妫�鍙�
+ if (Rgv.messageType == 72)//灏忚溅椤惰捣璐х墿
+ {
+ if (task.TaskType == (int)TaskTypeEnum.CPInbound && task.TaskState == (int)TaskStatusEnum.Execut)
+ {
+ task.TaskState = (int)TaskStatusEnum.WaiCheckShape;
+ //BaseDal.UpdateData(task);//缁欒川妫�闂ㄥ啓鍏ュ惎鍔ㄤ俊鍙�
+ var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "F1") as OtherDevice;
+ if (device == null) task.ExceptionMessage = "鏈壘鍒�1妤艰川妫�闂ㄨ澶囦俊鎭�";
+ else
+ {
+ if (device.IsConnected)
+ device.SetValue(QualityInspectionCommandEnum.StartqualityInspection, true, task.SourceAddress);
+ else
+ task.ExceptionMessage = "1妤艰川妫�闂ㄨ澶囪繛鎺ュけ璐�";
+ }
+ TaskFeedback(task, 4);
+ }
+ else
+ {
+ //杩欓噷鍑哄簱锛岃繖涓帴鍙d腑涔熻繑鍥炵粰浜唚ms鐘舵��
+ TaskFromCompleted(task, deviceTypeEnum);
+ }
+ }
+ else if (Rgv.messageType == 10)//璐ㄦ鍙板埌鐩爣璐т綅
+ {
+ if (Rgv.content.status == 2) TaskFeedback(task, 1);
+ if (Rgv.content.status == 4)
+ {
+ if (task.TaskType == (int)TaskTypeEnum.CPInbound && task.TaskState == (int)TaskStatusEnum.TakeFinish)
+ {
+ if (!string.IsNullOrEmpty(task.ExceptionMessage)) task.TaskState = TaskStatusEnum.CheckShapeingNG.ObjToInt();
+ else task.TaskState = (int)TaskStatusEnum.CheckShapeing;
+ BaseDal.UpdateData(task);
+ }
+ else if (task.TaskType == (int)TaskTypeEnum.CPInbound && task.TaskState == (int)TaskStatusEnum.Puting)
+ {
+ if (!string.IsNullOrEmpty(task.ExceptionMessage) && !task.ExceptionMessage.Contains("鐢变簬鐩爣璁$畻鏈虹Н鏋佹嫆缁濓紝鏃犳硶杩炴帴"))
+ ErrorTaskFeedback(task, true/*!task.ExceptionMessage.Contains("澶栨澶辫触")*/);
+ else
+ TaskCompleted(task, deviceTypeEnum);
+ }
+ else if (task.TaskType == (int)TaskTypeEnum.CPOutbound)//鍑哄簱瀹屾垚
+ {
+ TaskCompleted(task, deviceTypeEnum);
+ }
+ }
+ }
+ }
}
- return WebResponseContent.Instance.OK();
+ content.OK();
}
catch (Exception ex)
{
- throw new Exception(ex.Message);
+ content.Error(ex.Message);
}
+ finally
+ {
+ _trackloginfoService.AddTrackLog(TaskDTO, content, $"{deviceName}浠诲姟鐘舵�佸弽棣�", "", "");
+ }
+ return content;
}
#endregion
@@ -123,10 +416,11 @@
try
{
dt_Task.TaskState = TaskStatusEnum.TakeFinish.ObjToInt();
- Db.Ado.BeginTran();
- UpdateLocationStatus(dt_Task.SourceAddress, deviceTypeEnum, LocationStatusEnum.Free);
- BaseDal.UpdateData(dt_Task);
- Db.Ado.CommitTran();
+ TaskFeedback(dt_Task, 4);
+ //Db.Ado.BeginTran();
+ UpdateLocationStatus(dt_Task.SourceAddress, dt_Task.PalletCode, deviceTypeEnum, LocationStatusEnum.Free);
+ //BaseDal.UpdateData(dt_Task);
+ //Db.Ado.CommitTran();
return WebResponseContent.Instance.OK();
}
catch (Exception ex)
@@ -149,15 +443,16 @@
try
{
dt_Task.TaskState = TaskStatusEnum.Finish.ObjToInt();
- Db.Ado.BeginTran();
- UpdateLocationStatus(dt_Task.TargetAddress, deviceTypeEnum, LocationStatusEnum.InStock);
- BaseDal.DeleteAndMoveIntoHty(dt_Task, OperateTypeEnum.鑷姩瀹屾垚);
- Db.Ado.CommitTran();
+ TaskFeedback(dt_Task, 2);
+ //Db.Ado.BeginTran();
+ UpdateLocationStatus(dt_Task.TargetAddress, dt_Task.PalletCode, deviceTypeEnum, LocationStatusEnum.InStock);
+
+ //Db.Ado.CommitTran();
return WebResponseContent.Instance.OK();
}
catch (Exception ex)
{
- Db.Ado.RollbackTran();
+ //Db.Ado.RollbackTran();
throw new Exception(ex.Message);
}
}
@@ -171,38 +466,78 @@
/// <param name="deviceTypeEnum"></param>
/// <param name="locationStatusEnum"></param>
/// <returns></returns>
- public WebResponseContent UpdateLocationStatus(string LocationCode, DeviceTypeEnum deviceTypeEnum, LocationStatusEnum locationStatusEnum)
+ public WebResponseContent UpdateLocationStatus(string locationCode, string palletCode, DeviceTypeEnum deviceTypeEnum, LocationStatusEnum locationStatusEnum)
{
try
{
if (deviceTypeEnum == DeviceTypeEnum.GALAXIS)
{
- Dt_KLSLocationInfo? dt_KLSLocationInfo = _kLSLocationInfoService.Repository.QueryFirst(x => x.LocationCode == LocationCode);
+ Dt_KLSLocationInfo? dt_KLSLocationInfo = _kLSLocationInfoService.Repository.QueryFirst(x => x.LocationCode == locationCode);
if (dt_KLSLocationInfo != null)
{
+ if (locationStatusEnum == LocationStatusEnum.Free) //濡傛灉璧风偣瀹屾垚灏辩粰璐т綅璧嬪�兼墭鐩樺彿
+ {
+ dt_KLSLocationInfo.PalletCode = "";
+ }
+ else
+ {
+ dt_KLSLocationInfo.PalletCode = palletCode;
+ }
dt_KLSLocationInfo.LocationStatus = locationStatusEnum.ObjToInt();
_kLSLocationInfoService.Repository.UpdateData(dt_KLSLocationInfo);
}
}
else if (deviceTypeEnum == DeviceTypeEnum.HIKROBOT)
{
- Dt_HKLocationInfo? dt_HKLocationInfo = _hKLocationInfoService.Repository.QueryFirst(x => x.LocationCode == LocationCode);
+ Dt_HKLocationInfo? dt_HKLocationInfo = _hKLocationInfoService.Repository.QueryFirst(x => x.LocationCode == locationCode);
if (dt_HKLocationInfo != null)
{
+ if (locationStatusEnum == LocationStatusEnum.Free) //濡傛灉璧风偣瀹屾垚灏辩粰璐т綅璧嬪�兼墭鐩樺彿
+ {
+ dt_HKLocationInfo.PalletCode = "";
+ }
+ else
+ {
+ dt_HKLocationInfo.PalletCode = palletCode;
+ }
dt_HKLocationInfo.LocationStatus = locationStatusEnum.ObjToInt();
_hKLocationInfoService.Repository.UpdateData(dt_HKLocationInfo);
+ }
+ Dt_StationInfo? stationInfo = _stationInfo.Repository.QueryFirst(x => x.StationCode == locationCode);
+ if (stationInfo != null)
+ {
+ if (locationStatusEnum == LocationStatusEnum.Free) //濡傛灉璧风偣瀹屾垚灏辩粰璐т綅璧嬪�兼墭鐩樺彿
+ {
+ stationInfo.PalletCode = "";
+ }
+ else
+ {
+ stationInfo.PalletCode = palletCode;
+ }
+ stationInfo.StationStatus = locationStatusEnum.ObjToInt();
+ _stationInfo.UpdateData(stationInfo);
}
}
else if (deviceTypeEnum == DeviceTypeEnum.YuanLiJuHe)
{
- Dt_RGVLocationInfo dt_RGVLocationInfo = _rGVLocationInfoService.Repository.QueryFirst(x => x.LocationCode == LocationCode);
+ Dt_RGVLocationInfo dt_RGVLocationInfo = _rGVLocationInfoService.Repository.QueryFirst(x => x.LocationCode == locationCode);
+ //杩欓噷灏嗕换鍔$殑鎵樼洏鍙风粰璐т綅琛ㄤ腑鐨凱alletCode瀛楁銆�
+
if (dt_RGVLocationInfo != null)
{
+ if (locationStatusEnum == LocationStatusEnum.Free) //濡傛灉璧风偣瀹屾垚灏辩粰璐т綅璧嬪�兼墭鐩樺彿
+ {
+ dt_RGVLocationInfo.PalletCode = "";
+ }
+ else
+ {
+ dt_RGVLocationInfo.PalletCode = palletCode;
+ }
dt_RGVLocationInfo.LocationStatus = locationStatusEnum.ObjToInt();
_rGVLocationInfoService.Repository.UpdateData(dt_RGVLocationInfo);
}
}
- else//搴撳绔欏彴
+ else//骞冲簱搴撲綅
{
}
@@ -214,5 +549,125 @@
}
}
#endregion
+
+ #region 鏇存柊涓�妤肩珯鍙扮姸鎬�
+ public WebResponseContent UpdateStandStatus(Dt_Task task,string stationCode,LocationStatusEnum locationStatusEnum)
+ {
+ try
+ {
+ Dt_StationManger? stationManger = _stationMangerService.Repository.QueryFirst(x => x.StationCode == task.TargetAddress);
+ //stationManger.IsOccupied = LocationStatusEnum.Lock.ObjToInt();
+ if (stationManger != null)
+ {
+ if (locationStatusEnum == LocationStatusEnum.Free) //濡傛灉璧风偣瀹屾垚灏辩粰璐т綅璧嬪�兼墭鐩樺彿
+ {
+ stationManger.IsOccupied = LocationStatusEnum.Lock.ObjToInt();
+ }
+ else
+ {
+ stationManger.IsOccupied = LocationStatusEnum.Free.ObjToInt();
+ }
+ _stationMangerService.UpdateData(stationManger);
+ }
+ return WebResponseContent.Instance.OK();
+ }
+ catch (Exception ex)
+ {
+ throw new Exception(ex.Message);
+ }
+ }
+ #endregion
+
+ #region 涓婃姤WMS
+ public WebResponseContent TaskFeedback(Dt_Task dt_Task, int Status)
+ {
+ WebResponseContent content = new WebResponseContent();
+ WMSInOutBoundCompleteFeedback boundCompleteFeedback = new WMSInOutBoundCompleteFeedback();
+ WMSReturn agvContent = null;
+ try
+ {
+ Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(WMSInOutBoundCompleteFeedback));
+ if (apiInfo == null) dt_Task.ExceptionMessage = "鏈壘鍒板嚭鍏ュ簱瀹屾垚鍙嶉WMS鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�";
+ else
+ {
+ boundCompleteFeedback.taskCode = dt_Task.WMSTaskNum;
+ boundCompleteFeedback.containerCode = dt_Task.PalletCode;
+ boundCompleteFeedback.fromStationCode = dt_Task.SourceAddress;
+ boundCompleteFeedback.toLocationCode = dt_Task.TargetAddress;
+ boundCompleteFeedback.status = Status;
+ boundCompleteFeedback.custStatus = "";
+ string response = HttpHelper.Post(apiInfo.ApiAddress,boundCompleteFeedback.Serialize());
+ agvContent = response.DeserializeObject<WMSReturn>();
+ content.OK(data: agvContent);
+ if (agvContent.code != 200)
+ {
+ dt_Task.ExceptionMessage = agvContent.message;
+ content.Error(agvContent.message);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ dt_Task.ExceptionMessage = ex.Message;
+ }
+ finally
+ {
+ _trackloginfoService.AddTrackLog(boundCompleteFeedback, content, "鍑哄叆搴撲换鍔$姸鎬佸弽棣圵MS", "", "");
+ if (agvContent != null && agvContent.code == 200 && Status == 2)
+ BaseDal.DeleteAndMoveIntoHty(dt_Task, OperateTypeEnum.鑷姩瀹屾垚);
+ else
+ BaseDal.UpdateData(dt_Task);
+ }
+ return WebResponseContent.Instance.OK();
+ }
+ #endregion
+ #region 澶辫触浠诲姟涓婃姤WMS骞跺垹闄や换鍔�
+ public WebResponseContent ErrorTaskFeedback(Dt_Task dt_Task, bool Del)
+ {
+ WebResponseContent content = new WebResponseContent();
+ WMSInOutBoundCompleteFeedback boundCompleteFeedback = new WMSInOutBoundCompleteFeedback();
+ WMSReturn agvContent = null;
+ try
+ {
+ Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(WMSInOutBoundCompleteFeedback));
+ if (apiInfo == null) dt_Task.ExceptionMessage = "鏈壘鍒板嚭鍏ュ簱瀹屾垚鍙嶉WMS鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�";
+ else
+ {
+ boundCompleteFeedback.taskCode = dt_Task.WMSTaskNum;
+ boundCompleteFeedback.containerCode = dt_Task.PalletCode;
+ boundCompleteFeedback.fromStationCode = dt_Task.SourceAddress;
+ boundCompleteFeedback.toLocationCode = dt_Task.TargetAddress;
+ boundCompleteFeedback.status = 3;
+ boundCompleteFeedback.custStatus = "";
+ boundCompleteFeedback.memo = dt_Task.ExceptionMessage;
+ string response = HttpHelper.Post(apiInfo.ApiAddress, boundCompleteFeedback.Serialize());
+ agvContent = response.DeserializeObject<WMSReturn>();
+ content.OK(data: agvContent);
+ content.Message = dt_Task.ExceptionMessage;
+ if (agvContent.code != 200)
+ {
+ dt_Task.ExceptionMessage = agvContent.message;
+ content.Error(agvContent.message);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ dt_Task.ExceptionMessage = ex.Message;
+ content.Error(ex.Message);
+ }
+ finally
+ {
+ _trackloginfoService.AddTrackLog(boundCompleteFeedback, content, "鍑哄叆搴撲换鍔$姸鎬佸弽棣圵MS", "", "");
+ if (agvContent != null && agvContent.code == 200 && Del) BaseDal.DeleteAndMoveIntoHty(dt_Task, OperateTypeEnum.鑷姩鍒犻櫎);
+ else BaseDal.UpdateData(dt_Task);
+ }
+ return content;
+ }
+ #endregion
+
+
+
+
}
}
--
Gitblit v1.9.3