| | |
| | | switch (unit.Type) |
| | | { |
| | | case "0": |
| | | if (UpdatePositionStatus(db, entity.Id, "A")) // 启用岗位 |
| | | if (UpdatePositionStatus(db, entity.Id, "A", null, "")) // 启用岗位 |
| | | return 1; |
| | | break; |
| | | case "1": |
| | | if (UpdatePositionStatus(db, entity.Id, "B")) // 禁用岗位 |
| | | if (UpdatePositionStatus(db, entity.Id, "B", entity.DisabledDate, entity.DisabledBy)) // 禁用岗位 |
| | | return 1; |
| | | break; |
| | | //case "2": |
| | |
| | | |
| | | // 更新岗位状态的方法 |
| | | private bool UpdatePositionStatus(SqlSugarScope db, decimal positionId, |
| | | string status) |
| | | string status, DateTime? jytime, string jyr) |
| | | { |
| | | var result = db.Updateable<MesPosition>() |
| | | .SetColumns(s => s.Fforbidstatus == status) |
| | | .SetColumns(s => s.DisabledDate == jytime) |
| | | .Where(s => s.Id == positionId).ExecuteCommand(); |
| | | |
| | | if (result > 0) |
| | |
| | | DisabledDate = position.FForbidDate != null |
| | | ? DateTime.ParseExact(position.FForbidDate, |
| | | "yyyy-MM-dd HH:mm:ss", null) |
| | | : null |
| | | : null, |
| | | Type=position.Type, |
| | | }; |
| | | } |
| | | |