From 597cca93854339e7b7df7e516a75d0d4936faea7 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期一, 23 十二月 2024 21:04:09 +0800
Subject: [PATCH] 1
---
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs | 82 +++++++++++++++++++++++++++++++++++++----
1 files changed, 74 insertions(+), 8 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 713e75d..6b3fe45 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"
@@ -8,9 +8,11 @@
using WIDESEA_Common.OtherEnum;
using WIDESEA_Common.StockEnum;
using WIDESEA_Common.TaskEnum;
+using WIDESEA_Common.WareHouseEnum;
using WIDESEA_Core;
using WIDESEA_Core.BaseServices;
using WIDESEA_DTO;
+using WIDESEA_DTO.ERP;
using WIDESEA_DTO.MES;
using WIDESEA_ITaskInfoRepository;
using WIDESEA_ITaskInfoService;
@@ -30,14 +32,15 @@
MesResponseContent responseContent = new MesResponseContent();
try
{
- //鑾峰彇搴撳瓨璁板綍 warehouseID鏆傚畾鍏堢敤鍥哄畾鍊� TEST
- Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.WarehouseId == 1 &&
- x.PalletCode == model.ToolCode &&
+ 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.StockStatus==(int)StockStatusEmun.鍏ュ簱瀹屾垚)
- .Includes(x => x.Details).First();
+ .Includes(x => x.Details).Where(x => x.Details.Any(x => x.MaterielCode == model.ToolCode)).First();
if (stockInfo==null)
{
- return responseContent.Error($"娴嬭瘯鏋舵墭鐩�:{model.ToolCode}鏃犲簱瀛樿褰�");
+ return responseContent.Error($"娴嬭瘯鏋�:{model.ToolCode}鏃犲彲鐢ㄥ簱瀛�");
}
Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode &&
x.WarehouseId == stockInfo.WarehouseId &&
@@ -45,7 +48,7 @@
(x.EnableStatus == (int)EnableStatusEnum.Normal || x.EnableStatus == (int)EnableStatusEnum.OnlyOut));
if (locationInfo==null)
{
- return responseContent.Error($"璐т綅:{stockInfo.LocationCode}鍑哄簱鏉′欢涓嶆弧瓒�");
+ return responseContent.Error($"娴嬭瘯鏋惰揣浣�:{stockInfo.LocationCode}鍑哄簱鏉′欢涓嶆弧瓒�");
}
//鐢熸垚娴嬭瘯鏋跺嚭搴撲换鍔� 閿佸畾搴撳瓨 鏇存敼璐т綅鐘舵��
Dt_Task taskOut = new()
@@ -57,8 +60,8 @@
Roadway = locationInfo.RoadwayNo,
SourceAddress = stockInfo.LocationCode,
TargetAddress = "",
- TaskStatus = (int)TaskOutStatusEnum.OutNew,
- TaskType = (int)TaskOutboundTypeEnum.OutTestStand,
+ TaskStatus = (int)TaskStatusEnum.New,
+ TaskType = (int)TaskTypeEnum.TestOutbound,
TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
PalletType = stockInfo.PalletType,
WarehouseId = stockInfo.WarehouseId,
@@ -66,6 +69,7 @@
stockInfo.StockStatus = (int)StockStatusEmun.鍑哄簱閿佸畾;
LocationStatusEnum locationStatus = (LocationStatusEnum)locationInfo.LocationStatus;
locationInfo.LocationStatus = (int)LocationStatusEnum.Lock;
+ //鍒ゆ柇鏄惁鏈夊嚭搴撳崟淇℃伅
_unitOfWorkManage.BeginTran();
//鏇存柊搴撳瓨鐘舵��
_stockRepository.StockInfoRepository.UpdateData(stockInfo);
@@ -76,6 +80,8 @@
//鍔犲叆璐т綅鍙樺姩璁板綍
_recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, locationStatus, LocationChangeType.OutboundAssignLocation, stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", taskOut.TaskNum);
_unitOfWorkManage.CommitTran();
+ //灏嗕换鍔℃帹閫佸埌WCS
+ PushTasksToWCS();
responseContent.OK();
}
catch (Exception ex)
@@ -85,5 +91,65 @@
}
return responseContent;
}
+ /// <summary>
+ /// 娴嬭瘯鏋堕��搴�
+ /// </summary>
+ /// <returns></returns>
+ public MesResponseContent TestReturnStock(TestToolBackModel backModel)
+ {
+ MesResponseContent responseContent = new MesResponseContent();
+ try
+ {
+
+ }
+ catch (Exception ex)
+ {
+ responseContent.Error(ex.Message);
+ }
+ return responseContent;
+ }
+ /// <summary>
+ /// 娴嬭瘯鏋舵姤搴�
+ /// </summary>
+ /// <returns></returns>
+ public MesResponseContent TestScrap(TestToolScrap toolScrap)
+ {
+ MesResponseContent responseContent = new MesResponseContent();
+ try
+ {
+ //鑾峰彇娴嬭瘯鏋舵壒娆″彿搴撳瓨
+ 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)
+ .Includes(x => x.Details).Where(x => x.Details.Any(x => x.MaterielCode == toolScrap.ToolCode)).First();
+ }
+ catch (Exception ex)
+ {
+ responseContent.Error(ex.Message);
+ }
+ return responseContent;
+ }
+ /// <summary>
+ /// 鍚屾娴嬭瘯鏋跺鍛�
+ /// </summary>
+ /// <param name="toolSynInfo"></param>
+ /// <returns></returns>
+ public WebResponseContent TestSynStock(TestToolSynInfo toolSynInfo)
+ {
+ WebResponseContent content= new WebResponseContent();
+ try
+ {
+ Root<TestToolSynInfo> root = new Root<TestToolSynInfo>()
+ {
+
+ };
+ }
+ catch (Exception ex)
+ {
+ content.Error(ex.Message);
+ }
+ return content;
+ }
}
}
--
Gitblit v1.9.3