From a2f8c1434ba06a5231c4f9f8bc9373402f4228f7 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期四, 27 三月 2025 20:38:56 +0800 Subject: [PATCH] 优化数据库事务处理及收货单功能 --- Tiger.Business.WMS/Common/WmsTask.cs | 69 ++++++++++++++++++++++++++++++---- 1 files changed, 61 insertions(+), 8 deletions(-) diff --git a/Tiger.Business.WMS/Common/WmsTask.cs b/Tiger.Business.WMS/Common/WmsTask.cs index 8ef5ce0..6a0045c 100644 --- a/Tiger.Business.WMS/Common/WmsTask.cs +++ b/Tiger.Business.WMS/Common/WmsTask.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Tiger.IBusiness; using Tiger.Model; +using Tiger.Model.Entitys.MES.Position; namespace Tiger.Business.WMS.Transaction { @@ -114,13 +115,10 @@ action.Invoke(); } } - }); - if (dbTran.IsSuccess) - { - //淇濆瓨鎴愬姛鍒欐竻绌烘彁浜ゆ搷浣滃垪琛� - DBCommitList.Clear(); - } - else + }); + //淇濆瓨鎴愬姛鍒欐竻绌烘彁浜ゆ搷浣滃垪琛� + DBCommitList.Clear(); + if (!dbTran.IsSuccess) { //鎶涘嚭寮傚父 throw dbTran.ErrorException; @@ -144,7 +142,7 @@ var location = Biz.Db.Queryable<V_WH_UNIT>().Where(q => q.LOCATION_CODE == targetLocation && q.AUTH_ORG == option.CurOrg).IncludesAllFirstLayer().First(); if (!location.IsNullOrEmpty()) { - var isTransfer = CurInvItem.Location?.LOCATION_CODE != location.LOCATION_CODE; + var isTransfer = CurInvItem?.Location?.LOCATION_CODE != location.LOCATION_CODE; foreach (var item in CurInvItem.Items) { item.STATUS = WMS_ITEM.STATUSs.InStore.GetValue(); @@ -288,6 +286,61 @@ return result; } + /// <summary> + /// 璁剧疆褰撳墠鏉$爜鐨勫伐搴忎俊鎭� + /// </summary> + public ApiAction<ScanOutput> SetOutPutMqttMsg(ApiAction<ScanOutput> action, string locale = null) + { + MQTT.Message msg = new() + { + IsSuccessed = action.IsSuccessed, + Content = Biz.T(action.LocaleMsg, locale), + }; + switch (action.Status) + { + case ApiAction.StatusCodes.Success: + msg.Voice = MQTT.Voice.Success; + msg.Color = "#FF1E90FF"; + break; + case ApiAction.StatusCodes.Warning: + msg.Voice = MQTT.Voice.Warning; + msg.Color = "#FFB8860B"; + break; + case ApiAction.StatusCodes.Error: + case ApiAction.StatusCodes.Failed: + msg.Voice = MQTT.Voice.Fail; + msg.Color = "#FFFF0000"; + break; + case ApiAction.StatusCodes.Exception: + msg.Voice = MQTT.Voice.Fail; + msg.Color = "#FF8B0000"; + break; + case ApiAction.StatusCodes.Normal: + case ApiAction.StatusCodes.NeedConfrim: + case ApiAction.StatusCodes.Confrimed: + default: + msg.Voice = MQTT.Voice.Silent; + msg.Color = "#FF000000"; + break; + } + if (action.IsSuccessed) + { + msg.Voice = MQTT.Voice.Pass; + msg.Color = "#FF228B22"; + } + else if (!action.IsSuccessed) + { + msg.Voice = MQTT.Voice.Fail; + msg.Color = "#FFFF0000"; + } + else + { + msg.Voice = MQTT.Voice.Silent; + msg.Color = "#FF000000"; + } + action.Data.MqttMsg = msg; + return action; + } #endregion Functions public override bool Close(bool needSaveHistoryLog = false) -- Gitblit v1.9.3