From d9ec03b2322334f4ade52b3e9ec69517e2ddf314 Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期四, 18 十二月 2025 20:19:01 +0800
Subject: [PATCH] 1
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs | 1
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 81 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 80 insertions(+), 2 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_OutboundService/OutboundService.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_OutboundService/OutboundService.cs"
index b49a2ad..4d48189 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_OutboundService/OutboundService.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_OutboundService/OutboundService.cs"
@@ -1486,7 +1486,6 @@
{
UpdateOutboundOrderStatus(request.OrderNo, OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt());
-
//todo: 鍥炰紶MES
}
}
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 922cf88..61ec000 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"
@@ -43,6 +43,7 @@
using WIDESEA_Core.Helper;
using WIDESEA_Core.Util;
using WIDESEA_DTO.Allocate;
+using WIDESEA_DTO.Base;
using WIDESEA_DTO.Basic;
using WIDESEA_DTO.Inbound;
using WIDESEA_DTO.Outbound;
@@ -91,6 +92,7 @@
private readonly IRepository<Dt_AllocateMaterialInfo> _allocateMaterialInfo;
private readonly IRepository<Dt_AllocateMaterialInfo_Hty> _allocateMaterialInfo_Hty;
private readonly HttpClientHelper _httpClientHelper;
+ private readonly IBasicService _basicService;
public IRepository<Dt_Task> Repository => BaseDal;
private Dictionary<string, SqlSugar.OrderByType> _taskOrderBy = new()
@@ -110,7 +112,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, IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IMaterialUnitService materialUnitService, ITask_HtyService task_HtyService, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, IRepository<Dt_AllocateMaterialInfo_Hty> allocateMaterialInfo_Hty, HttpClientHelper httpClientHelper) : 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, IMaterialUnitService materialUnitService, ITask_HtyService task_HtyService, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, IRepository<Dt_AllocateMaterialInfo_Hty> allocateMaterialInfo_Hty, HttpClientHelper httpClientHelper, IBasicService basicService) : base(BaseDal)
{
_mapper = mapper;
_unitOfWorkManage = unitOfWorkManage;
@@ -137,6 +139,7 @@
_allocateMaterialInfo = allocateMaterialInfo;
_allocateMaterialInfo_Hty = allocateMaterialInfo_Hty;
_httpClientHelper = httpClientHelper;
+ _basicService = basicService;
}
public async Task TaskStatusChange(string taskNum, TaskStatusEnum taskStatusEnum)
@@ -738,6 +741,33 @@
{
await Db.Deleteable(task).ExecuteCommandAsync();
}
+ Dt_OutboundOrder outboundOrder = _outboundOrderService.Db.Queryable<Dt_OutboundOrder>().Where(x => x.OrderNo == stockInfo.Details.FirstOrDefault().OrderNo).Includes(x=>x.Details).First();
+
+ if(outboundOrder.OrderStatus == OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt())
+ {
+ HttpResponseResult<MesResponseDTO> httpResponseResult = new HttpResponseResult<MesResponseDTO>();
+ string reqCode = Guid.NewGuid().ToString();
+ string reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ string requestData = string.Empty;
+ List<string> lineNos = new List<string>();
+ Dt_AllocateOrder allocateOrder = _allocateOrderRepository.QueryFirst(x => x.OrderNo == outboundOrder.OrderNo);
+ if (allocateOrder == null)
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒板搴旂殑璋冩嫧鍗�");
+ }
+ AllocationReturnDTO? returnDTO = BuildAllocationFeedbackData(outboundOrder, allocateOrder.FromWarehouse, allocateOrder.ToWarehouse);
+ if (returnDTO == null)
+ {
+ return WebResponseContent.Instance.Error($"鏋勫缓鍥炶皟瀵硅薄澶辫触");
+ }
+ string apiUrl = AppSettings.GetValue("AllocationFeedbackUrl"); ;
+ returnDTO.ReqCode = reqCode;
+ returnDTO.ReqTime = reqTime;
+ requestData = returnDTO.Serialize();
+ lineNos = returnDTO.Details.Select(x => x.LineNo).ToList();
+ httpResponseResult = _httpClientHelper.Post<MesResponseDTO>(apiUrl, requestData);
+ httpResponseResult.ApiUrl = apiUrl;
+ }
try
{
_locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforelocationStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum);
@@ -755,6 +785,55 @@
}
}
+ public AllocationReturnDTO? BuildAllocationFeedbackData(Dt_OutboundOrder outboundOrder, string fromWarehouse, string toWarehouse)
+ {
+ try
+ {
+ List<Dt_OutboundOrderDetail> details = outboundOrder.Details;
+
+ List<AllocationDetail> returnDetails = new List<AllocationDetail>();
+
+ foreach (var detail in details)
+ {
+ List<Barcodes>? barcodes = JsonConvert.DeserializeObject<List<Barcodes>>(detail.ReturnJsonData);
+ if (barcodes != null && barcodes.Any())
+ {
+ UnitConvertResultDTO currentResult = _basicService.UnitQuantityConvert(detail.MaterielCode, detail.Unit, detail.BarcodeUnit, detail.CurrentDeliveryQty);
+ UnitConvertResultDTO totalResult = _basicService.UnitQuantityConvert(detail.MaterielCode, detail.Unit, detail.BarcodeUnit, detail.OrderQuantity);
+
+ returnDetails.Add(new AllocationDetail
+ {
+ Barcodes = barcodes,
+ BatchNo = detail.BatchNo,
+ LineNo = detail.lineNo,
+ MaterialCode = detail.MaterielCode,
+ Qty = totalResult.ToQuantity,
+ WarehouseCode = detail.WarehouseCode,
+ Unit = detail.BarcodeUnit
+ });
+ }
+ }
+
+ AllocationReturnDTO outboundReturnDTO = new AllocationReturnDTO()
+ {
+ Business_type = outboundOrder.BusinessType,
+ Details = returnDetails,
+ FactoryArea = outboundOrder.FactoryArea,
+ OperationType = 1,
+ OrderNo = outboundOrder.OrderNo,
+ FromWarehouse = fromWarehouse,
+ ToWarehouse = toWarehouse
+ };
+
+ return outboundReturnDTO;
+
+ }
+ catch (Exception ex)
+ {
+ return null;
+ }
+ }
+
public async Task<WebResponseContent> InPickTaskCompleted(Dt_Task task)
{
--
Gitblit v1.9.3