From c95029139c278f0d2980e6d67cab42f5331e8d06 Mon Sep 17 00:00:00 2001
From: pan <antony1029@163.com>
Date: 星期五, 05 十二月 2025 08:35:04 +0800
Subject: [PATCH] 提交
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs | 50 +++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 39 insertions(+), 11 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_BasicService/InvokeMESService.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_BasicService/InvokeMESService.cs"
index 7d8276f..03077e3 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_BasicService/InvokeMESService.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_BasicService/InvokeMESService.cs"
@@ -26,6 +26,7 @@
using WIDESEA_IBasicService;
using WIDESEA_IOutboundService;
using WIDESEA_Model.Models;
+using WIDESEA_Model.Models.Outbound;
namespace WIDESEA_BasicService
{
@@ -45,13 +46,14 @@
private readonly IOutboundOrderService _outboundOrderService;
private readonly IOutboundOrderDetailService _outboundOrderDetailService;
private readonly IOutStockLockInfoService _outStockLockInfoService;
+ private readonly IRepository<Dt_InterfaceLog> _interfacelogRepository;
// 瀛樺偍璧勬簮ID鍙婂叾瀵瑰簲鐨勯攣瀵硅薄銆備娇鐢� ConcurrentDictionary 纭繚瀵瑰瓧鍏告搷浣滄湰韬殑绾跨▼瀹夊叏銆�
private static readonly ConcurrentDictionary<string, object> _resourceLocks = new ConcurrentDictionary<string, object>();
// 鍏ㄥ眬闈欐�侀攣锛氱敤浜庝繚鎶� _resourceLocks 瀛楀吀涓� GetOrAdd 鎴� TryRemove 鏃剁殑绔炰簤
private static readonly object _globalLocker = new object();
- public InvokeMESService(IHttpClientFactory httpClientFactory, ILogger<InvokeMESService> logger, IRepository<Dt_FeedbackToMes> feedbacktomesRepository, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IOutStockLockInfoService outStockLockInfoService, IMaterialUnitService materialUnitService, IRepository<Dt_PickingRecord> pickingRecoreRepository)
+ public InvokeMESService(IHttpClientFactory httpClientFactory, ILogger<InvokeMESService> logger, IRepository<Dt_FeedbackToMes> feedbacktomesRepository, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IOutStockLockInfoService outStockLockInfoService, IMaterialUnitService materialUnitService, IRepository<Dt_PickingRecord> pickingRecoreRepository, IRepository<Dt_InterfaceLog> interfacelogRepository)
{
_httpClientFactory = httpClientFactory;
_logger = logger;
@@ -64,6 +66,7 @@
_outStockLockInfoService = outStockLockInfoService;
_materialUnitService = materialUnitService;
_pickingRecoreRepository = pickingRecoreRepository;
+ _interfacelogRepository = interfacelogRepository;
}
/// <summary>
@@ -393,7 +396,7 @@
{
// 鎶㈤攣澶辫触锛氳鏄庢湁鍙︿竴涓嚎绋嬶紙WCS鍥炶皟鎴栦汉宸ユ搷浣滐級姝e湪澶勭悊
- return WebResponseContent.Instance.OK("WMS姝e湪澶勭悊姝ゅ洖浼犱换鍔★紝璇峰嬁閲嶅鎿嶄綔銆�");
+ return WebResponseContent.Instance.Error("WMS姝e湪澶勭悊姝ゅ洖浼犱换鍔★紝璇峰嬁閲嶅鎿嶄綔銆�");
}
return WebResponseContent.Instance.OK();
}
@@ -433,29 +436,49 @@
var groups = pickingRecords.GroupBy(x => x.FeedBackMesDocumentNo).ToList();
foreach (var group in groups)
{
-
+
List<Dt_PickingRecord> records = group.ToList(); // 璇ュ垎缁勪笅鐨勬墍鏈夎褰�
if (string.IsNullOrEmpty(group.Key))
{
var emptydocumentNo = UniqueValueGenerator.Generate();
records.ForEach(x => { x.FeedBackMesDocumentNo = emptydocumentNo; });
- var result= await _pickingRecoreRepository.Db.Insertable(records).ExecuteCommandAsync();
+ var result = await _pickingRecoreRepository.Db.Updateable(records).ExecuteCommandAsync();
+
+ var interfacelog = new Dt_InterfaceLog
+ {
+ Content = JsonConvert.SerializeObject(records),
+ DocumentNo = emptydocumentNo,
+ OrderNo = orderNo,
+ OrderType = "2",
+ };
+ _interfacelogRepository.AddData(interfacelog);
+
if (result > 0)
{
(bool _flowControl, WebResponseContent _value) = await FeedBackBatchToMes(outboundOrder, orderNo, orderDetails, pickingRecords, emptydocumentNo);
- if (!_flowControl)
- {
- return _value;
- }
+
+ return _value;
+
}
}
else
{
- (bool _flowControl, WebResponseContent _value) = await FeedBackBatchToMes(outboundOrder, orderNo, orderDetails, pickingRecords, group.Key);
- if (!_flowControl)
+ var ilog = _interfacelogRepository.QueryFirst(x => x.DocumentNo == group.Key);
+ if (ilog == null)
{
- return _value;
+ var interfacelog = new Dt_InterfaceLog
+ {
+ Content = JsonConvert.SerializeObject(records),
+ DocumentNo = group.Key,
+ OrderNo = orderNo,
+ OrderType = "2",
+ };
+ _interfacelogRepository.AddData(interfacelog);
}
+ (bool _flowControl, WebResponseContent _value) = await FeedBackBatchToMes(outboundOrder, orderNo, orderDetails, pickingRecords, group.Key);
+
+ return _value;
+
}
}
@@ -637,6 +660,11 @@
x.ReturnToMESStatus = 1;
});
await _pickingRecoreRepository.Db.Updateable(updates).ExecuteCommandAsync();
+ await _interfacelogRepository.Db.Updateable<Dt_InterfaceLog>()
+ .SetColumns(x => x.ReturnToMESStatus == 1)
+ .Where(x => x.OrderNo == orderNo)
+ .ExecuteCommandAsync();
+
if (allCompleted)
{
//MES鍥炰紶鎴愬姛锛氭洿鏂版槑缁嗕负鍥炰紶鎴愬姛鐘舵��
--
Gitblit v1.9.3