diff --git a/static/app.js b/static/app.js index 4bf5ba4..c60944e 100644 --- a/static/app.js +++ b/static/app.js @@ -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, diff --git a/test_lot_modal.html b/test_lot_modal.html new file mode 100644 index 0000000..f60eae0 --- /dev/null +++ b/test_lot_modal.html @@ -0,0 +1,72 @@ + + + + + 로트 배분 모달 테스트 + + + + + +
+

로트 배분 필요량 테스트

+ +
+
+
시나리오 테스트
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file