|
|
|
@ -875,36 +875,31 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
/// <param name="code"></param>
|
|
|
|
|
/// <param name="bookingId"></param>
|
|
|
|
|
/// <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 CreatedUserId = tenantDb.Queryable<SeaExport>().Filter(null, true).Where(x => x.Id == bookingId).Select(x => x.CreateBy).First();
|
|
|
|
|
if (CreatedUserId != null)
|
|
|
|
|
var gsCfg = tenantDb.Queryable<BookingGoodsStatusConfig>().First(x => x.SystemCode == code);
|
|
|
|
|
if (gsCfg != null)
|
|
|
|
|
{
|
|
|
|
|
var gsCfg = tenantDb.Queryable<BookingGoodsStatusConfig>().First(x => x.SystemCode == code && x.CreateBy == (long)CreatedUserId);
|
|
|
|
|
if (gsCfg != null)
|
|
|
|
|
_logger.Info($"检查{code}货物状态:{bookingId}");
|
|
|
|
|
var gs = tenantDb.Queryable<BookingGoodsStatus>().First(x => x.ConfigId == gsCfg.Id && x.BusinessId == bookingId);
|
|
|
|
|
if (gs == null)
|
|
|
|
|
{
|
|
|
|
|
_logger.Info($"检查{code}货物状态:{bookingId}");
|
|
|
|
|
var gs = tenantDb.Queryable<BookingGoodsStatus>().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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -916,11 +911,10 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
{
|
|
|
|
|
//var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
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>(),
|
|
|
|
|
(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
|
|
|
|
|
{
|
|
|
|
|