From 215d4d2c7c0c719dae3295f2a96ba34adb38f01f Mon Sep 17 00:00:00 2001 From: taekyoungc Date: Thu, 23 Apr 2026 15:53:33 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B0=9C=EC=A3=BC=20=EB=B3=80=EA=B2=BD=C2=B7?= =?UTF-8?q?=EC=9E=85=EA=B3=A0=20=ED=99=94=EB=A9=B4=EC=9D=84=20=EC=82=AC?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8=20=ED=9D=90=EB=A6=84=EC=97=90=20=EB=A7=9E?= =?UTF-8?q?=EA=B2=8C=20=EB=B0=98=EC=98=81=ED=95=9C=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 발주 등록/변경 및 스캐너·일괄·입고현황 화면의 라우팅과 화면 구성을 운영과 동일한 최신 형태로 정리한다. Made-with: Cursor --- app/Config/Routes.php | 11 + app/Controllers/Admin/BagReceiving.php | 2 +- app/Views/admin/bag_order/create.php | 490 +++++++++++++--- app/Views/admin/bag_order/index.php | 239 ++++++-- app/Views/bag/create_bag_order.php | 756 ++++++++++++++++++++++--- app/Views/bag/order_change.php | 106 ++++ app/Views/bag/purchase_inbound.php | 6 +- app/Views/bag/receiving_batch.php | 119 ++++ app/Views/bag/receiving_scanner.php | 153 +++++ app/Views/bag/receiving_status.php | 138 +++++ 10 files changed, 1824 insertions(+), 196 deletions(-) create mode 100644 app/Views/bag/order_change.php create mode 100644 app/Views/bag/receiving_batch.php create mode 100644 app/Views/bag/receiving_scanner.php create mode 100644 app/Views/bag/receiving_status.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index c3cc3e9..d896078 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -42,10 +42,20 @@ $routes->get('bag/issue/create', 'Bag::issueCreate'); $routes->post('bag/issue/store', 'Bag::issueStore'); $routes->post('bag/issue/cancel/(:num)', 'Bag::issueCancel/$1'); $routes->get('bag/order/create', 'Bag::orderCreate'); +$routes->get('bag/order/change', 'Bag::orderChange'); +$routes->get('bag/order/revise/(:num)', 'Bag::orderRevise/$1'); $routes->post('bag/order/store', 'Bag::orderStore'); $routes->post('bag/order/cancel/(:num)', 'Bag::orderCancel/$1'); +$routes->post('bag/order/delete', 'Bag::orderDeletePost'); +$routes->post('bag/order/delete/(:num)', 'Bag::orderDelete/$1'); $routes->get('bag/receiving/create', 'Bag::receivingCreate'); $routes->post('bag/receiving/store', 'Bag::receivingStore'); +$routes->get('bag/receiving/scanner', 'Bag::receivingScanner'); +$routes->post('bag/receiving/scanner/store', 'Bag::receivingScannerStore'); +$routes->get('bag/receiving/batch', 'Bag::receivingBatch'); +$routes->post('bag/receiving/batch/store', 'Bag::receivingBatchStore'); +$routes->get('bag/receiving/status', 'Bag::receivingStatus'); +$routes->get('bag/receiving/status/export', 'Bag::receivingStatusExport'); $routes->get('bag/sale/create', 'Bag::saleCreate'); $routes->post('bag/sale/store', 'Bag::saleStore'); $routes->get('bag/shop-order/create', 'Bag::shopOrderCreate'); @@ -108,6 +118,7 @@ $routes->group('bag', ['filter' => 'adminAuth'], static function ($routes): void $routes->get('bag-orders/export', 'Admin\BagOrder::export'); $routes->get('bag-orders', 'Admin\BagOrder::index'); $routes->get('bag-orders/create', 'Admin\BagOrder::create'); + $routes->get('bag-orders/revise/(:num)', 'Admin\BagOrder::revise/$1'); $routes->post('bag-orders/store', 'Admin\BagOrder::store'); $routes->get('bag-orders/detail/(:num)', 'Admin\BagOrder::detail/$1'); $routes->post('bag-orders/cancel/(:num)', 'Admin\BagOrder::cancel/$1'); diff --git a/app/Controllers/Admin/BagReceiving.php b/app/Controllers/Admin/BagReceiving.php index 7eb13d2..a7e9f5d 100644 --- a/app/Controllers/Admin/BagReceiving.php +++ b/app/Controllers/Admin/BagReceiving.php @@ -50,7 +50,7 @@ class BagReceiving extends BaseController return redirect()->to(mgmt_url('bag-receivings'))->with('error', '지자체를 선택해 주세요.'); } - $orders = model(BagOrderModel::class)->where('bo_lg_idx', $lgIdx)->where('bo_status', 'normal')->orderBy('bo_order_date', 'DESC')->findAll(); + $orders = model(BagOrderModel::class)->where('bo_lg_idx', $lgIdx)->whereLatestHead($lgIdx)->where('bo_status', 'normal')->orderBy('bo_order_date', 'DESC')->findAll(); return $this->renderWorkPage('입고 처리', 'admin/bag_receiving/create', compact('orders')); } diff --git a/app/Views/admin/bag_order/create.php b/app/Views/admin/bag_order/create.php index fba9be4..d9b2f4e 100644 --- a/app/Views/admin/bag_order/create.php +++ b/app/Views/admin/bag_order/create.php @@ -1,83 +1,443 @@
발주 등록
-
-
- -
- - + $row['name'], + 'orderPrice' => (float) $row['orderPrice'], + 'boxPerPack' => (int) $row['boxPerPack'], + 'packPerSheet' => (int) $row['packPerSheet'], + 'totalPerBox' => max(1, (int) $row['totalPerBox']), + ]; + } + + $initialSelectedItems = []; + $maxOldCount = max(count($oldBagCodes), count($oldQtySheets), count($oldQtyBoxes)); + for ($i = 0; $i < $maxOldCount; $i++) { + $code = trim((string) ($oldBagCodes[$i] ?? '')); + if ($code === '' || ! isset($bagMeta[$code])) { + continue; + } + $fallbackQtyBox = (int) ($oldQtyBoxes[$i] ?? 0); + $rawQtySheet = (int) ($oldQtySheets[$i] ?? 0); + $fallbackTotalPerBox = (int) ($bagMeta[$code]['totalPerBox'] ?? 1); + if ($fallbackQtyBox <= 0 && $rawQtySheet > 0) { + $fallbackQtyBox = intdiv($rawQtySheet, max(1, $fallbackTotalPerBox)); + } + $initialSelectedItems[] = [ + 'code' => $code, + 'qtyBox' => max(0, $fallbackQtyBox), + ]; + } + + $statusMap = ['normal' => '정상', 'cancelled' => '취소', 'deleted' => '삭제']; +?> + + + + +
+
+
+ + +
+
+ + +
+

