From a709afe7ba494808d923c3746c8edf1a3575977a Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期四, 30 十月 2025 09:58:34 +0800
Subject: [PATCH] 代码提交
---
项目代码/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 57 insertions(+), 2 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
index 50c96b0..9d91261 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
@@ -15,13 +15,19 @@
*----------------------------------------------------------------*/
#endregion << 鐗� 鏈� 娉� 閲� >>
+using Autofac.Core;
using AutoMapper;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using SqlSugar;
+using WIDESEA_Common.LocationEnum;
+using WIDESEA_Common.StockEnum;
using WIDESEA_Common.TaskEnum;
using WIDESEA_Core;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
+using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
using WIDESEA_DTO.Task;
using WIDESEA_IBasicService;
@@ -41,6 +47,7 @@
private readonly IRepository<Dt_StockInfo> _stockRepository;
private readonly IRepository<Dt_Warehouse> _warehouseRepository;
private readonly IRepository<Dt_LocationInfo> _locationInfoRepository;
+ private readonly IRepository<Dt_RoadwayInfo> _roadwayInforepository;
private readonly IBasicService _basicService;
public IRepository<Dt_Task> Repository => BaseDal;
@@ -55,7 +62,7 @@
public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList();
- public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, IBasicService basicService, IRepository<Dt_Warehouse> warehouseRepository, IRepository<Dt_LocationInfo> locationInfoRepository) : base(BaseDal)
+ public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, IBasicService basicService, IRepository<Dt_Warehouse> warehouseRepository, IRepository<Dt_LocationInfo> locationInfoRepository, IRepository<Dt_RoadwayInfo> roadwayInforepository) : base(BaseDal)
{
_mapper = mapper;
_unitOfWorkManage = unitOfWorkManage;
@@ -63,6 +70,7 @@
_basicService = basicService;
_warehouseRepository = warehouseRepository;
_locationInfoRepository = locationInfoRepository;
+ _roadwayInforepository = roadwayInforepository;
}
/// <summary>
/// 浠诲姟淇℃伅鎺ㄩ�佽嚦WCS
@@ -77,7 +85,7 @@
{
x.AGVArea = agvDescription;
});
- string url = AppSettings.Get("WCS");
+ string url = AppSettings.Get("WCSApiAddress");
if (string.IsNullOrEmpty(url))
{
return WebResponseContent.Instance.Error($"鏈壘鍒癢CSApi鍦板潃,璇锋鏌ラ厤缃枃浠�");
@@ -91,5 +99,52 @@
return WebResponseContent.Instance.Error(ex.Message);
}
}
+ /// <summary>
+ /// 鍏ュ簱浠诲姟瀹屾垚
+ /// </summary>
+ /// <param name="tasknum"></param>
+ /// <returns></returns>
+ public WebResponseContent InboundTaskCompleted(int taskNum)
+ {
+ try
+ {
+ Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
+ if (task == null)
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅");
+ }
+ Dt_Warehouse warehouse = _warehouseRepository.QueryFirst(x => x.WarehouseId == task.WarehouseId);
+ Dt_StockInfo stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode && x.WarehouseId == task.WarehouseId).First();
+ if (stockInfo == null)
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒版墭鐩樺搴旂殑缁勭洏淇℃伅");
+ }
+ //if (!string.IsNullOrEmpty(stockInfo.LocationCode))
+ //{
+ // return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡缁戝畾璐т綅");
+ //}
+ Dt_LocationInfo dt_LocationInfo = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress);
+ if (dt_LocationInfo == null)
+ {
+ return WebResponseContent.Instance.Error("鏈壘鍒板簱浣�");
+ }
+ dt_LocationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
+ stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+ _unitOfWorkManage.BeginTran();
+ //淇敼璐т綅鐘舵�佷负鏈夎揣
+ _locationInfoRepository.UpdateData(dt_LocationInfo);
+ //淇敼搴撳瓨鐘舵��
+ _stockRepository.UpdateData(stockInfo);
+ //鍒犻櫎浠诲姟娣诲姞鍘嗗彶
+ BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.浜哄伐瀹屾垚 : OperateTypeEnum.鑷姩瀹屾垚);
+ _unitOfWorkManage.CommitTran();
+ }
+ catch (Exception)
+ {
+ _unitOfWorkManage.RollbackTran();
+ throw;
+ }
+ return WebResponseContent.Instance.OK();
+ }
}
}
--
Gitblit v1.9.3