啊鑫
2024-10-30 c02ff3f682398f022488f98b87a79d4a8e04b5dd
MES.Service/service/BasicData/MesDepotsManager.cs
@@ -23,14 +23,11 @@
                    if (UpdateDepotStatus(db, entity.DepotId, "B")) return 1;
                    break;
                case "2":
                    if (InsertDepot(db, entity)) return 1;
                    break;
                case "3":
                    if (DeleteDepot(db, entity.DepotId)) return 1;
                    break;
                case "2":
                case "4":
                    if (InsertOrUpdate(db, entity)) return 1;
@@ -71,8 +68,8 @@
    // 删除仓库的方法
    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;
@@ -195,7 +192,8 @@
    {
        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;
@@ -206,10 +204,6 @@
    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));
    }
}