| | |
| | | if (UpdateSupplierStatus(db, entity.Id, "B")) |
| | | return 1; |
| | | break; |
| | | case "2": |
| | | if (InsertSupplier(db, entity)) |
| | | return 1; |
| | | break; |
| | | case "3": |
| | | if (DeleteSupplier(entity.Id)) |
| | | return 1; |
| | | break; |
| | | case "2": |
| | | case "4": |
| | | if (InsertOrUpdate(db, entity)) |
| | | return 1; |
| | |
| | | "B")) |
| | | throw new NotImplementedException("禁用失败"); |
| | | break; |
| | | case "2": |
| | | if (!InsertSupplierBatch(db, supplierGroup.Value)) |
| | | throw new NotImplementedException("插入失败"); |
| | | break; |
| | | case "3": |
| | | if (!DeleteSupplierBatch(db, supplierGroup.Value)) |
| | | throw new NotImplementedException("删除失败"); |
| | | break; |
| | | case "2": |
| | | case "4": |
| | | if (!InsertOrUpdateBatch(db, supplierGroup.Value)) |
| | | throw new NotImplementedException("同步失败"); |
| | |
| | | |
| | | private bool DeleteSupplier(decimal supplierId) |
| | | { |
| | | if (base.DeleteById(supplierId)) return true; |
| | | var deleteById = Db.Deleteable<MesSupplier>() |
| | | .Where(s => s.Id == supplierId).ExecuteCommand(); |
| | | if (deleteById > 0) |
| | | return true; |
| | | |
| | | throw new NotImplementedException("删除失败"); |
| | | } |
| | |
| | | SuppNo = supplier.FNumber, |
| | | SuppSname = supplier.FShortName, |
| | | SuppName = supplier.FName, |
| | | Lxr = supplier.FContact, |
| | | Telf1 = supplier.FTel, |
| | | Lxr = supplier.FTContact, |
| | | Telf1 = supplier.Fmobilephone, |
| | | Fstaffid = supplier.FStaffId, |
| | | Fforbidstatus = supplier.FForbidStatus, |
| | | Type = supplier.Type, |
| | | Remark = supplier.FDescription, |
| | | FSubsidiary = supplier.FUseOrgId, |
| | | Fumbrella = supplier.FCreateOrgId, |
| | | CreateDate = DateTime.Now, |
| | |
| | | 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)); |
| | | } |
| | | } |