From f5eb41629045613692873e4738a9503fdf1d7818 Mon Sep 17 00:00:00 2001
From: z8018 <1282578289@qq.com>
Date: 星期一, 22 十二月 2025 18:45:15 +0800
Subject: [PATCH] 1
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 96 +++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 86 insertions(+), 10 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.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 a059c25..107197e 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"
@@ -718,6 +718,9 @@
{
return content.Error("鏈壘鍒板叆鏅轰粨鐨勭墿鏂欎俊鎭�");
}
+
+ string Operator = allocateMaterialInfos.FirstOrDefault().Creater;
+
_unitOfWorkManage.BeginTran();
var alldelete = _allocateMaterialInfo.DeleteAndMoveIntoHty(allocateMaterialInfos ,OperateTypeEnum.鑷姩鍒犻櫎);
if (!alldelete)
@@ -744,19 +747,21 @@
}
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())
+ ///鍥炶皟MES
+ 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>();
+ 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);
+ AllocationReturnDTO? returnDTO = BuildAllocationFeedbackData(outboundOrder, allocateOrder.FromWarehouse, allocateOrder.ToWarehouse, Operator);
if (returnDTO == null)
{
return WebResponseContent.Instance.Error($"鏋勫缓鍥炶皟瀵硅薄澶辫触");
@@ -773,6 +778,72 @@
httpResponseResult = _httpClientHelper.Post<MesResponseDTO>(apiUrl, requestData);
httpResponseResult.ApiUrl = apiUrl;
}
+ bool isSuccess = httpResponseResult.IsSuccess && httpResponseResult.Data.Code == "200";
+ string message = "鎴愬姛";
+ if (!isSuccess)
+ {
+ if (!httpResponseResult.IsSuccess)
+ {
+ message = $"MES鎺ュ彛杩斿洖閿欒锛孒TTP浠g爜锛歿httpResponseResult.StatusCode}锛屼俊鎭細{httpResponseResult.ErrorMessage}";
+ }
+ else if (httpResponseResult?.Data?.Code != "200")
+ {
+ message = $"璋冪敤MES鎺ュ彛澶辫触锛屼唬鐮侊細{httpResponseResult?.Data?.Code}锛屼俊鎭細{httpResponseResult?.Data?.Message}";
+ }
+ }
+
+ Dt_MesReturnRecord mesReturnRecord = new Dt_MesReturnRecord()
+ {
+ ApiUrl = httpResponseResult.ApiUrl,
+ InterfaceType = outboundOrder.OrderType == 0 ? 1 : 3,
+ OrderId = outboundOrder.Id,
+ OrderNo = outboundOrder.OrderNo,
+ RequestCode = reqCode,
+ RequestData = requestData,
+ FailureReason = message,
+ LastReturnTime = DateTime.Now,
+ HttpStatusCode = httpResponseResult.StatusCode.ObjToInt(),
+ ResponseData = httpResponseResult.Content,
+ ReturnType = 0,
+ ReturnCount = 1,
+ ReturnStatus = isSuccess ? 1 : 2,
+ SuccessTime = isSuccess ? DateTime.Now : null
+ };
+
+ _unitOfWorkManage.BeginTran();
+ _unitOfWorkManage.Db.Insertable(mesReturnRecord).ExecuteCommand();
+
+ List<Dt_OutboundOrderDetail> outboundOrderDetails = outboundOrder.Details.Where(x => lineNos.Contains(x.lineNo)).ToList();
+ outboundOrderDetails.ForEach(x =>
+ {
+ if (x.OverOutQuantity == x.OrderQuantity - x.MoveQty)
+ {
+ x.ReturnToMESStatus = isSuccess ? 1 : 2;
+ }
+ else
+ {
+ x.ReturnToMESStatus = isSuccess ? 3 : 4;
+ }
+ x.CurrentDeliveryQty = 0;
+ x.ReturnJsonData = "";
+ });
+
+ mesReturnRecord.ReturnType = outboundOrder.Details.Count == outboundOrderDetails.Count ? 1 : 2;
+
+ if (outboundOrder.Details.Count == outboundOrderDetails.Count && outboundOrderDetails.All(x => x.ReturnToMESStatus == 1 || x.ReturnToMESStatus == 2))
+ {
+ outboundOrder.ReturnToMESStatus = isSuccess ? 1 : 2;
+ }
+ else
+ {
+ outboundOrder.ReturnToMESStatus = isSuccess ? 3 : 4;
+ }
+
+ _outboundOrderService.Db.Updateable(outboundOrderDetails).ExecuteCommand();
+ _outboundOrderService.UpdateData(outboundOrder);
+
+ _unitOfWorkManage.CommitTran();
+
try
{
_locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforelocationStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum);
@@ -790,7 +861,7 @@
}
}
- public AllocationReturnDTO? BuildAllocationFeedbackData(Dt_OutboundOrder outboundOrder, string fromWarehouse, string toWarehouse)
+ public AllocationReturnDTO? BuildAllocationFeedbackData(Dt_OutboundOrder outboundOrder, string fromWarehouse, string toWarehouse,string Operator)
{
try
{
@@ -825,10 +896,10 @@
Details = returnDetails,
FactoryArea = outboundOrder.FactoryArea,
OperationType = 1,
- OrderNo = outboundOrder.OrderNo,
+ OrderNo = outboundOrder.UpperOrderNo,
FromWarehouse = fromWarehouse,
ToWarehouse = toWarehouse,
- Operator = App.User.UserName
+ Operator = Operator
};
return outboundReturnDTO;
@@ -1773,5 +1844,10 @@
}
}
+ public Task<WebResponseContent> HandCompleteTask(string TaskNum)
+ {
+ return TaskCompleted(TaskNum);
+ }
+
}
}
--
Gitblit v1.9.3