From 7202fced2a265369f83f1557d3db7525bb62d41b Mon Sep 17 00:00:00 2001
From: 肖洋 <cathay_xy@163.com>
Date: 星期一, 25 十一月 2024 16:21:30 +0800
Subject: [PATCH] 3
---
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs | 83 ++++++++++++++++++++++++++++++++++-------
1 files changed, 69 insertions(+), 14 deletions(-)
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
index fd86725..a54dac6 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -2,6 +2,7 @@
using Mapster;
using Masuit.Tools;
using Masuit.Tools.Models;
+using Microsoft.EntityFrameworkCore;
using System.Linq;
using System.Threading.Tasks;
using WIDESEA_DTO.MOM;
@@ -183,7 +184,7 @@
private (DtLocationInfo, Dt_Task) UpdateStockAndTaskStatus(DtStockInfo stock, Dt_Task task)
{
- var location = _locationRepository.QueryFirst(x => x.LocationCode == task.SourceAddress);
+ var location = _locationRepository.QueryFirst(x => x.LocationCode == task.SourceAddress && x.RoadwayNo == task.Roadway);
//var details = _stockInfoDetailRepository.QueryData(x => x.StockId == stock.Id);
location.LocationStatus = (int)LocationEnum.Free;
@@ -314,6 +315,7 @@
// 鏍规嵁鏄惁鏈夌粍鐩樹俊鎭垱寤哄簱瀛樺疄渚嬫ā鍨�
DtStockInfo stock = boxing == null ? CreateEmptyPalletStock(task, locationInf) : CreateFullPalletStock(task, locationInf, boxing);
+
// 鎵ц鏁版嵁搴撲簨鍔�
bool isResult = await ExecuteTransaction(stock, taskHty, locationInf, task.TaskId);
if (isResult)
@@ -349,13 +351,41 @@
CreateDate = DateTime.Now,
Creater = "system",
IsFull = false,
- AreaCode = area.AreaCode,
+ AreaCode = area.AreaCode ?? "",
LocationId = loation.Id,
StockInfoDetails = new List<DtStockInfoDetail>()
{
new DtStockInfoDetail()
{
MaterielCode = "绌烘墭鐩�",
+ Id = 0,
+ Status = (int)StockStateEmun.宸插叆搴�
+ }
+ }
+ };
+ }
+
+ /// <summary>
+ /// 鍒涘缓鍒嗗鐨勫疄鎵樼洏鐨勫簱瀛樺疄渚嬫ā鍨�
+ /// </summary>
+ private DtStockInfo CreateFullPalletStockByFR(Dt_Task task, DtLocationInfo locationInf)
+ {
+ var loation = _locationRepository.QueryFirst(x => x.RoadwayNo == task.Roadway && x.LocationCode == task.TargetAddress);
+ var area = _areaInfoRepository.QueryFirst(x => x.AreaID == loation.AreaId);
+ return new DtStockInfo()
+ {
+ PalletCode = task.PalletCode,
+ LocationCode = task.TargetAddress,
+ CreateDate = DateTime.Now,
+ Creater = "system",
+ IsFull = false,
+ AreaCode = area.AreaCode ?? "",
+ LocationId = loation.Id,
+ StockInfoDetails = new List<DtStockInfoDetail>()
+ {
+ new DtStockInfoDetail()
+ {
+ MaterielCode = "瀹炴墭鐩�",
Id = 0,
Status = (int)StockStateEmun.宸插叆搴�
}
@@ -440,9 +470,9 @@
}
LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "楠岃瘉浠诲姟鏄惁瀛樺湪", JsonConvert.SerializeObject(task));
- if(task.TaskType == (int)TaskOutboundTypeEnum.InToOut)
+ if (task.TaskType == (int)TaskOutboundTypeEnum.InToOut)
{
- return await CompleteInToOutTaskAsync(task);
+ return await CompleteInToOutTaskAsync(task);
}
// 楠岃瘉搴撳瓨鏄惁瀛樺湪
@@ -541,7 +571,17 @@
if (serialNosError.Count > 0)
{
// TODO 鍒涘缓浠诲姟閫佽嚦NG鎺掑嚭鍙�
- List<string> NGStation = input.Position == "1088" ? new List<string>() { "1020" } : new List<string>() { "JZSC01" };
+ var efg = _stationManagerRepository.QueryData(x => x.stationType == 1 && x.stationChildCode == input.Position && x.stationArea == area.AreaCode).ToList();
+ //List<string> NGStation = input.Position == "1088" ? new List<string>() { "1020" } : new List<string>() { "JZSC01" };
+ if(efg.Count <= 0)
+ {
+ throw new Exception("鏈壘鍒癗G鍏ュ簱绔欏彴閰嶇疆");
+ }
+ List<string> NGStation = efg.Select(x => x.stationNGLocation).ToList();
+ if (NGStation.Count <= 0)
+ {
+ NGStation = efg.Select(x => x.stationNGChildCode).ToList();
+ }
content = await CreateNewTask(input, NGStation, 2);
return content.Error("瀛樺湪寮傚父鐢佃姱");
}
@@ -560,7 +600,7 @@
// 璋冪敤CreateBoxingInfo鏂规硶锛屽垱寤虹粍鐩樹俊鎭�
- var boxing = await CreateBoxingInfo(result, input.PalletCode);
+ var boxing = CreateBoxingInfo(result, input.PalletCode);
if (boxing == null) return content.Error("缁勭洏澶辫触");
// 璋冪敤GetProcessApplyAsync鏂规硶锛岃幏鍙栧伐鑹鸿矾绾�
@@ -584,7 +624,13 @@
//// 璋冪敤GetProcessResponseAsync鏂规硶锛岃幏鍙栧伐鑹哄搷搴�
//var processResponse = await GetProcessResponseAsync(process, input.Position);
- List<string> strings = input.Position == "1088" ? new List<string>() { "CHSC01" } : new List<string>() { "JZSC01" };
+ //List<string> strings = input.Position == "1088" ? new List<string>() { "CHSC01" } : new List<string>() { "JZSC01" };
+ var stationManagers = _stationManagerRepository.QueryData(x => x.stationType == 1 && x.stationChildCode == input.Position && x.stationArea == area.AreaCode).ToList();
+ if (stationManagers.Count <= 0)
+ {
+ throw new Exception("鏈壘鍒癗G鍏ュ簱绔欏彴閰嶇疆");
+ }
+ List<string> strings = stationManagers.Select(x=>x.Roadway).ToList();
// 璋冪敤CreateNewTask鏂规硶锛屽垱寤烘柊浠诲姟
content = await CreateNewTask(input, strings);
if (content.Status)
@@ -658,8 +704,15 @@
return content.OK(data: task);
}
+ var stationManagers = _stationManagerRepository.QueryData(x => x.stationType == 1 && x.stationChildCode == input.Position).ToList();
+ if (stationManagers.Count <= 0)
+ {
+ throw new Exception("鏈壘鍒扮┖鎵樼洏鍏ュ簱绔欏彴閰嶇疆");
+ }
+
+
// 鑾峰彇鐩爣鍦板潃
- List<string> strings = input.Position == "1016" ? new List<string>() { "CHSC01" } : new List<string>() { "JZSC01" };
+ List<string> strings = stationManagers.Select(x => x.Roadway).ToList();
return await CreateNewTask(input, strings, 1);
}
@@ -678,7 +731,7 @@
}
// 鑾峰彇缁勭洏淇℃伅
- private async Task<DtBoxingInfo> CreateBoxingInfo(ResultTrayCellsStatus result, string palletCode)
+ private DtBoxingInfo CreateBoxingInfo(ResultTrayCellsStatus result, string palletCode)
{
return new DtBoxingInfo
{
@@ -1184,12 +1237,14 @@
{
// 娣诲姞搴撳瓨
isUpdateStock = await _stockInfoRepository.AddDataNavAsync(stock);
- isDeleteBoxing = await _boxingInfoRepository.Db.DeleteNav<DtBoxingInfo>(x => x.Id == boxingInfo.Id)
- .Include(x => x.BoxingInfoDetails)
- .ExecuteCommandAsync();
+ if (boxingInfo != null)
+ {
+ isDeleteBoxing = await _boxingInfoRepository.Db.DeleteNav<DtBoxingInfo>(x => x.Id == boxingInfo.Id)
+ .Include(x => x.BoxingInfoDetails)
+ .ExecuteCommandAsync();
+ }
+
}
-
-
// 娣诲姞鍘嗗彶浠诲姟
var isTaskHtyAdd = await _task_HtyRepository.AddDataAsync(taskHty) > 0;
--
Gitblit v1.9.3