feat: 복합 로트 사용 기능 구현 (수동 로트 배분)
## 구현 내용 ### 1. 백엔드 (app.py) - 수동 로트 배분 지원 (lot_assignments 배열 처리) - 각 로트별 지정 수량만큼 재고 차감 - 검증: 배분 합계 확인, 재고 충분 확인 - compound_consumptions 테이블에 각 로트별 소비 기록 ### 2. 프론트엔드 (app.js, index.html) - 로트 배분 모달 UI 구현 - 로트별 재고, 단가 표시 - 수동 입력 및 자동 배분 기능 - 실시간 합계 계산 및 검증 - 원산지 선택에 "수동 배분" 옵션 추가 (로트 2개 이상 시) - 조제 저장 시 lot_assignments 포함 ### 3. 테스트 - 테스트용 당귀 로트 추가 (한국산) - E2E 테스트 성공 - 당귀 100g을 2개 로트(중국산 60g + 한국산 40g)로 배분 - 각 로트별 재고 정확히 차감 - 소비 내역 올바르게 기록 ## 장점 - DB 스키마 변경 없음 - 기존 자동 선택과 호환 - 재고 부족 시 여러 로트 조합 가능 - 원가 최적화 가능 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1226,9 +1226,63 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 로트 배분 모달 -->
|
||||
<div class="modal fade" id="lotAllocationModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">
|
||||
<i class="bi bi-shuffle"></i> 로트 배분
|
||||
<span id="lotAllocationHerbName" class="text-primary"></span>
|
||||
</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-info">
|
||||
<strong>필요량: <span id="lotAllocationRequired">0</span>g</strong>
|
||||
<span class="float-end">배분 합계: <span id="lotAllocationTotal" class="fw-bold">0</span>g</span>
|
||||
</div>
|
||||
|
||||
<table class="table table-sm table-bordered">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>로트 번호</th>
|
||||
<th>원산지</th>
|
||||
<th>재고량</th>
|
||||
<th>단가</th>
|
||||
<th>사용량</th>
|
||||
<th>소계</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="lotAllocationList">
|
||||
</tbody>
|
||||
<tfoot class="table-secondary">
|
||||
<tr>
|
||||
<th colspan="4" class="text-end">합계:</th>
|
||||
<th id="lotAllocationSumQty">0g</th>
|
||||
<th id="lotAllocationSumCost">0원</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<div id="lotAllocationError" class="alert alert-danger d-none"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">취소</button>
|
||||
<button type="button" class="btn btn-warning" id="lotAllocationAutoBtn">
|
||||
<i class="bi bi-magic"></i> 자동 배분
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" id="lotAllocationConfirmBtn">
|
||||
<i class="bi bi-check"></i> 확인
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scripts -->
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="/static/app.js?v=20260215"></script>
|
||||
<script src="/static/app.js?v=20260217"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user