From 07774c70a65bed6bacf936bdd66f756ba9c7f266 Mon Sep 17 00:00:00 2001
From: pan <antony1029@163.com>
Date: 星期二, 02 十二月 2025 10:15:48 +0800
Subject: [PATCH] 提交
---
项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/AllocateStockSelect.vue | 7 +-
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs | 136 +++++++++++++++++++++++++++++++++++----------
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs | 16 ++++
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs | 4
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 8 ++
5 files changed, 132 insertions(+), 39 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/AllocateStockSelect.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/AllocateStockSelect.vue"
index 4733980..1bf588f 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/AllocateStockSelect.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/AllocateStockSelect.vue"
@@ -140,6 +140,7 @@
{ prop: "palletCode", title: "鎵樼洏缂栧彿", type: "string", width: 150 },
{ prop: "locationCode", title: "璐т綅缂栧彿", type: "string", width: 180 },
{ prop: "useableQuantity", title: "鍙敤鏁伴噺", type: "string" },
+ {prop:"orderDetailId",title:"鍗曟嵁鏄庣粏涓婚敭",type:"string",width:150,hidden:true},
],
selection: [],
selectionSum: 0,
@@ -200,13 +201,13 @@
this.$refs.outboundFormRef.validate((valid) => {
if (!valid) return;
-
+console.log(this.selection)
if (this.selection.length <= 0) {
return this.$message.error("璇峰嬀閫�");
}
let url = this.pkcx
- ? "api/Task/GenerateOutboundTask?orderDetailId="
- : "api/Task/GenerateOutboundTask?orderDetailId=";
+ ? "api/Task/GenerateAllocatOutboundTask?orderDetailId="
+ : "api/Task/GenerateAllocatOutboundTask?orderDetailId=";
this.http
.post(url + this.row.id, this.selection, "鏁版嵁澶勭悊涓�")
.then((x) => {
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_ITaskInfoService/ITaskService.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_ITaskInfoService/ITaskService.cs"
index 2b3b106..584d501 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_ITaskInfoService/ITaskService.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_ITaskInfoService/ITaskService.cs"
@@ -46,10 +46,10 @@
Task<WebResponseContent> GenerateOutboundTasksAsync(int[] keys, string outStation);
- WebResponseContent GenerateOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews);
+ Task<WebResponseContent> GenerateOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews);
Task<WebResponseContent> GenerateOutboundBatchTasksAsync(int orderDetailId, decimal batchQuantity, string outStation);
-
+ Task<WebResponseContent> GenerateAllocatOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews);
}
}
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 0a09b2d..29f446f 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"
@@ -66,8 +66,10 @@
private readonly IRepository<Dt_StockInfo> _stockRepository;
private readonly ILocationInfoService _locationInfoService;
private readonly IInboundOrderService _inboundOrderService;
- private readonly IInboundOrderDetailService _inboundOrderDetailService;
+ private readonly IInboundOrderDetailService _inboundOrderDetailService;
+ private readonly IRepository<Dt_AllocateOrderDetail> _allocateOrderDetailRepository;
+ private readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository;
private readonly IRepository<Dt_ReCheckOrder> _reCheckOrderRepository;
private readonly IRepository<Dt_OutboundBatch> _OutboundBatchRepository;
private readonly IOutboundOrderService _outboundOrderService;
@@ -98,7 +100,7 @@
public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList();
- public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository,IRepository<Dt_ReCheckOrder> reCheckOrderRepository) : base(BaseDal)
+ public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository, IRepository<Dt_ReCheckOrder> reCheckOrderRepository, IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository) : base(BaseDal)
{
_mapper = mapper;
_unitOfWorkManage = unitOfWorkManage;
@@ -118,6 +120,8 @@
_allocateService = allocateService;
_OutboundBatchRepository = outboundBatchRepository;
_reCheckOrderRepository = reCheckOrderRepository;
+ _allocateOrderDetailRepository = allocateOrderDetailRepository;
+ _allocateOrderRepository = allocateOrderRepository;
}
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 8f26611..73516ab 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"
@@ -200,10 +200,10 @@
/// <summary>
/// 娓呯悊涔嬪墠鐨勬棤鏁堥攣瀹氳褰�
/// </summary>
- private void CleanupPreviousInvalidLocks(List<Dt_OutboundOrderDetail> orderDetails)
+ private void CleanupPreviousInvalidLocks(List<Dt_OutboundOrderDetail> orderDetails)
{
var orderIds = orderDetails.Select(x => x.OrderId).Distinct().ToList();
- var orderNos = _outboundOrderService.Db.Queryable<Dt_OutboundOrder>()
+ var orderNos = _outboundOrderService.Db.Queryable<Dt_OutboundOrder>()
.Where(x => orderIds.Contains(x.Id))
.Select(x => x.OrderNo)
.ToList();
@@ -211,15 +211,15 @@
// 娓呯悊鐘舵�佷负"宸查噴鏀�"鎴�"鍥炲簱涓�"鐨勬棫閿佸畾璁板綍
foreach (var orderNo in orderNos)
{
- _outStockLockInfoService.Db.Updateable<Dt_OutStockLockInfo>()
- .SetColumns(x => new Dt_OutStockLockInfo
- {
- Status = (int)OutLockStockStatusEnum.宸查噴鏀�
- })
- .Where(x => x.OrderNo == orderNo &&
- (x.Status == (int)OutLockStockStatusEnum.鍥炲簱涓� ||
- x.Status == (int)OutLockStockStatusEnum.宸查噴鏀�))
- .ExecuteCommand();
+ _outStockLockInfoService.Db.Updateable<Dt_OutStockLockInfo>()
+ .SetColumns(x => new Dt_OutStockLockInfo
+ {
+ Status = (int)OutLockStockStatusEnum.宸查噴鏀�
+ })
+ .Where(x => x.OrderNo == orderNo &&
+ (x.Status == (int)OutLockStockStatusEnum.鍥炲簱涓� ||
+ x.Status == (int)OutLockStockStatusEnum.宸查噴鏀�))
+ .ExecuteCommand();
}
}
@@ -258,7 +258,7 @@
{
outboundOrder.OrderStatus = OutOrderStatusEnum.鍑哄簱涓�.ObjToInt();
}
- outboundOrder.Operator = App.User.UserName;
+ outboundOrder.Operator = App.User.UserName;
_outboundOrderService.Repository.UpdateData(outboundOrder);
WebResponseContent content = _outboundOrderDetailService.LockOutboundStockDataUpdate(stockInfos, outboundOrderDetails, outStockLockInfos, locationInfos, tasks: tasks);
@@ -477,26 +477,63 @@
}
}
-
+ public async Task<WebResponseContent> GenerateAllocatOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews)
+ {
+ 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);
+ 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)
+ {
+ 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);
+
+ WebResponseContent content =await GenerateOutboundTaskDataUpdate(result.Item1, result.Item2, result.Item3, result.Item4, result.Item5);
+
+ return content;
+ }
+ catch (Exception ex)
+ {
+ return WebResponseContent.Instance.Error(ex.Message);
+ }
+ }
/// <summary>
/// 鐢熸垚鍑哄簱浠诲姟
/// </summary>
/// <param name="orderDetailId"></param>
/// <param name="stockSelectViews"></param>
/// <returns></returns>
- public WebResponseContent GenerateOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews)
+ public async Task<WebResponseContent> GenerateOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews)
{
try
{
var orderNo = _reCheckOrderRepository.Db.Queryable<Dt_ReCheckOrder>().First(x => x.Id == orderDetailId)?.OrderNo;
- var outboundOrder = _outboundOrderService.Db.Queryable<Dt_OutboundOrder>().Includes(x => x.Details).First(x => x.UpperOrderNo == orderNo);
- if(outboundOrder == null)
+ var outboundOrder = _outboundOrderService.Db.Queryable<Dt_OutboundOrder>().Includes(x => x.Details).First(x => x.UpperOrderNo == orderNo);
+ if (outboundOrder == 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);
- WebResponseContent content = GenerateOutboundTaskDataUpdate(result.Item1, result.Item2, result.Item3, result.Item4, result.Item5);
+ WebResponseContent content =await GenerateOutboundTaskDataUpdate(result.Item1, result.Item2, result.Item3, result.Item4, result.Item5);
return content;
}
@@ -583,7 +620,7 @@
/// <param name="outStockLockInfos"></param>
/// <param name="locationInfos"></param>
/// <returns></returns>
- public WebResponseContent GenerateOutboundTaskDataUpdate(List<Dt_Task> tasks, List<Dt_StockInfo>? stockInfos = null, List<Dt_OutboundOrderDetail>? outboundOrderDetails = null, List<Dt_OutStockLockInfo>? outStockLockInfos = null, List<Dt_LocationInfo>? locationInfos = null)
+ public async Task< WebResponseContent> GenerateOutboundTaskDataUpdate(List<Dt_Task> tasks, List<Dt_StockInfo>? stockInfos = null, List<Dt_OutboundOrderDetail>? outboundOrderDetails = null, List<Dt_OutStockLockInfo>? outStockLockInfos = null, List<Dt_LocationInfo>? locationInfos = null)
{
try
{
@@ -628,7 +665,46 @@
}
_unitOfWorkManage.CommitTran();
//PushTasksToWCS(tasks);
- return WebResponseContent.Instance.OK();
+ TaskModel esstask = new TaskModel()
+ {
+ taskType = "carry",
+ taskGroupCode = "",
+ groupPriority = 0,
+ tasks = new List<TasksType>()
+ };
+
+ foreach (var task in tasks)
+ {
+ esstask.
+ tasks.Add(new TasksType
+ {
+ taskCode = task.TaskNum.ToString(),
+ taskPriority = 0,
+ taskDescribe = new TaskDescribeType
+ {
+ containerCode = task.PalletCode,
+ containerType = "CT_KUBOT_STANDARD",
+ fromLocationCode = task.SourceAddress ?? "",
+ toStationCode = "",
+ toLocationCode = task.TargetAddress,
+ deadline = 0,
+ storageTag = ""
+ }
+ }
+ );
+ }
+ var result = await _eSSApiService.CreateTaskAsync(esstask);
+
+ _logger.LogInformation("鍒涘缓浠诲姟PalletOutboundTask 杩斿洖: " + result);
+ if (result)
+ {
+ return WebResponseContent.Instance.OK();
+ }
+ else
+ {
+ return WebResponseContent.Instance.Error("涓嬪彂鏈哄櫒浜轰换鍔″け璐ワ紒");
+ }
+
}
catch (Exception ex)
{
@@ -644,7 +720,7 @@
/// <summary>
/// 鍒嗘壒鍒嗛厤搴撳瓨
/// </summary>
- public async Task<WebResponseContent> GenerateOutboundBatchTasksAsync(int orderDetailId, decimal batchQuantity, string outStation)
+ public async Task<WebResponseContent> GenerateOutboundBatchTasksAsync(int orderDetailId, decimal batchQuantity, string outStation)
{
try
{
@@ -692,20 +768,20 @@
/// 鍒嗘壒鍒嗛厤搴撳瓨鏁版嵁澶勭悊
/// </summary>
public async Task<(List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?)>
- BatchAllocateStockDataHandle( int orderDetailId, decimal batchQuantity, string outStation)
+ BatchAllocateStockDataHandle(int orderDetailId, decimal batchQuantity, string outStation)
{
List<Dt_Task> tasks = new List<Dt_Task>();
// 鑾峰彇璁㈠崟鏄庣粏
var outboundOrderDetail = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>()
- .FirstAsync(x => x.Id == orderDetailId );
+ .FirstAsync(x => x.Id == orderDetailId);
if (outboundOrderDetail == null)
{
throw new Exception("鏈壘鍒板嚭搴撳崟鏄庣粏淇℃伅");
}
- var outboundOrder = await _outboundOrderService.Db.Queryable<Dt_OutboundOrder>().FirstAsync(x => x.Id == outboundOrderDetail.OrderId);
- if(outboundOrder == null)
+ var outboundOrder = await _outboundOrderService.Db.Queryable<Dt_OutboundOrder>().FirstAsync(x => x.Id == outboundOrderDetail.OrderId);
+ if (outboundOrder == null)
{
throw new Exception("鏈壘鍒板嚭搴撳崟淇℃伅");
}
@@ -715,7 +791,7 @@
{
throw new Exception("鎵�閫夊嚭搴撳崟鏄庣粏瀛樺湪鍑哄簱涓垨宸插畬鎴�");
}
-
+
// 楠岃瘉鍒嗛厤鏁伴噺
decimal allocatedQty = outboundOrderDetail.AllocatedQuantity;
decimal overOutQty = outboundOrderDetail.OverOutQuantity;
@@ -744,7 +820,7 @@
{
// 鍒涘缓鍒嗘壒璁板綍
await CreateBatchRecord(outboundOrder.OrderNo, orderDetailId, batchQuantity, batchNo);
-
+
TaskTypeEnum typeEnum = outboundOrder.OrderType switch
{
(int)OutOrderTypeEnum.Issue => TaskTypeEnum.Outbound,
@@ -782,10 +858,10 @@
return (tasks, stockInfos, orderDetails, outStockLockInfos, locationInfos);
}
-
-
-
+
+
+
/// <summary>
/// 鏇存柊璁㈠崟鏄庣粏鐘舵��
/// </summary>
@@ -822,7 +898,7 @@
OrderNo = orderNo,
OrderDetailId = orderDetailId,
BatchQuantity = batchQuantity,
- BatchStatus = (int)BatchStatusEnum.鍒嗛厤涓�,
+ BatchStatus = (int)BatchStatusEnum.鍒嗛厤涓�,
Operator = App.User.UserName
};
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_WMSServer/Controllers/TaskInfo/TaskController.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_WMSServer/Controllers/TaskInfo/TaskController.cs"
index aed4552..6918098 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_WMSServer/Controllers/TaskInfo/TaskController.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_WMSServer/Controllers/TaskInfo/TaskController.cs"
@@ -83,9 +83,21 @@
/// <param name="stockSelectViews"></param>
/// <returns></returns>
[HttpPost, HttpGet, Route("GenerateOutboundTask"), AllowAnonymous]
- public WebResponseContent GenerateOutboundTask(int orderDetailId, [FromBody] List<StockSelectViewDTO> stockSelectViews)
+ public async Task<WebResponseContent> GenerateOutboundTask(int orderDetailId, [FromBody] List<StockSelectViewDTO> stockSelectViews)
{
- return Service.GenerateOutboundTask(orderDetailId, stockSelectViews);
+ return await Service.GenerateOutboundTask(orderDetailId, stockSelectViews);
+ }
+
+ /// <summary>
+ /// 鐢熸垚鍑哄簱浠诲姟
+ /// </summary>
+ /// <param name="orderDetailId"></param>
+ /// <param name="stockSelectViews"></param>
+ /// <returns></returns>
+ [HttpPost, HttpGet, Route("GenerateAllocatOutboundTask"), AllowAnonymous]
+ public async Task<WebResponseContent> GenerateAllocatOutboundTask(int orderDetailId, [FromBody] List<StockSelectViewDTO> stockSelectViews)
+ {
+ return await Service.GenerateAllocatOutboundTask(orderDetailId, stockSelectViews);
}
/// <summary>
--
Gitblit v1.9.3