From 88d52606d0db8fb0343ebcd2d53c8df62fd05f2a Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期六, 28 十二月 2024 23:39:46 +0800
Subject: [PATCH] 1
---
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 81 +++++++++++++++++++++++++++-------------
1 files changed, 54 insertions(+), 27 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
index 00206f2..a5bbf26 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
@@ -25,6 +25,7 @@
using WIDESEA_Common.OrderEnum;
using WIDESEA_Common.StockEnum;
using WIDESEA_Common.TaskEnum;
+using WIDESEA_Common.WareHouseEnum;
using WIDESEA_Core;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
@@ -36,6 +37,7 @@
using WIDESEA_External.ERPService;
using WIDESEA_IBasicRepository;
using WIDESEA_IBasicService;
+using WIDESEA_IInboundRepository;
using WIDESEA_IInboundService;
using WIDESEA_IOutboundRepository;
using WIDESEA_IOutboundService;
@@ -61,6 +63,8 @@
private readonly IBasicRepository _basicRepository;
private readonly IApiInfoRepository _apiInfoRepository;
private readonly IInvokeERPService _invokeERPService;
+ private readonly IInboundRepository _inboundRepository;
+ private readonly IInboundOrderService _inboundOrderService;
public ITaskRepository Repository => BaseDal;
@@ -74,7 +78,7 @@
public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList();
- public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IStockRepository stockRepository, IBasicService basicService, IRecordService recordService, IOutboundService outboundService, IStockService stockService, IBasicRepository basicRepository, IApiInfoRepository apiInfoRepository, IInvokeERPService invokeERPService) : base(BaseDal)
+ public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IStockRepository stockRepository, IBasicService basicService, IRecordService recordService, IOutboundService outboundService, IStockService stockService, IBasicRepository basicRepository, IApiInfoRepository apiInfoRepository, IInvokeERPService invokeERPService, IInboundRepository inboundRepository, IInboundOrderService inboundOrderService) : base(BaseDal)
{
_mapper = mapper;
_unitOfWorkManage = unitOfWorkManage;
@@ -86,19 +90,23 @@
_basicRepository = basicRepository;
_apiInfoRepository = apiInfoRepository;
_invokeERPService = invokeERPService;
+ _inboundRepository = inboundRepository;
+ _inboundOrderService = inboundOrderService;
}
/// <summary>
/// 浠诲姟淇℃伅鎺ㄩ�佽嚦WCS
/// </summary>
/// <returns></returns>
- public WebResponseContent PushTasksToWCS()
+ public WebResponseContent PushTasksToWCS(List<Dt_Task> tasks, string agvDescription = "")
{
try
{
- List<Dt_Task> tasks = BaseDal.QueryData(x => (TaskTypes.Contains(x.TaskType) && x.TaskStatus == (int)TaskStatusEnum.New));
List<WMSTaskDTO> taskDTOs = _mapper.Map<List<WMSTaskDTO>>(tasks);
-
+ taskDTOs.ForEach(x =>
+ {
+ x.AGVArea = agvDescription;
+ });
string response = HttpHelper.Post("http://127.0.0.1:9291/api/Task/ReceiveTask", taskDTOs.Serialize());
return JsonConvert.DeserializeObject<WebResponseContent>(response) ?? WebResponseContent.Instance.Error("杩斿洖閿欒");
@@ -124,12 +132,12 @@
return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅");
}
- if (task.TaskType != TaskTypeEnum.Inbound.ObjToInt())
- {
- return WebResponseContent.Instance.Error($"浠诲姟绫诲瀷閿欒");
- }
+ //if (task.TaskType != TaskTypeEnum.Inbound.ObjToInt())
+ //{
+ // return WebResponseContent.Instance.Error($"浠诲姟绫诲瀷閿欒");
+ //}
- Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode).Includes(x => x.Details).First();
+ Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode && x.WarehouseId==task.WarehouseId).Includes(x => x.Details).First();
if (stockInfo == null)
{
return WebResponseContent.Instance.Error($"鏈壘鍒版墭鐩樺搴旂殑缁勭洏淇℃伅");
@@ -140,7 +148,7 @@
return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡缁戝畾璐т綅");
}
- if (stockInfo.Details == null || stockInfo.Details.Count == 0)
+ if (stockInfo.Details.Count == 0)
{
return WebResponseContent.Instance.Error($"鏈壘鍒拌鎵樼洏搴撳瓨鏄庣粏淇℃伅");
}
@@ -158,27 +166,35 @@
LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus;
locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
-
+ Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x=>x.WarehouseId== task.WarehouseId);
//娴嬭瘯鏋跺叆搴撳簱瀛樼姸鎬�
- if (task.TaskType == TaskTypeEnum.TestInbound.ObjToInt())
+ if (task.TaskType == TaskTypeEnum.Inbound.ObjToInt() && warehouse.WarehouseCode==WarehouseEnum.HA64.ToString())
{
stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚鏈缓鍑哄簱鍗�.ObjToInt();
- stockInfo.Details.ForEach(x =>
- {
- x.Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
- });
}
else
{
stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+
}
+ stockInfo.Details.ForEach(x =>
+ {
+ x.Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+ });
stockInfo.LocationCode = locationInfo.LocationCode;
-
+ //鎺ㄩ�佸叆搴撳畬鎴愮粰Erp
+ Dt_InboundOrder? inboundOrder = _inboundRepository.InboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Where(x => x.InboundOrderNo == stockInfo.Details.FirstOrDefault().OrderNo).Includes(x=>x.Details).First();
+ if (inboundOrder == null)
+ {
+ return WebResponseContent.Instance.Error($"瀵瑰簲鍏ュ簱鍗曚笉瀛樺湪");
+ }
+ if (!_inboundOrderService.FeedbackInboundOrder(stockInfo, inboundOrder).Status)
+ {
+ return WebResponseContent.Instance.Error($"鍏ュ簱鍚屾Erp澶辫触");
+ }
_unitOfWorkManage.BeginTran();
BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.浜哄伐瀹屾垚 : OperateTypeEnum.鑷姩瀹屾垚);
-
- _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
-
+ _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId);
_stockRepository.StockInfoRepository.UpdateData(stockInfo);
_stockRepository.StockInfoDetailRepository.UpdateData(stockInfo.Details);
_recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationChangeType.InboundCompleted);
@@ -219,9 +235,10 @@
{
return WebResponseContent.Instance.Error($"鏈壘鍒拌揣浣嶄俊鎭�");
}
-
+ Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x=>x.WarehouseId== task.WarehouseId);
List<Dt_OutStockLockInfo> outStockLockInfos = _outboundService.OutboundStockLockInfoService.Repository.QueryData(x => x.TaskNum == taskNum);
- if (outStockLockInfos == null || outStockLockInfos.Count == 0)
+
+ if ((outStockLockInfos == null || outStockLockInfos.Count == 0) && warehouse.WarehouseCode != WarehouseEnum.HA64.ToString())
{
return WebResponseContent.Instance.Error($"鏈壘鍒板嚭搴撹鎯呬俊鎭�");
}
@@ -240,21 +257,31 @@
outboundOrderDetails.Add(outboundOrderDetail);
}
}
-
+ if (warehouse.WarehouseCode != WarehouseEnum.HA64.ToString())
+ {
+ //鎺ㄩ�佸嚭搴撳畬鎴�
+ WebResponseContent webResponse = _outboundService.OutboundOrderService.TestOutUpload(outboundOrderDetails.FirstOrDefault().Id,stockInfo);
+ if (!webResponse.Status)
+ {
+ return webResponse;
+ }
+ }
_unitOfWorkManage.BeginTran();
- _outboundService.OutboundOrderDetailService.Repository.UpdateData(outboundOrderDetails);
-
+ if (outboundOrderDetails.Count>0)
+ {
+ _outboundService.OutboundOrderDetailService.Repository.UpdateData(outboundOrderDetails);
+ }
stockInfo.LocationCode = locationInfo.LocationCode;
stockInfo.StockStatus = StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt();
_stockService.StockInfoService.Repository.UpdateData(stockInfo);
-
int beforeStatus = locationInfo.LocationStatus;
locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
- _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
+ _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)stockInfo.PalletType, LocationStatusEnum.Free, stockInfo.WarehouseId);
BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
_recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, (LocationStatusEnum)beforeStatus, LocationChangeType.OutboundCompleted, stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum);
_unitOfWorkManage.CommitTran();
+
return WebResponseContent.Instance.OK();
}
--
Gitblit v1.9.3