From 208193e821f7e8b950a3e069ffd1d28a646ffd8b Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期二, 24 十二月 2024 00:23:30 +0800
Subject: [PATCH] 1
---
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 52 insertions(+), 5 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs"
index 51ea1cd..d6a30ef 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs"
@@ -1,8 +1,10 @@
-锘縰sing System;
+锘縰sing SqlSugar.Extensions;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using WIDESEA_Common.APIEnum;
using WIDESEA_Common.CommonEnum;
using WIDESEA_Common.LocationEnum;
using WIDESEA_Common.OtherEnum;
@@ -11,6 +13,7 @@
using WIDESEA_Common.WareHouseEnum;
using WIDESEA_Core;
using WIDESEA_Core.BaseServices;
+using WIDESEA_Core.Enums;
using WIDESEA_DTO;
using WIDESEA_DTO.ERP;
using WIDESEA_DTO.MES;
@@ -79,6 +82,8 @@
BaseDal.AddData(taskOut);
//鍔犲叆璐т綅鍙樺姩璁板綍
_recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, locationStatus, LocationChangeType.OutboundAssignLocation, stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", taskOut.TaskNum);
+ //鍔犲叆搴撳瓨鍙樺姩璁板綍
+ //_recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfoDetails, beforeQuantity, totalQuantity, StockChangeTypeEnum.MaterielGroup);
_unitOfWorkManage.CommitTran();
//灏嗕换鍔℃帹閫佸埌WCS
PushTasksToWCS();
@@ -95,7 +100,7 @@
/// 娴嬭瘯鏋堕��搴�
/// </summary>
/// <returns></returns>
- public MesResponseContent TestReturnStock(TestToolBackModel backModel)
+ public MesResponseContent TestToolBack(TestToolBackModel backModel)
{
MesResponseContent responseContent = new MesResponseContent();
try
@@ -107,9 +112,38 @@
x.WarehouseId == warehouse.WarehouseId &&
x.StockStatus == (int)StockStatusEmun.鍑哄簱瀹屾垚)
.Includes(x => x.Details).Where(x => x.Details.Any(x => x.BatchNo == backModel.TestToolCode)).First();
+ if (stockInfo==null)
+ {
+ return responseContent.Error($"{backModel.TestToolCode}搴撳瓨淇℃伅涓嶅瓨鍦�");
+ }
+ //鐢熸垚閫�搴撲换鍔�
+ Dt_Task taskIn = new()
+ {
+ CurrentAddress = backModel.SourceAddressCode,
+ Grade = 0,
+ PalletCode = stockInfo.PalletCode,
+ NextAddress = "",
+ Roadway = "",
+ SourceAddress = backModel.SourceAddressCode,
+ TargetAddress = "",
+ TaskStatus = (int)TaskStatusEnum.New,
+ TaskType = (int)TaskTypeEnum.TestBackbound,
+ TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+ PalletType = stockInfo.PalletType,
+ WarehouseId = stockInfo.WarehouseId,
+ };
+ //鏇存敼搴撳瓨鐘舵��
+ stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt();
+ _unitOfWorkManage.BeginTran();
+ _stockRepository.StockInfoRepository.UpdateData(stockInfo);
+ _unitOfWorkManage.CommitTran();
+ //灏嗕换鍔℃帹閫佸埌WCS
+ PushTasksToWCS();
+ responseContent.OK();
}
catch (Exception ex)
{
+ _unitOfWorkManage.RollbackTran();
responseContent.Error(ex.Message);
}
return responseContent;
@@ -127,14 +161,23 @@
Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA64.ToString());
//鑾峰彇搴撳瓨璁板綍
Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x =>
- x.WarehouseId == warehouse.WarehouseId)
+ x.WarehouseId == warehouse.WarehouseId && x.StockStatus==StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt())
.Includes(x => x.Details).Where(x => x.Details.Any(x => x.BatchNo == toolScrap.ToolCode)).First();
+ if (stockInfo == null)
+ {
+ return responseContent.Error($"{toolScrap.ToolCode}搴撳瓨淇℃伅涓嶅瓨鍦�");
+ }
//娓呴櫎搴撳瓨淇℃伅
_unitOfWorkManage.BeginTran();
-
+ _stockRepository.StockInfoRepository.DeleteData(stockInfo);
+ _stockRepository.StockInfoDetailRepository.DeleteData(stockInfo.Details);
+ _stockRepository.StockInfoRepository.DeleteAndMoveIntoHty(stockInfo,OperateTypeEnum.鑷姩鍒犻櫎);
+ _stockRepository.StockInfoDetailRepository.DeleteAndMoveIntoHty(stockInfo.Details, OperateTypeEnum.鑷姩鍒犻櫎);
+ _unitOfWorkManage.CommitTran();
}
catch (Exception ex)
{
+ _unitOfWorkManage.RollbackTran();
responseContent.Error(ex.Message);
}
return responseContent;
@@ -149,10 +192,14 @@
WebResponseContent content= new WebResponseContent();
try
{
+ Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x=>x.ApiCode==APIEnum.WMS_MES_TestToolSync.ToString());
Root<TestToolSynInfo> root = new Root<TestToolSynInfo>()
{
-
+ From = "WMS",
+ DateTime = DateTime.Now.ToString(),
+ Content=toolSynInfo
};
+ //璋冪敤鎺ュ彛
}
catch (Exception ex)
{
--
Gitblit v1.9.3