From f12af5485a50736494ca034c5fae753386587412 Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期四, 18 十二月 2025 22:17:29 +0800
Subject: [PATCH] 1
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs | 100 ++++++++++++++++++++++++++++++++------------------
1 files changed, 64 insertions(+), 36 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
index 63eb2f1..e28d7e2 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
@@ -29,11 +29,23 @@
{
try
{
- Dt_Task dbtask = Repository.QueryFirst(x => x.PalletCode == palletCode);
+ Dt_Task dbtask = Repository.Db.Queryable<Dt_Task>().Where(x => x.PalletCode == palletCode).OrderByDescending(x=>x.CreateDate).First();
if (dbtask != null)
{
- return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡鐢熸垚浠诲姟");
- }
+ _logger.LogInformation($"浠诲姟绫诲瀷{dbtask.TaskType.ToString()} ,{dbtask.TaskNum} ");
+ if (dbtask.TaskType == TaskTypeEnum.Outbound.ObjToInt())
+ {
+ return WebResponseContent.Instance.Error($"鍑哄簱寰呭垎鎷d换鍔�");
+ }
+ else if (dbtask.TaskType == TaskTypeEnum.OutAllocate.ObjToInt())
+ {
+ return WebResponseContent.Instance.Error($"鍑哄簱寰呭垎鎷d换鍔�");
+ }
+ else
+ {
+ return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡鐢熸垚浠诲姟");
+ }
+ }
Dt_StockInfo stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First();
if (stockInfo == null)
@@ -41,7 +53,7 @@
return WebResponseContent.Instance.Error($"鏈壘鍒扮粍鐩樹俊鎭�");
}
- if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎷i�夊畬鎴�.ObjToInt())
+ if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎷i�夊畬鎴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鏅轰粨鍏ユ櫤浠撶粍鐩樻殏瀛�.ObjToInt())
{
return WebResponseContent.Instance.Error($"璇ユ墭鐩樼姸鎬佷笉姝g‘,涓嶅彲鐢宠鍏ュ簱");
}
@@ -50,7 +62,7 @@
return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡缁戝畾璐т綅");
}
- Dt_LocationInfo? locationInfo = _locationInfoService.AssignLocation();
+ Dt_LocationInfo? locationInfo = _locationInfoService.AssignLocation(stockInfo.LocationType);
if (locationInfo == null)
{
return WebResponseContent.Instance.Error($"璐т綅鍒嗛厤澶辫触,鏈壘鍒板彲鍒嗛厤璐т綅");
@@ -58,7 +70,7 @@
var newTask = new Dt_Task()
- {
+ {
CurrentAddress = stationCode,
Grade = 0,
NextAddress = stations.GetValueOrDefault(stationCode) ?? "",
@@ -70,13 +82,29 @@
TaskStatus = TaskStatusEnum.New.ObjToInt(),
WarehouseId = stockInfo.WarehouseId,
PalletType = stockInfo.PalletType,
-
+ OrderNo= stockInfo.Details.FirstOrDefault()?.OrderNo
+
};
//绌虹
if (stockInfo.PalletType == PalletTypeEnum.Empty.ObjToInt())
{
_unitOfWorkManage.BeginTran();
newTask.TaskType = TaskTypeEnum.InEmpty.ObjToInt();
+ int taskId = BaseDal.AddData(newTask);
+ newTask.TaskId = taskId;
+
+ locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
+ _locationInfoService.UpdateData(locationInfo);
+ stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt();
+
+ _stockRepository.UpdateData(stockInfo);
+ _unitOfWorkManage.CommitTran();
+ }
+ //鏅轰粨鍏ユ櫤浠�
+ if (stockInfo.StockStatus == StockStatusEmun.鏅轰粨鍏ユ櫤浠撶粍鐩樻殏瀛�.ObjToInt())
+ {
+ _unitOfWorkManage.BeginTran();
+ newTask.TaskType = TaskTypeEnum.AllocateInWarehouse.ObjToInt();
int taskId = BaseDal.AddData(newTask);
newTask.TaskId = taskId;
@@ -114,33 +142,33 @@
_stockRepository.UpdateData(stockInfo);
_unitOfWorkManage.CommitTran();
}
- TaskModel esstask = new TaskModel()
- {
- taskType = "putaway",
- taskGroupCode = "",
- groupPriority = 0,
- tasks = new List<TasksType>
- {
- new()
- {
- taskCode=newTask.TaskNum.ToString(),
- taskPriority=0,
- taskDescribe=new TaskDescribeType{
- containerCode=palletCode,
- containerType= "CT_KUBOT_STANDARD",
- fromLocationCode=stations.GetValueOrDefault(stationCode)??"",
- toStationCode="",
- toLocationCode=locationInfo.LocationCode,
- deadline=0,storageTag=""
- }
- }
- }
- };
+ //TaskModel esstask = new TaskModel()
+ //{
+ // taskType = "putaway",
+ // taskGroupCode = "",
+ // groupPriority = 0,
+ // tasks = new List<TasksType>
+ // {
+ // new()
+ // {
+ // taskCode=newTask.TaskNum.ToString(),
+ // taskPriority=0,
+ // taskDescribe=new TaskDescribeType{
+ // containerCode=palletCode,
+ // containerType= "CT_KUBOT_STANDARD",
+ // fromLocationCode=stations.GetValueOrDefault(stationCode)??"",
+ // toStationCode="",
+ // toLocationCode=locationInfo.LocationCode,
+ // deadline=0,storageTag=""
+ // }
+ // }
+ // }
+ //};
- var result = await _eSSApiService.CreateTaskAsync(esstask);
+ //var result = await _eSSApiService.CreateTaskAsync(esstask);
- _logger.LogInformation("鍒涘缓浠诲姟杩斿洖: " + result);
- if (result)
+ //_logger.LogInformation("鍒涘缓浠诲姟杩斿洖: " + result);
+ //if (result)
{
try
{
@@ -156,10 +184,10 @@
}
return WebResponseContent.Instance.OK();
}
- else
- {
- return WebResponseContent.Instance.Error("涓嬪彂鏈哄櫒浜轰换鍔″け璐ワ紒");
- }
+ //else
+ //{
+ // return WebResponseContent.Instance.Error("涓嬪彂鏈哄櫒浜轰换鍔″け璐ワ紒");
+ //}
}
catch (Exception ex)
{
--
Gitblit v1.9.3