From 5fc251a847ccc0540da8b112ed2bddba846455d8 Mon Sep 17 00:00:00 2001
From: pan <antony1029@163.com>
Date: 星期一, 17 十一月 2025 20:39:49 +0800
Subject: [PATCH] 提交
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 65 ++++++++++++++++++++++++++------
1 files changed, 53 insertions(+), 12 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.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.cs"
index a98e3c4..27d5101 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.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.cs"
@@ -108,6 +108,7 @@
_outStockLockInfoService = outStockLockInfoService;
}
+
/// <summary>
///
/// </summary>
@@ -118,6 +119,7 @@
try
{
Dt_Task task;
+
if (int.TryParse(taskNum, out var newTaskNum))
{
task = BaseDal.QueryFirst(x => x.TaskNum == newTaskNum);
@@ -130,6 +132,7 @@
{
return WebResponseContent.Instance.Error("鏈壘鍒颁换鍔′俊鎭�");
}
+ _logger.LogInformation($"TaskService TaskCompleted: {JsonConvert.SerializeObject(task)} , {task.TaskType} ");
MethodInfo? methodInfo = GetType().GetMethod(((TaskTypeEnum)task.TaskType) + "TaskCompleted");
if (methodInfo != null)
@@ -144,6 +147,7 @@
}
catch (Exception ex)
{
+ _logger.LogError($"TaskService TaskCompleted: {ex.Message} ");
return WebResponseContent.Instance.Error(ex.Message);
}
}
@@ -252,22 +256,22 @@
business_type = inboundOrder.BusinessType,
factoryArea = inboundOrder.FactoryArea,
operationType = 1,
- Operator = inboundOrder.Modifier,
+ Operator = inboundOrder.Operator,
orderNo = inboundOrder.UpperOrderNo,
status = inboundOrder.OrderStatus,
details = new List<FeedbackInboundDetailsModel>()
};
- var groupedData = inboundOrder.Details.GroupBy(item => new { item.MaterielCode, item.SupplyCode, item.BatchNo, item.lineNo, item.BarcodeUnit, item.WarehouseCode})
+ var groupedData = inboundOrder.Details.GroupBy(item => new { item.MaterielCode, item.SupplyCode, item.BatchNo, item.lineNo, item.BarcodeUnit, item.WarehouseCode })
.Select(group => new FeedbackInboundDetailsModel
{
materialCode = group.Key.MaterielCode,
supplyCode = group.Key.SupplyCode,
batchNo = group.Key.BatchNo,
lineNo = group.Key.lineNo,
- // warehouseCode = group.Key.WarehouseCode=="0"?"1072": group.Key.WarehouseCode,
- warehouseCode= "1072",
+ warehouseCode = group.Key.WarehouseCode,
+ // warehouseCode= "1072",
unit = group.Key.BarcodeUnit,
barcodes = group.Select(row => new FeedbackBarcodesModel
{
@@ -276,20 +280,51 @@
}).ToList()
}).ToList();
feedmodel.details = groupedData;
-
+
_invokeMESService.FeedbackInbound(feedmodel);
}
}
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
_logger.LogInformation("InboundTaskCompleted 鍥炲啓MES澶辫触: " + ex.Message);
}
return WebResponseContent.Instance.OK();
}
+ public WebResponseContent OutboundTaskCompleted(Dt_Task task)
+ {
+ _logger.LogInformation($"TaskService OutboundTaskCompleted: {task.TaskNum}");
+ //鏌ヨ揣浣�
+ Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress);
+ if (locationInfo == null)
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒板搴旂殑缁堢偣璐т綅淇℃伅");
+ }
+ locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
+ _locationInfoService.Repository.UpdateData(locationInfo);
+ var outloks = _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>().Where(x => x.TaskNum == task.TaskNum).ToList();
+ outloks.ForEach(o =>
+ {
+ o.Status = OutLockStockStatusEnum.宸插嚭搴�.ObjToInt();
+ });
+ _outStockLockInfoService.Db.Updateable(outloks).ExecuteCommand();
+
+ var locationCodes = outloks.Select(it => it.LocationCode).Distinct().ToList();
+
+ //_stockRepository.Db.Updateable<Dt_StockInfo>()
+ // .SetColumns(it => new Dt_StockInfo { StockStatus = StockStatusEmun.})
+ // .Where(it => locationCodes.Contains(it.LocationCode))
+ // .ExecuteCommand();
+
+
+ return WebResponseContent.Instance.OK();
+
+
+ }
public async Task<WebResponseContent> InEmptyTaskCompleted(Dt_Task task)
{
@@ -343,14 +378,20 @@
}
}
+ public WebResponseContent InPickTaskCompleted(Dt_Task task)
+ {
+ _logger.LogInformation($"TaskService InPickTaskCompleted: {task.TaskNum}");
+
+ return WebResponseContent.Instance.OK();
+ }
public async Task<WebResponseContent> OutEmptyTaskCompleted(Dt_Task task)
{
WebResponseContent content = new WebResponseContent();
try
{
- Dt_StockInfo stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode && x.WarehouseId == task.WarehouseId).First();
+ Dt_StockInfo stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode).First();
if (stockInfo == null)
{
return WebResponseContent.Instance.Error($"鏈壘鍒版墭鐩樺搴旂殑搴撳瓨淇℃伅");
@@ -362,7 +403,6 @@
return content.Error($"鏈壘鍒板搴旂殑缁堢偣璐т綅淇℃伅");
}
- // _stockRepository.Db.Deleteable(stockInfo);
int beforeStatus = locationInfo.LocationStatus;
@@ -374,6 +414,7 @@
task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
_stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
+ _stockRepository.Db.Deleteable(stockInfo).ExecuteCommand();
_locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum);
@@ -382,16 +423,16 @@
}
catch (Exception ex)
{
+ _logger.LogError($"TaskService OutEmptyTaskCompleted: {ex.Message} ");
return await Task.FromResult(WebResponseContent.Instance.Error(ex.Message));
}
}
-
+
/// <summary>
- /// 鍥炲簱瀹屾垚鍥炶皟 - AGV灏嗘墭鐩樻斁鍥炶揣浣嶅悗璋冪敤
- /// </summary>
+ /// 鍥炲簱瀹屾垚鍥炶皟
public async Task<WebResponseContent> BackToStockComplete(Dt_Task task)
{
try
@@ -471,7 +512,7 @@
// 鏇存柊浠诲姟鐘舵�佷负宸插畬鎴�
task.TaskStatus = (int)TaskStatusEnum.Finish;
-
+
await Db.Updateable(task).ExecuteCommandAsync();
_unitOfWorkManage.CommitTran();
--
Gitblit v1.9.3