| | |
| | | { |
| | | public string? Type { get; set; } |
| | | public string Id { get; set; } |
| | | public string? FPARENTID { get; set; } |
| | | public string? FParentId { get; set; } |
| | | public string? FNumber { get; set; } |
| | | public string? FName { get; set; } |
| | | |
| | |
| | | LastupdateDate = DateTime.Now, |
| | | Company = "1000", |
| | | Factory = "1000", |
| | | DataType = customer.FDocumentStatus |
| | | DataType = customer.FDocumentStatus, |
| | | Type = customer.Type |
| | | }; |
| | | } |
| | | |
| | |
| | | |
| | | var insert = db.Insertable(entity).ExecuteCommand(); |
| | | |
| | | if (insert > 0) |
| | | return true; |
| | | |
| | | return false; |
| | | return insert > 0; |
| | | } |
| | | |
| | | private bool InsertOrUpdateBatch(SqlSugarScope db, |
| | | List<MesCustomer> customerList) |
| | | { |
| | | foreach (var entity in customerList) |
| | | if (!InsertOrUpdate(db, entity)) |
| | | return false; |
| | | |
| | | return true; |
| | | return customerList.All(entity => InsertOrUpdate(db, entity)); |
| | | } |
| | | } |
| | |
| | | // 删除仓库的方法 |
| | | private bool DeleteDepot(SqlSugarScope db, decimal depotId) |
| | | { |
| | | var deleteById = db.Deleteable<MesDepots>().In(depotId) |
| | | .ExecuteCommand(); |
| | | var deleteById = db.Deleteable<MesDepots>() |
| | | .Where(s => s.DepotId == depotId).ExecuteCommand(); |
| | | if (deleteById > 0) |
| | | return true; |
| | | |
| | |
| | | { |
| | | var ids = depotList.Select(it => it.DepotId).ToArray(); |
| | | var deleteByIds = |
| | | db.Deleteable<MesDepots>().In(ids).ExecuteCommand(); |
| | | db.Deleteable<MesDepots>() |
| | | .Where(s => ids.Contains(s.DepotId)).ExecuteCommand(); |
| | | if (deleteByIds > 0) |
| | | return true; |
| | | |
| | |
| | | private bool InsertOrUpdateBatch(SqlSugarScope db, |
| | | List<MesDepots> depotList) |
| | | { |
| | | foreach (var entity in depotList) |
| | | if (!InsertOrUpdate(db, entity)) |
| | | return false; |
| | | |
| | | return true; |
| | | return depotList.All(entity => InsertOrUpdate(db, entity)); |
| | | } |
| | | } |
| | |
| | | return new MesItemType |
| | | { |
| | | Id = Convert.ToDecimal(department.Id), |
| | | Pgroup = department.FPARENTID, |
| | | Pgroup = department.FParentId, |
| | | Tcode = department.FNumber, |
| | | Tname = department.FName, |
| | | Description = department.FDescription, |
| | |
| | | |
| | | private bool InsertOrUpdateBatch(SqlSugarScope db, List<MesItems> itemList) |
| | | { |
| | | foreach (var entity in itemList) |
| | | if (!InsertOrUpdate(db, entity)) |
| | | return false; |
| | | |
| | | return true; |
| | | return itemList.All(entity => InsertOrUpdate(db, entity)); |
| | | } |
| | | } |
| | |
| | | List<MesSupplier> supplierList) |
| | | { |
| | | var ids = supplierList.Select(it => it.Id).ToArray(); |
| | | var deleteByIds = db.Deleteable<MesSupplier>().In(ids).ExecuteCommand(); |
| | | var deleteByIds = db.Deleteable<MesSupplier>() |
| | | .Where(s=>ids.Contains(s.Id)).ExecuteCommand(); |
| | | if (deleteByIds > 0) |
| | | return true; |
| | | |
| | |
| | | private bool InsertOrUpdateBatch(SqlSugarScope db, |
| | | List<MesSupplier> supplierList) |
| | | { |
| | | foreach (var entity in supplierList) |
| | | if (!InsertOrUpdate(db, entity)) |
| | | return false; |
| | | |
| | | return true; |
| | | return supplierList.All(entity => InsertOrUpdate(db, entity)); |
| | | } |
| | | } |
| | |
| | | |
| | | private bool DeleteUnit(SqlSugarScope db, decimal unitId) |
| | | { |
| | | var deleteById = db.Deleteable<MesUnit>().In(unitId).ExecuteCommand(); |
| | | var deleteById = db.Deleteable<MesUnit>() |
| | | .Where(s => s.Id == unitId).ExecuteCommand(); |
| | | if (deleteById > 0) |
| | | return true; |
| | | |
| | |
| | | CreateDate = DateTime.Now, |
| | | LastupdateDate = DateTime.Now, |
| | | Company = "1000", |
| | | Factory = "1000" |
| | | Factory = "1000", |
| | | Type = unit.Type |
| | | }; |
| | | } |
| | | |
| | |
| | | private bool DeleteUnitBatch(SqlSugarScope db, List<MesUnit> unitList) |
| | | { |
| | | var ids = unitList.Select(it => it.Id).ToArray(); |
| | | var deleteByIds = db.Deleteable<MesUnit>().In(ids).ExecuteCommand(); |
| | | var deleteByIds = db.Deleteable<MesUnit>() |
| | | .Where(s => ids.Contains(s.Id)).ExecuteCommand(); |
| | | return deleteByIds > 0; |
| | | } |
| | | |
| | | private bool InsertOrUpdate(SqlSugarScope db, MesUnit entity) |
| | | { |
| | | var exists = db.Queryable<MesUnit>().Any(e => e.Id == entity.Id); |
| | | 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<MesUnit>() |
| | | .Where(s => s.Id == entity.Id).ExecuteCommand(); |
| | | var insert = db.Insertable(entity).ExecuteCommand(); |
| | | return insert > 0; |
| | | } |
| | | |
| | | private bool InsertOrUpdateBatch(SqlSugarScope db, List<MesUnit> unitList) |
| | | { |
| | | foreach (var entity in unitList) |
| | | if (!InsertOrUpdate(db, entity)) |
| | | return false; |
| | | |
| | | return true; |
| | | return unitList.All(entity => InsertOrUpdate(db, entity)); |
| | | } |
| | | } |
| | |
| | | private bool InsertOrUpdateBatch(SqlSugarScope db, |
| | | List<SysOrganization> itemList) |
| | | { |
| | | foreach (var entity in itemList) |
| | | if (!InsertOrUpdate(db, entity)) |
| | | return false; |
| | | |
| | | return true; |
| | | return itemList.All(entity => InsertOrUpdate(db, entity)); |
| | | } |
| | | } |
| | |
| | | private bool InsertOrUpdateDepartmentBatch(SqlSugarScope db, |
| | | List<SysDepartment> departmentList) |
| | | { |
| | | foreach (var entity in departmentList) |
| | | if (!InsertOrUpdateDepartment(db, entity)) |
| | | return false; |
| | | |
| | | return true; |
| | | return departmentList.All( |
| | | entity => InsertOrUpdateDepartment(db, entity)); |
| | | } |
| | | } |