※ 발주수량은 박스단위로 입력해 주세요. (발주일은 미래일도 선택 가능)

+
-
- - - % -
- -
- - -
- -
- - -
- -
- -
- +
+
+
발주 이력
+
+
- - - + + + + - + - - - + + + + - + + + +
순번봉투박스수발주일제작업체입고처상태
- - - - bo_order_date) ?>bo_company_idx] ?? '-')) ?>bo_agency_idx] ?? '-')) ?>bo_status] ?? $history->bo_status)) ?>
발주 이력이 없습니다.
-
+ -
- - 취소 +
+
발주 Form
+
+
+
+ + + % +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
번호선택품명수량(BOX)단가환산수량금액
000
+
+ +
+ + 취소 +
+
+
+
+ +
+
발주 등록 종류
+

아래 목록에서 봉투를 선택하면 발주 품목에 추가됩니다. (개수 제한 없음)

+
+ + + + + + + + + + + + + + $row): ?> + + + + + + + + + + + + + + +
번호선택봉투 종류발주단가Box당 팩팩당 낱장1박스 총 낱장
+ +
표시할 봉투 기준 데이터가 없습니다.
- -
+ + + + + + diff --git a/app/Views/admin/bag_order/index.php b/app/Views/admin/bag_order/index.php index 646f4b2..021c8c2 100644 --- a/app/Views/admin/bag_order/index.php +++ b/app/Views/admin/bag_order/index.php @@ -1,81 +1,200 @@ - '발주 현황']) ?> -
+ + '봉투 발주 현황', 'printShowApproval' => false]) ?> +
- 발주 현황
-
-
- - - - - - - - 초기화 + +
+ + +
+ + + ~ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + 초기화 +
-
- + +
+
- - - - - - - - - - + + + + + + + + + - + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + - - + + + + + + + + + + + + + +
번호LOT번호발주일제작업체입고처품목수총수량총금액상태작업발주일자제작 업체품 명발주 수량입고 수량미입고수량발주 금액입고처비 고
bo_idx) ?>bo_lot_no) ?>bo_order_date) ?>bo_company_idx] ?? '') ?>bo_agency_idx] ?? '') ?>bo_idx]['count'] ?? 0)) ?>bo_idx]['qty'] ?? 0)) ?>bo_idx]['amount'] ?? 0)) ?> - '정상', 'cancelled' => '취소', 'deleted' => '삭제']; - echo esc($statusMap[$row->bo_status] ?? $row->bo_status); - ?> - - 상세 -
- - -
-
- - -
-
등록된 발주가 없습니다.
조회 조건에 해당하는 발주 내역이 없습니다.
총계
-
links() ?>
+ + diff --git a/app/Views/bag/create_bag_order.php b/app/Views/bag/create_bag_order.php index b98df21..aaeae57 100644 --- a/app/Views/bag/create_bag_order.php +++ b/app/Views/bag/create_bag_order.php @@ -1,83 +1,701 @@ -
- 발주 등록 + $monthValue, 'label' => $monthLabel]; + } + } + + $bagMeta = []; + foreach (($bagReferenceRows ?? []) as $row) { + $bagMeta[$row['code']] = [ + 'name' => $row['name'], + 'orderPrice' => (float) $row['orderPrice'], + 'boxPerPack' => (int) $row['boxPerPack'], + 'packPerSheet' => (int) $row['packPerSheet'], + 'totalPerBox' => max(1, (int) $row['totalPerBox']), + ]; + } + + $initialSelectedItems = []; + $maxOldCount = max(count($oldBagCodes), count($oldQtySheets), count($oldQtyBoxes)); + for ($i = 0; $i < $maxOldCount; $i++) { + $code = trim((string) ($oldBagCodes[$i] ?? '')); + if ($code === '' || !isset($bagMeta[$code])) { + continue; + } + $fallbackQtyBox = (int) ($oldQtyBoxes[$i] ?? 0); + $rawQtySheet = (int) ($oldQtySheets[$i] ?? 0); + $fallbackTotalPerBox = (int) ($bagMeta[$code]['totalPerBox'] ?? 1); + if ($fallbackQtyBox <= 0 && $rawQtySheet > 0) { + $fallbackQtyBox = intdiv($rawQtySheet, max(1, $fallbackTotalPerBox)); + } + $initialSelectedItems[] = [ + 'code' => $code, + 'qtyBox' => max(0, $fallbackQtyBox), + ]; + } + + $statusMap = ['normal' => '정상', 'cancelled' => '취소', 'deleted' => '삭제']; + + $hubReturn = (bool) ($hubReturn ?? false); + $changeMode = $editMode ? (string) ($changeMode ?? 'meta') : 'meta'; + if (! in_array($changeMode, ['price', 'meta', 'delete'], true)) { + $changeMode = 'meta'; + } + $orderLotNo = (string) ($orderLotNo ?? ''); + $orderReturnMonth = (string) ($orderReturnMonth ?? ''); + $deleteMode = $editMode && $changeMode === 'delete'; + $defaultDeleteBoIdx = (int) ($editDefaults['bo_source_idx'] ?? 0); + $firstNormalBoIdx = null; + foreach (($recentOrders ?? []) as $_h) { + if ((string) ($_h->bo_status ?? '') === 'normal') { + $firstNormalBoIdx = (int) $_h->bo_idx; + break; + } + } + $defaultDeleteOk = false; + foreach (($recentOrders ?? []) as $_h) { + if ((int) $_h->bo_idx === $defaultDeleteBoIdx && (string) ($_h->bo_status ?? '') === 'normal') { + $defaultDeleteOk = true; + break; + } + } + $selectedDeleteBoIdx = $defaultDeleteOk ? $defaultDeleteBoIdx : (int) ($firstNormalBoIdx ?? 0); +?> + +
+ + + 발주 변경 목록 +
-
-
- -
- - -
- -
- - - % -
- -
- - -
- -
- - -
- -
- -
- + + + +
+ 발주월 + + 왼쪽 목록에서 삭제할 발주를 선택한 뒤 「삭제 실행」을 누르세요. +
+
+
+
발주 이력
+
+
- - - + + + + + - - - - - + + + + + - + + + +
순번봉투박스수선택발주일제작업체입고처상태
- - - + + + bo_status ?? '') === 'normal'; ?> +
+ + bo_idx === $selectedDeleteBoIdx ? 'checked' : '' ?> /> + + + + bo_order_date) ?>bo_company_idx] ?? '-')) ?>bo_agency_idx] ?? '-')) ?>bo_status] ?? $history->bo_status)) ?>
발주 이력이 없습니다.
-
+
+
+

