From bfcd7f5b405e431a5c07fe3fa77d74c892d4e66b Mon Sep 17 00:00:00 2001
From: xiazhengtongxue <133085197+xiazhengtongxue@users.noreply.github.com>
Date: 星期四, 19 三月 2026 15:52:42 +0800
Subject: [PATCH] fix: 修复出入库冲突拦截,系统位置与实际位置的映射和修复
---
项目代码/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 101 +++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 95 insertions(+), 6 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
index e33f81b..c5d251a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
@@ -60,6 +60,7 @@
private readonly ILocationInfoService _locationInfoService;
private readonly IWarehouseService _warehouseService;
private readonly IRoadWayinfoService _roadWayinfoService;
+ private readonly ITask_HtyService _task_HtyService;
private Timer _timer;
public IRepository<Dt_Task> Repository => BaseDal;
@@ -74,7 +75,7 @@
public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList();
public TaskService(ILogger<TaskService> logger, IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, ILocationInfoService locationInfoService,
- IWarehouseService warehouseService, IRoadWayinfoService roadWayinfoService) : base(BaseDal)
+ IWarehouseService warehouseService, IRoadWayinfoService roadWayinfoService, ITask_HtyService task_HtyService) : base(BaseDal)
{
_logger = logger;
_mapper = mapper;
@@ -82,8 +83,8 @@
_stockInfoService = stockInfoService;
_locationInfoService = locationInfoService;
_warehouseService = warehouseService;
- _roadWayinfoService=roadWayinfoService;
-
+ _roadWayinfoService = roadWayinfoService;
+ _task_HtyService = task_HtyService;
}
public string MES_InReporttask = WIDESEA_Core.Helper.AppSettings.Configuration["MES_InReporttask"]; //鍏ュ簱鍙嶉淇℃伅
public string MES_OutReporttask = WIDESEA_Core.Helper.AppSettings.Configuration["MES_OutReporttask"]; //鍑哄簱鍙嶉淇℃伅
@@ -192,7 +193,7 @@
{
Dt_Task task = BaseDal.QueryFirst(x => x.TaskId == wCSTask.TaskNum && x.PalletCode == wCSTask.PalletCode);
if (task == null)
- return webResponse.Error("鏈壘鍒颁换鍔′俊鎭�");
+ return webResponse.Error("鏈壘鍒颁换鍔′俊鎭�", 404);
return TaskCompletedtask(task, wCSTask.TaskType);
}
catch (Exception ex)
@@ -503,6 +504,8 @@
MES_parameter mES_Parameter = AbnormalStorageLocation(task.PalletCode, task.SourceAddress, task.TargetAddress);
if (mES_Parameter.Result == "Y")
{
+ Dt_Task dtOutWit=BaseDal.QueryData(x=>x.PalletCode==task.PalletCode && x.TaskStatus== (int)OutTaskStatusEnum.OutWait).FirstOrDefault();
+
Dt_LocationInfo OriginalLocation = _locationInfoService.Repository.QueryData(x => x.LocationCode == task.SourceAddress).FirstOrDefault();
Dt_LocationInfo NewLocation = _locationInfoService.Repository.QueryData(x => x.LocationCode == task.TargetAddress).FirstOrDefault();
Dt_StockInfo dt_StockInfo = _stockInfoService.Repository.QueryData(x => x.LocationCode == task.SourceAddress).FirstOrDefault();
@@ -510,15 +513,27 @@
List<Dt_LocationInfo> dt_Locations = new List<Dt_LocationInfo>();
OriginalLocation.LocationStatus = (int)LocationStatusEnum.Free;
- NewLocation.LocationStatus = (int)LocationStatusEnum.InStock;
+ NewLocation.LocationStatus = dtOutWit != null? (int)LocationStatusEnum.Lock:(int)LocationStatusEnum.InStock;
dt_StockInfo.LocationCode = NewLocation.LocationCode;
- dt_StockInfo.StockStatus = (int)StockStatusEmun.宸插叆搴�;
+ dt_StockInfo.StockStatus = dtOutWit != null? (int)StockStatusEmun.鍑哄簱涓�:(int)StockStatusEmun.宸插叆搴�;
task.TaskStatus = (int)RelocationTaskStatusEnum.RelocationFinish;
+
+ if(dtOutWit != null)
+ {
+ dtOutWit.TaskStatus = (int)OutTaskStatusEnum.OutNew;
+ dtOutWit.SourceAddress = NewLocation.LocationCode;
+ dtOutWit.CurrentAddress = NewLocation.LocationCode;
+ }
+
+
+
dt_Locations.Add(OriginalLocation);
dt_Locations.Add(NewLocation);
_unitOfWorkManage.BeginTran();
+ if(dtOutWit!=null) BaseDal.UpdateData(dtOutWit);
+
_locationInfoService.UpdateData(dt_Locations);
_stockInfoService.UpdateData(dt_StockInfo);
BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
@@ -699,11 +714,85 @@
return BaseDal.QueryData(x => x.TaskStatus == (int)RelocationTaskStatusEnum.RelocationNew && x.CurrentAddress == LocationCode).FirstOrDefault();
}
+ public Dt_Task GeOutCuTaskQueue(string LocationCode)
+ {
+ return BaseDal.QueryData(x => x.TaskStatus == (int)OutTaskStatusEnum.OutNew && x.SourceAddress == LocationCode).FirstOrDefault();
+ }
+
public bool RelocationTaskProgress(string deviceId)
{
int taskcount = BaseDal.QueryData(x => x.Roadway == deviceId && (x.TaskStatus == (int)RelocationTaskStatusEnum.RelocationExecuting || x.TaskStatus == (int)RelocationTaskStatusEnum.RelocationNew) ).Count();
if (taskcount == 0) return false;
return true;
}
+
+ //浠撳簱瀹归噺鐘舵��
+ public WebResponseContent GetWarehouseCapacity()
+ {
+ return _locationInfoService.GetWarehouseCapacity();
+ }
+
+ //鍑哄叆搴撶被鍨嬪垎甯�
+ public WebResponseContent GetInOutTypeStats()
+ {
+ return _task_HtyService.GetInOutTypeStats();
+ }
+ //娴侀噺鎯呭喌缁熻
+
+ public WebResponseContent GetTodayTrafficStats()
+ {
+ return _task_HtyService.GetTodayInOutStats();
+ }
+ //褰撳墠杩涜鐨勪换鍔�
+ public WebResponseContent GetCurrentTasks()
+ {
+ // 鏌ヨ鎵�浠ヨ繑鍥濼askNum锛孴askType锛孋reateDate锛孴askStatus锛�
+ var tasks = BaseDal.QueryData()
+ .Select(t => new
+ {
+ WarehouseId = t.Roadway == "1" || t.Roadway == "2" ? 1 : 2,
+ PalletType = t.PalletType,
+ TaskNum = t.TaskId,
+ TaskType = t.TaskType,
+ CreateDate = t.CreateDate,
+ TaskStatus = t.TaskStatus,
+ TargetAddress = t.TargetAddress
+ })
+ .ToList();
+ return WebResponseContent.Instance.OK("鎴愬姛", tasks);
+ }
+ //鎬讳綋杩涘害
+ public WebResponseContent GetWarehouseOperationStatistics()
+ {
+ /// <summary>
+ /// 鍘熸枡浠擄紝鎬诲嚭鍏ュ簱浠诲姟鏁伴噺锛屼粖鏃ュ叆搴擄紝浠婃棩鍑哄簱锛屼粖鏃ュ緟瀹屾垚锛屼粖鏃ュ紓甯镐换鍔★紝鎴愬搧浠擄紝鎬诲嚭鍏ュ簱鏁伴噺锛屼粖鏃ュ叆搴擄紝浠婃棩鍑哄簱锛屼粖鏃ュ緟瀹屾垚
+ /// </summary>
+ return _task_HtyService.GetWarehouseOperationStatistics();
+ }
+
+ public WebResponseContent GetTaskDestination(string targetAddress)
+ {
+ WebResponseContent content = new WebResponseContent();
+ // 鍙傛暟鏍¢獙
+ if (string.IsNullOrWhiteSpace(targetAddress))
+ {
+ return content.Error("鐩爣鍦板潃涓嶈兘涓虹┖");
+ }
+ try
+ {
+ // 鏌ヨ鏁版嵁
+ var queryResult = BaseDal.QueryData(x => x.TargetAddress == targetAddress);
+ // 鍒ゆ柇鏌ヨ缁撴灉
+ if (queryResult == null || !queryResult.Any())
+ {
+ return content.Error($"鏈壘鍒扮洰鏍囧湴鍧�涓篬{targetAddress}]鐨勪换鍔�");
+ }
+ return content.OK($"鏈夌洰鏍囧湴鍧�涓篬{targetAddress}]鐨勪换鍔★紝璇锋嫤鎴�");
+ }
+ catch (Exception ex)
+ {
+ return content.Error($"鑾峰彇浠诲姟鐩殑鍦板け璐�: {ex.Message}");
+ }
+ }
}
}
--
Gitblit v1.9.3