|
|
@@ -139,21 +139,11 @@ class TestController extends Controller
|
|
|
|
|
|
public function test1()
|
|
|
{
|
|
|
- ini_set('max_execution_time',-1);
|
|
|
- DeliveryAppointment::query()->with("details")->whereNotNull("asn_number")->get()->each(function ($d){
|
|
|
- $asn = preg_split('/[,, ]+/is', $d->asn_number);
|
|
|
- if ($asn && strlen($d->asn_number)>=13){
|
|
|
- Store::query()->whereIn("asn_code",$asn)->where("owner_id",$d->owner_id)
|
|
|
- ->with("storeItems")->get()->each(function ($store)use($d){
|
|
|
- $store->storeItems->each(function ($item)use($d){
|
|
|
- $de = DeliveryAppointmentDetail::query()->where("delivery_appointment_id",$d->id)
|
|
|
- ->where("commodity_id",$item->commodity_id)->first();
|
|
|
- if ($de && $item->expected_amount && $de->amount!=$item->expected_amount)$de->update(["amount"=>$item->expected_amount]);
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- dd("OK");
|
|
|
+ $stations = Station::query()->select("id")->where("parent_id",6);
|
|
|
+ $storages = \App\Storage::query()->with("station:id,code")->whereIn("station_id",$stations)->where(function (Builder $query){
|
|
|
+ $query->whereNotNull("material_box_id")->orWhere("status",1);
|
|
|
+ })->get();
|
|
|
+ dd(array_column($storages->toArray(),"id"));
|
|
|
}
|
|
|
|
|
|
public function test2()
|