발주 삭제

+

목록에서 선택한 발주를 삭제 처리합니다. 계속하시겠습니까?

+
+ + 취소 +
+
+
+ + -
- - 취소 +
+ + + +
+ 변경 구분 +
+ +
- -
+

+ 발주 삭제는 발주 삭제 화면으로 이동합니다. +

+ + + + + + + +
+
+
+ + + +
+

※ 발주수량을 박스단위로 떨어지게 입력해 주세요.

+
+
+ +
+
+
발주 이력
+
+ + + + + + + + + + + + + + + + + + + + + + +
발주일제작업체입고처상태
+ + bo_order_date) ?> + + bo_company_idx] ?? '-')) ?>bo_agency_idx] ?? '-')) ?>bo_status] ?? $history->bo_status)) ?>
발주 이력이 없습니다.
+
+
+ +
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
번호선택품명수량단가낱장환산선정수량LOT금액
000
+
+ +
+
+
+ 품목 금액 합계 + 0 +
+
+ 조달수수료 + + + % + +
+
+ 조달수수료액 + 0 +
+
+ 품목 + 수수료 합계 + 0 +
+
+
+ +
+ + 취소 +
+
+
+
+ +
+
발주 등록 종류
+
+ + + + + + + + + + + + + + $row): ?> + + + + + + + + + + + + + + +
번호선택봉투 종류발주단가Box당 팩팩당 낱장1박스 총 낱장
+ +
표시할 봉투 기준 데이터가 없습니다.
+
+
+ + + + + + + + diff --git a/app/Views/bag/order_change.php b/app/Views/bag/order_change.php new file mode 100644 index 0000000..1682aa7 --- /dev/null +++ b/app/Views/bag/order_change.php @@ -0,0 +1,106 @@ + $monthValue, 'label' => $year . '년 ' . $m . '월']; + } + } + $statusMap = ['normal' => '정상', 'cancelled' => '취소', 'deleted' => '삭제']; +?> + +
+ 발주 변경 + 발주 입고 관리로 +
+ +
+ getFlashdata('success')): ?> +
getFlashdata('success')) ?>
+ + getFlashdata('error')): ?> +
getFlashdata('error')) ?>
+ + +
+
+ + +
+
+ 변경 구분 +
+ + + +
+
+ +
+ +
+
+
발주 목록 (발주일 · 제작업체)
+
+ + + + + + + + + + + bo_status ?? '')) === 'normal'; + $href = base_url('bag/order/revise/' . (int) $row->bo_idx . '?change_mode=' . rawurlencode($hubMode)); + ?> + + + + + + + + + + +
발주일제작업체상태
+ + bo_order_date ?? '')) ?> + + bo_order_date ?? '')) ?> + + bo_company_idx ?? 0)] ?? '-')) ?>bo_status ?? '')] ?? $row->bo_status)) ?>
해당 월 발주가 없습니다.
+
+
+ +
+

