事务处理

master
1 year ago
parent a604957a64
commit 9169a8b4c5

@ -749,8 +749,14 @@ namespace Khd.Core.Wcs.Wcs
} }
} }
catch (Exception ex) catch (Exception ex)
{
try
{ {
transaction.Rollback(); transaction.Rollback();
}
catch
{
}
if (ex is PlcException) if (ex is PlcException)
{ {

@ -467,8 +467,15 @@ namespace Khd.Core.Wcs.Wcs
dbContextTransaction.Commit(); dbContextTransaction.Commit();
} }
catch (Exception ex) catch (Exception ex)
{
try
{ {
dbContextTransaction.Rollback(); dbContextTransaction.Rollback();
}
catch
{
}
_logger.Error(ex.Message + "\n" + ex.StackTrace); _logger.Error(ex.Message + "\n" + ex.StackTrace);
} }
} }

@ -768,8 +768,15 @@ namespace Khd.Core.Wcs.Wcs
_logger.Info("二楼AGV线程完成任务" + item.objid); _logger.Info("二楼AGV线程完成任务" + item.objid);
} }
catch (Exception ex) catch (Exception ex)
{
try
{ {
transaction.Rollback(); transaction.Rollback();
}
catch
{
}
_logger.Error(ex.Message + "\n" + ex.StackTrace); _logger.Error(ex.Message + "\n" + ex.StackTrace);
} }
} }

@ -603,8 +603,15 @@ namespace Khd.Core.Wcs.Wcs
transaction.Commit(); transaction.Commit();
} }
catch (Exception ex) catch (Exception ex)
{
try
{ {
transaction.Rollback(); transaction.Rollback();
}
catch
{
}
_logger.Error(ex.Message + "\n" + ex.StackTrace); _logger.Error(ex.Message + "\n" + ex.StackTrace);
} }
} }

Loading…
Cancel
Save