commit de compras
This commit is contained in:
@@ -119,6 +119,12 @@ final class IndustrialCosts {
|
||||
$id=DB::table('ic_decisions')->insertGetId([$field=>$r->id,'version'=>$r->version,'decision'=>$d['decision'],'reason'=>$d['reason'],'actor_id'=>$actor,'created_at'=>now()]);return ['id'=>$id,'lot_id'=>$lot,'version'=>$r->version,'kind'=>'decision'];
|
||||
});
|
||||
}
|
||||
/** Current owner conference for one lot; no listing universe or writer lock. */
|
||||
public function conference(int $lot,int $actor):array {
|
||||
self::guard();$s=$this->scope($actor,'view');$l=$this->lot($lot,$s);$r=DB::table('ic_results')->where($s)->where('lot_id',$lot)->orderByDesc('version')->first();$snapshot=$r?json_decode($r->snapshot,true,64,JSON_THROW_ON_ERROR):null;
|
||||
$ids=array_column(array_filter($snapshot['refs']??[]),'id');$inputs=DB::table('ic_inputs')->where($s)->where('lot_id',$lot)->whereIn('id',$ids)->orderBy('id')->get();$decisions=DB::table('ic_decisions')->whereIn('input_id',$ids)->orderBy('id')->get();$decision=$r?DB::table('ic_decisions')->where('result_id',$r->id)->first():null;
|
||||
return ['lot'=>(array)$l,'product'=>(array)DB::table('ic_products')->where($s)->where('id',$l->product_id)->first(),'result'=>$r?(array)$r:null,'snapshot'=>$snapshot,'decision'=>$decision?(array)$decision:null,'current'=>$r?$this->resultCurrent($r):false,'inputs'=>$inputs->map(fn($i)=>(array)$i)->all(),'input_decisions'=>$decisions->map(fn($i)=>(array)$i)->all()];
|
||||
}
|
||||
public function listing(int $actor): array {
|
||||
$s=$this->scope($actor,'view');if(!ServiceCalculation::isolated())return ['blocked'=>true,'lots'=>[],'notice'=>self::NOTICE];self::guard();
|
||||
return DB::transaction(function()use($s){
|
||||
|
||||
Reference in New Issue
Block a user