From a1795465c5b51eb53d83d9a874c7923c9f5bfa85 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期二, 10 三月 2026 16:05:06 +0800
Subject: [PATCH] 优化WMS任务下发接口
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs | 63 ++++++++++++++++++++++++-------
1 files changed, 49 insertions(+), 14 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 708abe3..0761bf8 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"
@@ -23,6 +23,7 @@
/// <returns></returns>
public WebResponseContent CreateKLSNewInTask(TaskDTO taskDTO, int taskType)
{
+ WebResponseContent content = new WebResponseContent();
try
{
int containerType = taskDTO.containerCode.Contains("LLM") ? LocationTypeEnum.LargePallet.ObjToInt() : LocationTypeEnum.SmallPallet.ObjToInt();
@@ -45,16 +46,33 @@
Creater = "WMS",
};
kLSLocationInfo.LocationStatus = LocationStatusEnum.InLock.ObjToInt();
- Db.Ado.BeginTran();
- BaseDal.AddData(dt_Task);
- _kLSLocationInfoService.Repository.UpdateData(kLSLocationInfo);
- Db.Ado.CommitTran();
- return WebResponseContent.Instance.OK();
+ try
+ {
+ Db.Ado.BeginTran();
+ BaseDal.AddData(dt_Task);
+ _kLSLocationInfoService.Repository.UpdateData(kLSLocationInfo);
+ 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)
{
- Db.Ado.RollbackTran();
- throw new Exception(ex.Message);
+ content.Data = new
+ {
+ taskCode = taskDTO.taskCode,
+ Message = $"澶辫触锛亄ex.Message}"
+ };
+ return content.Error(ex.Message);
}
}
/// <summary>
@@ -65,6 +83,7 @@
/// <returns></returns>
public WebResponseContent CreateKLSNewOutTask(TaskDTO taskDTO, int taskType)
{
+ WebResponseContent content = new WebResponseContent();
try
{
Dt_KLSLocationInfo? kLSLocationInfo = _kLSLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.fromLocationCode) ?? throw new Exception($"鏈壘鍒拌捣鐐瑰簱浣嶃�恵taskDTO.fromLocationCode}銆戯紒");
@@ -86,16 +105,32 @@
Creater = "WMS",
};
kLSLocationInfo.LocationStatus = LocationStatusEnum.OutLock.ObjToInt();
- Db.Ado.BeginTran();
- BaseDal.AddData(dt_Task);
- _kLSLocationInfoService.Repository.UpdateData(kLSLocationInfo);
- Db.Ado.CommitTran();
- return WebResponseContent.Instance.OK();
+ try
+ {
+ Db.Ado.BeginTran();
+ BaseDal.AddData(dt_Task);
+ _kLSLocationInfoService.Repository.UpdateData(kLSLocationInfo);
+ 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)
{
- Db.Ado.RollbackTran();
- throw new Exception(ex.Message);
+ content.Data = new
+ {
+ taskCode = taskDTO.taskCode,
+ Message = $"澶辫触锛亄ex.Message}"
+ };
+ return content.Error(ex.Message);
}
}
#endregion
--
Gitblit v1.9.3