fix: 로트 배분 모달 필요량 0 표시 버그 수정

문제:
- 원산지 선택에서 "수동 배분" 선택 시 필요량이 0으로 표시
- loadOriginOptions 함수 호출 시점의 requiredQty를 그대로 사용

해결:
- 모달 열기 시점에 현재 행의 실제 필요량 재계산
- gramsPerCheop × cheopTotal로 실시간 계산
- 디버깅 로그 추가로 값 확인 가능

이제 첩수나 용량이 변경된 후에도 정확한 필요량이 모달에 표시됩니다.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-02-17 02:23:37 +00:00
parent 7d2b458e31
commit 3f4b9c816a
2 changed files with 88 additions and 2 deletions

View File

@@ -1871,8 +1871,13 @@ $(document).ready(function() {
const row = $(this).closest('tr');
if (selectedValue === 'manual') {
// 수동 배분 모달 열기
openLotAllocationModal(herbId, requiredQty, row, response.data);
// 현재 행의 실제 필요량 재계산
const gramsPerCheop = parseFloat(row.find('.grams-per-cheop').val()) || 0;
const cheopTotal = parseFloat($('#cheopTotal').val()) || 0;
const actualRequiredQty = gramsPerCheop * cheopTotal;
// 수동 배분 모달 열기 (재계산된 필요량 사용)
openLotAllocationModal(herbId, actualRequiredQty, row, response.data);
} else {
// 기존 자동/원산지 선택 - lot_assignments 제거
row.removeAttr('data-lot-assignments');
@@ -2552,6 +2557,15 @@ $(document).ready(function() {
// 로트 배분 모달 열기
window.openLotAllocationModal = function(herbId, requiredQty, row, data) {
// 디버깅: 전달받은 필요량 확인
console.log('로트 배분 모달 열기:', {
herbId: herbId,
requiredQty: requiredQty,
herbName: data.herb_name,
gramsPerCheop: row.find('.grams-per-cheop').val(),
cheopTotal: $('#cheopTotal').val()
});
currentLotAllocation = {
herbId: herbId,
requiredQty: requiredQty,