From 7d3d385f0bdcf40b0c42d14ab526df318e04a433 Mon Sep 17 00:00:00 2001
From: pan <antony1029@163.com>
Date: 星期三, 10 十二月 2025 13:15:29 +0800
Subject: [PATCH] 提交
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs | 92 +++++++++++++--------------------------------
1 files changed, 27 insertions(+), 65 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_Outbound.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_Outbound.cs"
index 5cf304e..6457db1 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_Outbound.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_Outbound.cs"
@@ -1,4 +1,5 @@
-锘縰sing Microsoft.Extensions.Logging;
+锘縰sing MailKit.Search;
+using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
using System;
@@ -159,7 +160,7 @@
foreach (var key in keys)
{
var detail = _outboundOrderDetailService.Db.Ado.SqlQuerySingle<Dt_OutboundOrderDetail>(
- "SELECT * FROM Dt_OutboundOrderDetail WITH (UPDLOCK, ROWLOCK) WHERE Id = @Id",
+ "SELECT * FROM Dt_OutboundOrderDetail WITH (UPDLOCK) WHERE Id = @Id",
new { Id = key });
if (detail != null)
@@ -387,7 +388,6 @@
// TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
PalletType = stockInfo.PalletType,
WarehouseId = stockInfo.WarehouseId,
-
};
//if (taskType != TaskTypeEnum.OutEmpty)
//{
@@ -403,51 +403,7 @@
return tasks;
}
- public List<Dt_Task> GetTasks(List<Dt_StockInfo> stockInfos, TaskTypeEnum taskType)
- {
- List<Dt_Task> tasks = new List<Dt_Task>();
- List<Dt_LocationInfo> locationInfos = _locationInfoService.Repository.QueryData(x => stockInfos.Select(x => x.LocationCode).Contains(x.LocationCode));
- for (int i = 0; i < stockInfos.Count; i++)
- {
- Dt_StockInfo stockInfo = stockInfos[i];
- if (stockInfo != null)
- {
- Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.LocationCode == stockInfo.LocationCode);
- if (!tasks.Exists(x => x.PalletCode == stockInfo.PalletCode))
- {
- Dt_Task task = new()
- {
- CurrentAddress = stockInfo.LocationCode,
- Grade = 0,
- PalletCode = stockInfo.PalletCode,
- NextAddress = "",
- Roadway = locationInfo.RoadwayNo,
- SourceAddress = stockInfo.LocationCode,
- TargetAddress = "",
- TaskStatus = TaskStatusEnum.New.ObjToInt(),
- TaskType = taskType.ObjToInt(),
- //TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
- PalletType = stockInfo.PalletType,
- WarehouseId = stockInfo.WarehouseId,
-
- };
- //if (taskType != TaskTypeEnum.OutEmpty)
- //{
- // task.MaterielCode = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.MaterielCode;
- // task.Quantity = (float)stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).Sum(x => x.StockQuantity);
- // task.BatchNo = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.BatchNo;
- //}
- //if (stockInfo.StockLength > 0)
- //{
- // task.TaskLength = stockInfo.StockLength;
- //}
- tasks.Add(task);
- }
- }
- }
- return tasks;
- }
#region 鍐呭瓨閿佺鐞嗗櫒
private static readonly ConcurrentDictionary<string, SemaphoreSlim> _normalmaterialLocks =
@@ -626,28 +582,33 @@
{
try
{
- var allocorder = _allocateOrderRepository.Db.Queryable<Dt_AllocateOrder>().Includes(x => x.Details).Where(x => x.Details.Any(o => o.Id == orderDetailId)).First();
- //var allocorder = _allocateOrderDetailRepository.Db.Queryable<Dt_AllocateOrderDetail>()
- // .LeftJoin<Dt_AllocateOrder>((detail, order) => detail.OrderId == order.Id)
- // .Where((detail, order) => order.Id == orderDetailId)
- // .Select((detail, order) => order)
- // .First();
- if (allocorder == null)
- {
- return WebResponseContent.Instance.Error("鎵句笉鍒板崟鎹�");
- }
- var outboundOrder = _outboundOrderService.Db.Queryable<Dt_OutboundOrder>().Includes(x => x.Details).First(x => x.OrderNo == allocorder.OrderNo);
+ //var allocorder = _allocateOrderRepository.Db.Queryable<Dt_AllocateOrder>().Includes(x => x.Details).Where(x => x.Details.Any(o => o.Id == orderDetailId)).First();
+ ////var allocorder = _allocateOrderDetailRepository.Db.Queryable<Dt_AllocateOrderDetail>()
+ //// .LeftJoin<Dt_AllocateOrder>((detail, order) => detail.OrderId == order.Id)
+ //// .Where((detail, order) => order.Id == orderDetailId)
+ //// .Select((detail, order) => order)
+ //// .First();
+ //if (allocorder == null)
+ //{
+ // return WebResponseContent.Instance.Error("鎵句笉鍒板崟鎹�");
+ //}
+
+ var outboundOrder = SqlSugarHelper.DbWMS.Queryable<Dt_OutboundOrder>().Includes(x => x.Details).Where(x => x.Details.Any(o => o.Id == orderDetailId)).First();
+
if (outboundOrder == null)
{
return WebResponseContent.Instance.Error("鎵句笉鍒板嚭搴撳崟鎹�");
}
-
- var orderdetail = outboundOrder.Details.Where(outItem => allocorder.Details.Any(allocItem => allocItem.MaterielCode == outItem.MaterielCode && allocItem.LineNo == outItem.lineNo
- && allocItem.BarcodeQty == outItem.BarcodeQty && allocItem.WarehouseCode == outItem.WarehouseCode && allocItem.BarcodeUnit == outItem.BarcodeUnit)).First();
- if (orderdetail == null)
+ if (outboundOrder.Details == null || !outboundOrder.Details.Any())
{
return WebResponseContent.Instance.Error("鎵句笉鍒板嚭搴撴槑缁嗗崟鎹�");
}
+ //var orderdetail = outboundOrder.Details.Where(outItem => allocorder.Details.Any(allocItem => allocItem.MaterielCode == outItem.MaterielCode && allocItem.LineNo == outItem.lineNo
+ // && allocItem.BarcodeQty == outItem.BarcodeQty && allocItem.WarehouseCode == outItem.WarehouseCode && allocItem.BarcodeUnit == outItem.BarcodeUnit)).First();
+ //if (orderdetail == null)
+ //{
+ // return WebResponseContent.Instance.Error("鎵句笉鍒板嚭搴撴槑缁嗗崟鎹�");
+ //}
(List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(outboundOrder.Details.First().Id, stockSelectViews, station);
@@ -713,7 +674,8 @@
Dt_OutboundOrderDetail? orderDetail = null;
List<Dt_OutStockLockInfo>? outStockLockInfos = null;
List<Dt_LocationInfo>? locationInfos = null;
- if (outboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt())
+ if (outboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt() ||
+ outboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.Outbound.ObjToInt())
{
(List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundOrderDetailService.AssignStockOutbound(outboundOrderDetail, stockSelectViews);
if (result.Item1 != null && result.Item1.Count > 0)
@@ -749,7 +711,7 @@
if (stockLockInfos != null && stockLockInfos.Count > 0)
{
List<Dt_StockInfo> stocks = _stockService.StockInfoService.GetStockInfosByPalletCodes(stockLockInfos.Select(x => x.PalletCode).Distinct().ToList());
- tasks = GetTasks(stocks, TaskTypeEnum.Outbound);
+ tasks = GetTasks(stocks, TaskTypeEnum.Outbound,station);
}
}
@@ -1001,7 +963,7 @@
List<Dt_Task> tasks = new List<Dt_Task>();
// 鑾峰彇璁㈠崟鏄庣粏
- var outboundOrderDetail = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>().With("UPDLOCK, ROWLOCK")
+ var outboundOrderDetail = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>().With("UPDLOCK")
.FirstAsync(x => x.Id == orderDetailId);
if (outboundOrderDetail == null)
--
Gitblit v1.9.3