sjz
5 天以前 74ab9465837f8a6f9eae854059e9783eff24e173
MES.Service/service/BasicData/MesStaffManager.cs
@@ -42,7 +42,8 @@
    }
    // 更新员工状态的方法
    private bool UpdateStaffStatus(SqlSugarScope db, decimal staffId,string status)
    private bool UpdateStaffStatus(SqlSugarScope db, decimal staffId,
        string status)
    {
        var result = db.Updateable<MesStaff>().SetColumns(s => s.FforbidStatus == status).Where(s => s.Id == staffId).ExecuteCommand();
        return true;
@@ -90,9 +91,8 @@
        };
        if (staff.FStaffStartDate != null)
        {
            entity.StartDate = DateTime.ParseExact(staff.FStaffStartDate, "yyyy-MM-dd HH:mm:ss", null);
        }
            entity.StartDate = DateTime.ParseExact(staff.FStaffStartDate,
                "yyyy-MM-dd HH:mm:ss", null);
        return entity;
    }
@@ -108,11 +108,13 @@
                switch (staffGroup.Key)
                {
                    case "0":
                        if (!UpdateStaffStatusBatch(db, staffGroup.Value,"A")) // 批量启用员工
                        if (!UpdateStaffStatusBatch(db, staffGroup.Value,
                                "A")) // 批量启用员工
                            throw new NotImplementedException("启用失败");
                        break;
                    case "1":
                        if (!UpdateStaffStatusBatch(db, staffGroup.Value,"B")) // 批量禁用员工
                        if (!UpdateStaffStatusBatch(db, staffGroup.Value,
                                "B")) // 批量禁用员工
                            throw new NotImplementedException("禁用失败");
                        break;
                    case "2":
@@ -124,11 +126,13 @@
                            throw new NotImplementedException("删除失败");
                        break;
                    case "4":
                        if (!InsertOrUpdateBatch(db,staffGroup.Value)) // 批量插入或更新员工
                        if (!InsertOrUpdateBatch(db,
                                staffGroup.Value)) // 批量插入或更新员工
                            throw new NotImplementedException("同步失败");
                        break;
                    default:
                        throw new ArgumentNullException($"type没有{staffGroup.Key}这个类型的参数");
                        throw new ArgumentNullException(
                            $"type没有{staffGroup.Key}这个类型的参数");
                }
            return 1;
@@ -136,7 +140,8 @@
    }
    // 批量更新员工状态的方法
    private bool UpdateStaffStatusBatch(SqlSugarScope db,List<MesStaff> staffList, string status)
    private bool UpdateStaffStatusBatch(SqlSugarScope db,
        List<MesStaff> staffList, string status)
    {
        var ids = staffList.Select(it => it.Id).ToArray();
        var result = db.Updateable<MesStaff>().SetColumns(s => s.FforbidStatus == status).Where(s => ids.Contains(s.Id)).ExecuteCommand();