From 9376389dbf19d202f766a4fe47cf80dfe4db4f42 Mon Sep 17 00:00:00 2001
From: xiaojiao <xiaojiao@kaokeziliao.com>
Date: 星期四, 30 四月 2026 11:47:19 +0800
Subject: [PATCH] 规范读取modbus,增加容器出入场调接口
---
项目代码/WIDESEA_WCSServer/WIDESEAWCS_TaskInfoService/TaskService.cs | 31 ++++++++++++++++++++++++++++++-
1 files changed, 30 insertions(+), 1 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WCSServer/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WCSServer/WIDESEAWCS_TaskInfoService/TaskService.cs"
index f04bcf2..18fee23 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WCSServer/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WCSServer/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -15,6 +15,7 @@
using WIDESEAWCS_BasicInfoService;
using WIDESEAWCS_Common;
using WIDESEAWCS_Common.APIEnum;
+using WIDESEAWCS_Common.StationEnum;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseRepository;
@@ -51,6 +52,8 @@
private readonly ITask_HtyRepository _taskHtyRepository;
private readonly IApiInfoRepository _apiInfoRepository;
private readonly IUnitOfWorkManage _unitOfWorkManage;
+ private readonly IDt_MaterialInfo_HtyRepository _MaterialInfo_HtyRepository;
+ private readonly IDt_MaterialInfoRepository _MaterialInfoRepository;
private Dictionary<string, OrderByType> _taskOrderBy = new()
{
@@ -69,7 +72,7 @@
#endregion 鑾峰彇鎵�鏈変换鍔$被鍨嬨�佺姸鎬�
- public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ISys_ConfigService sys_ConfigService, IDt_StationManagerService stationManagerService, IDt_StationManagerRepository stationManagerRepository, IRouterRepository routerRepository, ITask_HtyRepository htyRepository, IApiInfoRepository apiInfoRepository,IUnitOfWorkManage unitOfWorkManage) : base(BaseDal)
+ public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ISys_ConfigService sys_ConfigService, IDt_StationManagerService stationManagerService, IDt_StationManagerRepository stationManagerRepository, IRouterRepository routerRepository, ITask_HtyRepository htyRepository, IApiInfoRepository apiInfoRepository,IUnitOfWorkManage unitOfWorkManage, IDt_MaterialInfo_HtyRepository materialInfo_HtyRepository, IDt_MaterialInfoRepository materialInfoRepository) : base(BaseDal)
{
_routerService = routerService;
_taskExecuteDetailService = taskExecuteDetailService;
@@ -82,6 +85,8 @@
_taskHtyRepository = htyRepository;
_apiInfoRepository = apiInfoRepository;
_unitOfWorkManage = unitOfWorkManage;
+ _MaterialInfo_HtyRepository = materialInfo_HtyRepository;
+ _MaterialInfoRepository = materialInfoRepository;
}
/// <summary>
@@ -462,6 +467,30 @@
//浠诲姟瀹屾垚閫昏緫
_unitOfWorkManage.BeginTran();
// 鎶婂綋鍓嶄换鍔℃煡鍑烘潵 鐒跺悗姣忎竴涓瓧娈佃祴鍊肩粰鍘嗗彶浠诲姟 鐒跺悗鍒犻櫎褰撳墠浠诲姟 娣诲姞涓�鏉″巻鍙蹭换鍔� // 鐒跺悗鎶婅繖涓换鍔$殑缁堢偣鐨勫搴旂珯鍙扮殑鐘舵�佽缃负鍚敤
+ Dt_Task_Hty dt_Task_Hty = _mapper.Map<Dt_Task_Hty>(task);
+ dt_Task_Hty.TaskNum = task.TaskId;
+
+ Dt_StationManager dt_StationManager = _stationManagerRepository.QueryFirst(x => x.StationLocation == task.TargetAddress);// 鐩殑浣嶇疆
+ Dt_StationManager SourceAddress = _stationManagerRepository.QueryFirst(x => x.StationLocation == task.SourceAddress);// 璧峰浣嶇疆
+ if(dt_StationManager == null) return content.Error($"浠诲姟{taskNum}鐨勭洰鐨勭珯鍙般�恵task.TargetAddress}銆戠珯鍙颁笉瀛樺湪");
+ if(SourceAddress == null) return content.Error($"浠诲姟{taskNum}鐨勫綋鍓嶈捣濮嬨�恵task.SourceAddress}銆戠珯鍙颁笉瀛樺湪");
+ dt_StationManager.StationStatus = ((int)StationEnum.Enable).ToString();
+ SourceAddress.StationStatus = ((int)StationEnum.Enable).ToString();
+
+
+ Dt_MaterialInfo dt_MaterialInfo = _MaterialInfoRepository.QueryFirst(x => x.ContainerCode == task.PalletCode);
+ if (dt_MaterialInfo == null) return content.Error("鏌ヨ涓嶅埌鐩稿叧鏁版嵁 鎴栬�呭凡缁忚В缁戯紒");
+ dt_MaterialInfo.IsBind = false;
+ Dt_MaterialInfo_Hty dt_MaterialInfo_Hty = _mapper.Map<Dt_MaterialInfo_Hty>(dt_MaterialInfo);
+
+
+ _MaterialInfo_HtyRepository.AddData(dt_MaterialInfo_Hty);
+ _MaterialInfoRepository.DeleteData(dt_MaterialInfo);
+
+ _taskHtyRepository.AddData(dt_Task_Hty);
+ BaseDal.DeleteData(task);
+ _stationManagerRepository.UpdateData(dt_StationManager);
+ _stationManagerRepository.UpdateData(SourceAddress);
_unitOfWorkManage.CommitTran();
content.OK("浠诲姟瀹屾垚");
--
Gitblit v1.9.3