<?php

namespace App\Services;

use App\OracleDOCASNHeader;
use App\Traits\ServiceAppAop;


class OracleDocAsnHerderService
{
    use ServiceAppAop;
    protected $modelClass=OracleDocAsnHerder::class;
    public function getWmsAsnOnStartDateCreate($startDate)
    {
        if (!$startDate) return null;
        $oracleDocAsnHerder= OracleDOCASNHeader::query()
            ->with(['asnType', 'asnStatus'])
            ->select('asnno','asnstatus','asntype','addtime','edittime','customerid','notes','warehouseid','asnreference3','asnreference2')
            ->where('addTime', '>=', $startDate)
            ->orderByDesc('addtime')
            ->get();
        return $oracleDocAsnHerder;
    }

    public function getWmsAsnOnStartDateEdit($startDate)
    {
        if (!$startDate) return null;
        $oracleDocAsnHerder= OracleDOCASNHeader::query()
            ->with(['asnType', 'asnStatus'])
            ->select('asnno','asnstatus','asntype','addtime','edittime','customerid','notes','warehouseid','asnreference3','asnreference2')
            ->where('EditTime', '>=', $startDate)
            ->whereColumn('EditTime', '<>', 'addTime')
            ->orderByDesc('EditTime')
            ->get();
        return $oracleDocAsnHerder;
    }

}
