사이트·관리자 봉투 물류 기능(수불·통계·레포트·재고·발주)과 DB·메뉴·E2E를 운영 반영한다.
통계 분석(전년대비·월별·계절별), 수급계획·LOT 수불, 지정판매소·실사·메뉴 링크 등을 포함한다. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -16,4 +16,29 @@ class PackagingUnitModel extends Model
|
||||
'pu_start_date', 'pu_end_date', 'pu_state',
|
||||
'pu_regdate', 'pu_moddate', 'pu_reg_mb_idx',
|
||||
];
|
||||
|
||||
/**
|
||||
* 동일 봉투코드에 행이 여러 개여도 최신 등록 1건만 사용.
|
||||
*
|
||||
* @return array<string, object>
|
||||
*/
|
||||
public function latestActiveMapByBagCode(int $lgIdx): array
|
||||
{
|
||||
$rows = $this->where('pu_lg_idx', $lgIdx)
|
||||
->where('pu_state', 1)
|
||||
->orderBy('pu_regdate', 'DESC')
|
||||
->orderBy('pu_idx', 'DESC')
|
||||
->findAll();
|
||||
|
||||
$map = [];
|
||||
foreach ($rows as $row) {
|
||||
$code = (string) ($row->pu_bag_code ?? '');
|
||||
if ($code === '' || isset($map[$code])) {
|
||||
continue;
|
||||
}
|
||||
$map[$code] = $row;
|
||||
}
|
||||
|
||||
return $map;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user