From cba2c0ff983f40757aa9840a3bd520c28a9896d9 Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期三, 15 四月 2026 17:37:10 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/RuiShengZhiNeng/GaoPuLiTiKu
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs | 186 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 183 insertions(+), 3 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs"
index 2f36005..d0beb41 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs"
@@ -13,6 +13,8 @@
using WIDESEAWCS_DTO;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Core.Helper;
+using WIDESEAWCS_QuartzJob;
+using System.Reflection.Metadata;
namespace WIDESEAWCS_TaskInfoService
{
@@ -201,18 +203,88 @@
}
#endregion
- #region 5 璺ㄦゼ灞傝繍杈撲换鍔″垱寤�
+ #region 5 璺ㄦゼ灞傝繍杈撲换鍔″垱寤� 锛堥兘鏄偣鍒扮偣锛�
public WebResponseContent CarryTask(TaskDTO taskDTO, int taskType)
{
+ WebResponseContent content = new WebResponseContent();
try
{
+ Dt_StationManger? stationInfo = null;
+ Dt_Task dt_Task = null;
+ //鍏ュ簱 鍒颁竴妤间笁涓珯鍙扮殑浣嶇疆
+ if (taskType == (int)TaskTypeEnum.Q3RK)//6-1妤�
+ {
+ var ionInfo = _stationMangerService.Repository.QueryFirst(x => x.StationCode == taskDTO.toLocationCode) ?? throw new Exception($"鏈壘鍒扮粓鐐圭珯鍙般�恵taskDTO.toLocationCode}銆戯紒");
+ var StationInfo = _stationInfo.Repository.QueryFirst(x => x.StationCode == taskDTO.fromLocationCode) ?? throw new Exception($"鏈壘鍒皗taskDTO.fromLocationCode}璧风偣璐т綅");
+ if (StationInfo.PalletCode != taskDTO.containerCode) throw new Exception($"璧风偣搴撲綅銆恵taskDTO.fromLocationCode}銆戠粦瀹氭枡绠卞彿銆恵StationInfo.PalletCode}銆戜笌浠诲姟鏂欑鍙枫�恵taskDTO.containerCode}銆戜笉鍖归厤锛�");
+ if (StationInfo.StationStatus != (int)LocationStatusEnum.InStock) throw new Exception($"璧风偣搴撲綅銆恵taskDTO.fromLocationCode}銆戝綋鍓嶇姸鎬佷笉鍙互鍑哄簱");
+ if (StationInfo.FloorNumber != "FF") throw new Exception($"銆恵taskDTO.fromLocationCode}銆戠殑妤煎眰鍜屼换鍔$被鍨嬫ゼ灞備笉鍖归厤");
- return WebResponseContent.Instance.OK();
+ dt_Task = new Dt_Task()
+ {
+ TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+ WMSTaskNum = taskDTO.taskCode,
+ Grade = taskDTO.taskPriority,
+ PalletCode = taskDTO.containerCode,
+ Roadway = "1",
+ TaskState = (int)TaskStatusEnum.New,
+ TaskType = taskType,
+ SourceAddress = taskDTO.fromLocationCode,
+ CurrentAddress = taskDTO.fromLocationCode,
+ NextAddress = taskDTO.toLocationCode,
+ TargetAddress = taskDTO.toLocationCode,
+ Creater = "WMS",
+ };
+ }
+ //鍑哄簱
+ if (taskType == (int)TaskTypeEnum.Q3CK)//1-6妤�
+ {
+ var StationInfo = _stationInfo.Repository.QueryFirst(x => x.StationCode == taskDTO.toLocationCode) ?? throw new Exception($"鏈獅taskDTO.toLocationCode}缁堢偣璐т綅");
+ if (StationInfo.StationStatus != (int)LocationStatusEnum.Free) throw new Exception($"缁堢偣搴撲綅銆恵taskDTO.toLocationCode}銆戝綋鍓嶇姸鎬佷笉鍙互鏀捐揣");
+ if (StationInfo.FloorNumber != "FF") throw new Exception($"缁堢偣搴撲綅銆恵taskDTO.toLocationCode}銆戠殑妤煎眰涓庝换鍔$被鍨嬫ゼ灞備笉鍖归厤");
+
+ var ionInfo = _stationMangerService.Repository.QueryFirst(x => x.StationCode == taskDTO.fromLocationCode) ?? throw new Exception($"鏈壘鍒拌捣鐐圭珯鍙般�恵taskDTO.fromLocationCode}銆戯紒");
+ if (ionInfo.Remark != taskDTO.containerCode) throw new Exception($"璧风偣绔欏彴銆恵taskDTO.fromLocationCode}銆戠粦瀹氭枡绠卞彿銆恵ionInfo.Remark}銆戜笌浠诲姟鏂欑鍙枫�恵taskDTO.containerCode}銆戜笉鍖归厤锛�");
+
+ dt_Task = new Dt_Task()
+ {
+ TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+ WMSTaskNum = taskDTO.taskCode,
+ //WMSId = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+ Grade = taskDTO.taskPriority,
+ PalletCode = taskDTO.containerCode,
+ Roadway = "1",
+ TaskState = (int)TaskStatusEnum.New,
+ TaskType = taskType,
+ SourceAddress = taskDTO.fromLocationCode,
+ CurrentAddress = taskDTO.fromLocationCode,
+ NextAddress = taskDTO.toLocationCode,
+ TargetAddress = taskDTO.toLocationCode,
+ Creater = "WMS",
+ };
+ }
+ try
+ {
+ Db.Ado.BeginTran();
+ BaseDal.AddData(dt_Task);
+ Db.Ado.CommitTran();
+ }
+ catch (Exception ex)
+ {
+ Db.Ado.RollbackTran();
+ throw new Exception(ex.Message);
+ }
+ return content.OK(data: new
+ {
+ taskCode = taskDTO.taskCode,
+ Message = "鎴愬姛锛�"
+ });
}
catch (Exception ex)
{
- throw new Exception(ex.Message);
+ content.Error(ex.Message);
}
+ return content;
}
#endregion
@@ -221,8 +293,17 @@
public WebResponseContent CJCarryTaske(TaskDTO taskDTO, int taskType)
{
WebResponseContent content = new WebResponseContent();
+ Dt_StationInfo? stationInfo = null;
try
{
+ #region 鏄惁闇�瑕佸垽鏂钩搴撳簱浣嶇姸鎬�
+ var reslut = ValidateLocationForTask(taskType, taskDTO);
+ if (!reslut.Status)
+ {
+ throw new Exception(reslut.Message);
+ }
+ #endregion
+
Dt_Task dt_Task = new Dt_Task()
{
TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
@@ -252,5 +333,104 @@
return content;
}
#endregion
+
+
+ #region 5绌鸿溅杞繍
+ public WebResponseContent HKF01Transport(TaskDTO taskDTO, int taskType)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ var stationInfo = _stationInfo.Repository.QueryFirst(x => x.StationName == taskDTO.fromLocationCode) ?? throw new Exception($"鏈壘鍒拌捣鐐瑰簱浣嶃�恵taskDTO.fromLocationCode}銆戯紒");
+ if (stationInfo.StationStatus != (int)LocationStatusEnum.InStock) throw new Exception($"璧风偣搴撲綅銆恵taskDTO.fromLocationCode}銆戝綋鍓嶅簱浣嶇姸鎬佷笉鏄湁璐э紒");
+ if (stationInfo.PalletCode != taskDTO.containerCode) throw new Exception($"褰撳墠搴撲綅銆恵taskDTO.fromLocationCode}銆戠粦瀹氭枡绠卞彿銆恵stationInfo.PalletCode}銆戜笌浠诲姟鐨勬枡绠卞彿銆恵taskDTO.containerCode}銆戜笉鍖归厤");
+
+
+ var stationInfo2 = _stationInfo.Repository.QueryFirst(x => x.StationName == taskDTO.toLocationCode) ?? throw new Exception($"鏈壘鍒扮粓鐐瑰簱浣嶃�恵taskDTO.toLocationCode}銆戯紒");
+ if (stationInfo2.StationStatus != (int)LocationStatusEnum.Free) throw new Exception($"缁堢偣搴撲綅銆恵taskDTO.toLocationCode}銆戝綋鍓嶅簱浣嶇姸鎬佷笉鏄┖闂诧紒");
+
+ var dt_Task = new Dt_Task()
+ {
+ TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+ WMSTaskNum = taskDTO.taskCode,
+ //WMSId = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+ Grade = taskDTO.taskPriority,
+ PalletCode = taskDTO.containerCode,
+ Roadway = "1",
+ TaskState = (int)TaskStatusEnum.New,
+ TaskType = taskType,
+ SourceAddress = taskDTO.fromLocationCode,
+ CurrentAddress = taskDTO.fromLocationCode,
+ NextAddress = taskDTO.toLocationCode,
+ TargetAddress = taskDTO.toLocationCode,
+ Creater = "WMS",
+ };
+ dt_Task.Dispatchertime = DateTime.Now;
+ BaseDal.AddData(dt_Task);
+ return content.OK(data: new
+ {
+ taskCode = taskDTO.taskCode,
+ Message = "鎴愬姛"
+ });
+ }
+ catch (Exception ex)
+ {
+ content.Error(ex.Message);
+ }
+ return content;
+ }
+ #endregion
+
+
+
+ #region
+ /// <summary>
+ /// 娴峰悍浠撲綅鍒颁粨浣嶇殑杩愯緭浠诲姟
+ /// </summary>
+ /// <param name="taskDTO"></param>
+ /// <param name="taskType"></param>
+ /// <returns></returns>
+ public WebResponseContent HKSTUPTP(TaskDTO taskDTO, int taskType)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ var KLocationInfo = _hKLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.fromLocationCode) ?? throw new Exception($"鏈壘鍒拌捣鐐瑰簱浣嶃�恵taskDTO.fromLocationCode}銆戯紒");
+ if (KLocationInfo.LocationStatus != (int)LocationStatusEnum.InStock) throw new Exception($"璧风偣搴撲綅銆恵taskDTO.fromLocationCode}銆戝綋鍓嶅簱浣嶇姸鎬佷笉鏄湁璐э紒");
+ if (KLocationInfo.PalletCode != taskDTO.containerCode) throw new Exception($"褰撳墠搴撲綅銆恵taskDTO.fromLocationCode}銆戠粦瀹氭枡绠卞彿銆恵KLocationInfo.PalletCode}銆戜笌浠诲姟鐨勬枡绠卞彿銆恵taskDTO.containerCode}銆戜笉鍖归厤");
+
+
+ var KLocationInfo2 = _hKLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.toLocationCode) ?? throw new Exception($"鏈壘鍒扮粓鐐瑰簱浣嶃�恵taskDTO.toLocationCode}銆戯紒");
+ if (KLocationInfo2.LocationStatus != (int)LocationStatusEnum.Free) throw new Exception($"缁堢偣搴撲綅銆恵taskDTO.toLocationCode}銆戝綋鍓嶅簱浣嶇姸鎬佷笉鏄┖闂诧紒");
+
+ var dt_Task = new Dt_Task()
+ {
+ TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+ WMSTaskNum = taskDTO.taskCode,
+ //WMSId = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+ Grade = taskDTO.taskPriority,
+ PalletCode = taskDTO.containerCode,
+ Roadway = "1",
+ TaskState = (int)TaskStatusEnum.New,
+ TaskType = taskType,
+ SourceAddress = taskDTO.fromLocationCode,
+ CurrentAddress = taskDTO.fromLocationCode,
+ NextAddress = taskDTO.toLocationCode,
+ TargetAddress = taskDTO.toLocationCode,
+ Creater = "WMS",
+ };
+ content = SendHIKROBOTTask(dt_Task);
+ if (!content.Status) throw new Exception(content.Message);
+ dt_Task.Dispatchertime = DateTime.Now;
+ BaseDal.AddData(dt_Task);
+ }
+ catch (Exception ex)
+ {
+
+ content.Error(ex.Message);
+ }
+ return content;
+ }
+ #endregion
}
}
--
Gitblit v1.9.3