设置货物状态修改

usertest
cjy 3 months ago
parent 029a64e18e
commit 4efe898c50

@ -875,36 +875,31 @@ namespace DS.WMS.Core.Op.Method
/// <param name="code"></param> /// <param name="code"></param>
/// <param name="bookingId"></param> /// <param name="bookingId"></param>
/// <returns></returns> /// <returns></returns>
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 gsCfg = tenantDb.Queryable<BookingGoodsStatusConfig>().First(x => x.SystemCode == code);
var CreatedUserId = tenantDb.Queryable<SeaExport>().Filter(null, true).Where(x => x.Id == bookingId).Select(x => x.CreateBy).First(); if (gsCfg != null)
if (CreatedUserId != null)
{ {
var gsCfg = tenantDb.Queryable<BookingGoodsStatusConfig>().First(x => x.SystemCode == code && x.CreateBy == (long)CreatedUserId); _logger.Info($"检查{code}货物状态:{bookingId}");
if (gsCfg != null) var gs = tenantDb.Queryable<BookingGoodsStatus>().First(x => x.ConfigId == gsCfg.Id && x.BusinessId == bookingId);
if (gs == null)
{ {
_logger.Info($"检查{code}货物状态:{bookingId}"); gs = new BookingGoodsStatus()
var gs = tenantDb.Queryable<BookingGoodsStatus>().First(x => x.ConfigId == gsCfg.Id && x.BusinessId == bookingId);
if (gs == null)
{ {
gs = new BookingGoodsStatus() BusinessId = bookingId,
{ ConfigId = gsCfg.Id,
BusinessId = bookingId, FinishTime = DateTime.Now,
ConfigId = gsCfg.Id, FinishUserName = user.UserId.IsNull() ? "超级管理员" : user.UserName,
FinishTime = DateTime.Now, FinishBy = user.UserId.IsNull() ? 0 : long.Parse(user.UserId),
FinishUserName = user.UserId.IsNull() ? "超级管理员" : user.UserName, StatusCode = gsCfg.SystemCode,
FinishBy = user.UserId.IsNull() ? 0 : long.Parse(user.UserId), StatusName = gsCfg.StatusName,
StatusCode = gsCfg.SystemCode, };
StatusName = gsCfg.StatusName, await tenantDb.Insertable(gs).ExecuteCommandAsync();
}; _logger.Info($"发送{code}后自动完成货物状态,Id{bookingId}");
await tenantDb.Insertable(gs).ExecuteCommandAsync(); //更新货物状态
_logger.Info($"发送{code}后自动完成货物状态,Id{bookingId}"); await SetBookingOrderGoodsStatus(bookingId, tenantDb);
//更新货物状态
await SetBookingOrderGoodsStatus(bookingId, tenantDb);
}
} }
} }
} }
/// <summary> /// <summary>
@ -916,11 +911,10 @@ namespace DS.WMS.Core.Op.Method
{ {
//var tenantDb = saasService.GetBizDbScopeById(user.TenantId); //var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var order = tenantDb.Queryable<SeaExport>().Filter(null, true).First(x => x.Id == bookingId); var order = tenantDb.Queryable<SeaExport>().Filter(null, true).First(x => x.Id == bookingId);
var createUserid = order.CreateBy;
//获取当前用户已经录入的货物状态 //获取当前用户已经录入的货物状态
var list = await tenantDb.Queryable<BookingGoodsStatus>().LeftJoin(tenantDb.Queryable<BookingGoodsStatusConfig>(), var list = await tenantDb.Queryable<BookingGoodsStatus>().LeftJoin(tenantDb.Queryable<BookingGoodsStatusConfig>(),
(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). OrderBy((goods, config) => config.OrderNo).
Select((goods, config) => new Select((goods, config) => new
{ {

Loading…
Cancel
Save