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 {