라벨 자동할당 로직 임시 커밋
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
package com.kamco.cd.kamcoback.label.dto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public class LabelAllocateDto {
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public static class Sheet {
|
||||
|
||||
private final String sheetId;
|
||||
private int count;
|
||||
|
||||
public void decrease(int amount) {
|
||||
this.count -= amount;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static class TargetUser {
|
||||
|
||||
private final String userId;
|
||||
private final int demand;
|
||||
private final List<Sheet> assigned = new ArrayList<>();
|
||||
private int allocated = 0;
|
||||
@Setter
|
||||
private int shortage = 0;
|
||||
|
||||
public TargetUser(String userId, int demand) {
|
||||
this.userId = userId;
|
||||
this.demand = demand;
|
||||
}
|
||||
|
||||
public int getRemainDemand() {
|
||||
return demand - allocated;
|
||||
}
|
||||
|
||||
public void assign(String sheetId, int count) {
|
||||
assigned.add(new Sheet(sheetId, count));
|
||||
allocated += count;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user