From 4efe898c5092ced94283dc99587405b1d101850b Mon Sep 17 00:00:00 2001 From: cjy Date: Thu, 5 Sep 2024 11:21:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E8=B4=A7=E7=89=A9=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Op/Method/SeaExportCommonService.cs | 50 ++++++++----------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs index 50eae99a..90ac8c6d 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs @@ -875,36 +875,31 @@ namespace DS.WMS.Core.Op.Method /// /// /// - public async Task SetGoodsStatus(string code, long bookingId,SqlSugarScopeProvider tenantDb) + public async Task SetGoodsStatus(string code, long bookingId, SqlSugarScopeProvider tenantDb) { - //var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var CreatedUserId = tenantDb.Queryable().Filter(null, true).Where(x => x.Id == bookingId).Select(x => x.CreateBy).First(); - if (CreatedUserId != null) + var gsCfg = tenantDb.Queryable().First(x => x.SystemCode == code); + if (gsCfg != null) { - var gsCfg = tenantDb.Queryable().First(x => x.SystemCode == code && x.CreateBy == (long)CreatedUserId); - if (gsCfg != null) + _logger.Info($"检查{code}货物状态:{bookingId}"); + var gs = tenantDb.Queryable().First(x => x.ConfigId == gsCfg.Id && x.BusinessId == bookingId); + if (gs == null) { - _logger.Info($"检查{code}货物状态:{bookingId}"); - var gs = tenantDb.Queryable().First(x => x.ConfigId == gsCfg.Id && x.BusinessId == bookingId); - if (gs == null) + gs = new BookingGoodsStatus() { - gs = new BookingGoodsStatus() - { - BusinessId = bookingId, - ConfigId = gsCfg.Id, - FinishTime = DateTime.Now, - FinishUserName = user.UserId.IsNull() ? "超级管理员" : user.UserName, - FinishBy = user.UserId.IsNull() ? 0 : long.Parse(user.UserId), - StatusCode = gsCfg.SystemCode, - StatusName = gsCfg.StatusName, - }; - await tenantDb.Insertable(gs).ExecuteCommandAsync(); - _logger.Info($"发送{code}后自动完成货物状态,Id:{bookingId}"); - //更新货物状态 - await SetBookingOrderGoodsStatus(bookingId, tenantDb); - } + BusinessId = bookingId, + ConfigId = gsCfg.Id, + FinishTime = DateTime.Now, + FinishUserName = user.UserId.IsNull() ? "超级管理员" : user.UserName, + FinishBy = user.UserId.IsNull() ? 0 : long.Parse(user.UserId), + StatusCode = gsCfg.SystemCode, + StatusName = gsCfg.StatusName, + }; + await tenantDb.Insertable(gs).ExecuteCommandAsync(); + _logger.Info($"发送{code}后自动完成货物状态,Id:{bookingId}"); + //更新货物状态 + await SetBookingOrderGoodsStatus(bookingId, tenantDb); } - } + } } /// @@ -916,11 +911,10 @@ namespace DS.WMS.Core.Op.Method { //var tenantDb = saasService.GetBizDbScopeById(user.TenantId); var order = tenantDb.Queryable().Filter(null, true).First(x => x.Id == bookingId); - - var createUserid = order.CreateBy; + //获取当前用户已经录入的货物状态 var list = await tenantDb.Queryable().LeftJoin(tenantDb.Queryable(), - (goods, config) => config.Id == goods.ConfigId).Where((goods, config) => config.CreateBy == createUserid && goods.BusinessId == bookingId). + (goods, config) => config.Id == goods.ConfigId).Where((goods, config) => goods.BusinessId == bookingId). OrderBy((goods, config) => config.OrderNo). Select((goods, config) => new {