| | |
| | | using Castle.Core.Resource; |
| | | using MES.Service.DB; |
| | | using MES.Service.DB; |
| | | using MES.Service.Dto.webApi; |
| | | using MES.Service.Modes; |
| | | using SqlSugar; |
| | |
| | | // 插入或更新仓库的方法 |
| | | private bool InsertOrUpdate(SqlSugarScope db, MesDepots entity) |
| | | { |
| | | var exists = db.Queryable<MesDepots>() |
| | | .Any(e => e.DepotId == entity.DepotId); |
| | | if (exists) |
| | | { |
| | | var update = db.Updateable(entity).ExecuteCommand(); |
| | | if (update > 0) |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | var insert = db.Insertable(entity).ExecuteCommand(); |
| | | if (insert > 0) |
| | | return true; |
| | | } |
| | | |
| | | return false; |
| | | db.Deleteable<MesDepots>() |
| | | .Where(s => s.DepotId == entity.DepotId) |
| | | .ExecuteCommand(); |
| | | var insert = db.Insertable(entity).ExecuteCommand(); |
| | | return insert > 0; |
| | | } |
| | | |
| | | // 将 ErpDepots 对象转换为 MesDepots 对象的方法 |
| | |
| | | Zuid = depots.FGroup, |
| | | FSubsidiary = depots.FUseOrgId, |
| | | Fumbrella = depots.FCreateOrgId, |
| | | |
| | | CreateDate = DateTime.Now, |
| | | LastupdateDate = DateTime.Now, |
| | | Company = "1000", |