| | |
| | | // 插入新仓库的方法 |
| | | private bool InsertDepot(SqlSugarScope db, MesDepots entity) |
| | | { |
| | | var exists = db.Queryable<MesDepots>().Any(e => e.DepotId == entity.DepotId); |
| | | var exists = db.Queryable<MesDepots>().Any(e => e.DepotId == entity.DepotId && e.DepotCode == entity.DepotCode); |
| | | if (exists) |
| | | { |
| | | var result = db.Updateable(entity).ExecuteCommand(); |
| | | var result = db.Updateable(entity).Where(e => e.DepotId == entity.DepotId && e.DepotCode == entity.DepotCode).ExecuteCommand(); |
| | | return true; |
| | | } |
| | | else |
| | |
| | | // 插入或更新仓库的方法 |
| | | private bool InsertOrUpdate(SqlSugarScope db, MesDepots entity) |
| | | { |
| | | var exists = db.Queryable<MesDepots>().Any(e => e.DepotId == entity.DepotId); |
| | | var exists = db.Queryable<MesDepots>().Any(e => e.DepotId == entity.DepotId && e.DepotCode == entity.DepotCode); |
| | | if (exists) |
| | | { |
| | | var update = db.Updateable(entity).ExecuteCommand(); |
| | | var update = db.Updateable(entity).Where(e => e.DepotId == entity.DepotId && e.DepotCode == entity.DepotCode).ExecuteCommand(); |
| | | return true; |
| | | } |
| | | else |