안내

+
    +
  • 발주 삭제를 선택하고 조회하면 발주 삭제 화면으로 이동합니다 (해당 월에 정상 발주가 있을 때).
  • +
  • 그 외 변경 구분에서는 왼쪽 목록에서 발주일을 클릭하면 선택한 변경 구분으로 발주 변경 화면이 열립니다.
  • +
  • 발주·도매·판매 단가: 품목별 단가를 수정해 저장합니다 (발주 변경 시에만).
  • +
  • 업체·수수료·협회·발주: 발주일·입고처·수량 등을 수정해 저장합니다.
  • +
  • 발주 삭제 화면에서 목록을 선택해 삭제 처리합니다 (복구 불가에 가깝게 동작하므로 확인 후 진행하세요).
  • +
+
+
+
diff --git a/app/Views/bag/purchase_inbound.php b/app/Views/bag/purchase_inbound.php index e6fa18a..ad3c868 100644 --- a/app/Views/bag/purchase_inbound.php +++ b/app/Views/bag/purchase_inbound.php @@ -58,7 +58,11 @@
diff --git a/app/Views/bag/receiving_batch.php b/app/Views/bag/receiving_batch.php new file mode 100644 index 0000000..4b0eaed --- /dev/null +++ b/app/Views/bag/receiving_batch.php @@ -0,0 +1,119 @@ +
+ 일괄 입고 + +
+ +getFlashdata('success')): ?> +
getFlashdata('success')) ?>
+ +getFlashdata('error')): ?> +
getFlashdata('error')) ?>
+ + +
+
+ + + + +
+ + + + + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
체크한 LOT-봉투 행의 미입고량을 전부 입고 처리합니다.
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
발주일자봉투종류발주량(매)미입고량(매)제작업체LOT NO발주NO
+ +
일괄 입고 가능한 미입고 행이 없습니다.
+ + +
+ 취소 +
+ + + diff --git a/app/Views/bag/receiving_scanner.php b/app/Views/bag/receiving_scanner.php new file mode 100644 index 0000000..1dc1f3a --- /dev/null +++ b/app/Views/bag/receiving_scanner.php @@ -0,0 +1,153 @@ +
+ 발주 입고(스캐너 대체 수동입력) + +
+ +getFlashdata('success')): ?> +
getFlashdata('success')) ?>
+ +getFlashdata('error')): ?> +
getFlashdata('error')) ?>
+ + +
+
+
+ + +
+ +
+ +

제작업체를 선택하면 해당 업체 발주 중 미입고 내역을 조회합니다.

+ +

미입고 잔량이 있는 발주가 없습니다. 발주 등록 후 다시 확인해 주세요.

+ +
+ +
+ + + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
상단에서 제작업체를 조회한 뒤, 아래에서 입고량(매)을 입력해 저장합니다.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
발주일자봉투종류발주량(매)미입고량(매)입고량(매)제작업체LOT NO발주NO
+ +
+
+ +
+ 취소 +
+
+ + diff --git a/app/Views/bag/receiving_status.php b/app/Views/bag/receiving_status.php new file mode 100644 index 0000000..2db8933 --- /dev/null +++ b/app/Views/bag/receiving_status.php @@ -0,0 +1,138 @@ + '봉투 입고 현황', 'printShowApproval' => false]) ?> +
+
+ 입고 현황 +
+ 엑셀저장 + + 입고 처리 +
+
+
+ +
+
+ + + ~ + + + + + + + + + + + + + 초기화 +
+
+ +
+ + + + + + + + + + + + + + + + + + $row): ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
입고일자품명입고수량발주일자발주수량발주번호제작업체입고여부입고처비고
소 계
소 계
조회 결과가 없습니다.
합 계
+
+ +