feat: [bending] 담당자 기본값 + 원자재 LOT 조회 API + 취소 복원 지원
- STOCK 주문 생성 시 담당자(manager_name) 미입력이면 로그인 사용자명 자동 설정
- GET /bending/material-lots?material={재질}: 수입검사 완료 입고의 LOT 목록 조회
- 취소→등록 복원은 기존 CANCELLED→DRAFT 전환으로 이미 지원됨 (프론트 UI만 필요)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Tenants\Receiving;
|
||||
use App\Services\BendingCodeService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -48,6 +49,45 @@ public function resolveItem(Request $request): JsonResponse
|
||||
}, __('message.fetched'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 원자재 LOT 목록 조회 (수입검사 완료 입고 기준)
|
||||
*
|
||||
* 재질(material)이 일치하는 입고 LOT 목록 반환
|
||||
*/
|
||||
public function materialLots(Request $request): JsonResponse
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
$material = $request->query('material');
|
||||
|
||||
$query = Receiving::where('status', 'completed')
|
||||
->whereNotNull('lot_no')
|
||||
->where('lot_no', '!=', '');
|
||||
|
||||
// 재질(item_name 또는 specification)으로 필터링
|
||||
if ($material) {
|
||||
$query->where(function ($q) use ($material) {
|
||||
$q->where('item_name', 'LIKE', "%{$material}%")
|
||||
->orWhere('specification', 'LIKE', "%{$material}%");
|
||||
});
|
||||
}
|
||||
|
||||
return $query->select([
|
||||
'id',
|
||||
'lot_no',
|
||||
'supplier_lot',
|
||||
'item_name',
|
||||
'specification',
|
||||
'receiving_qty',
|
||||
'receiving_date',
|
||||
'supplier',
|
||||
'options',
|
||||
])
|
||||
->orderByDesc('receiving_date')
|
||||
->limit(50)
|
||||
->get();
|
||||
}, __('message.fetched'));
|
||||
}
|
||||
|
||||
/**
|
||||
* LOT 번호 생성 (프리뷰 + 일련번호 확정)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user