|
|
@@ -190,8 +190,8 @@ class DeliveryAppointmentController extends Controller
|
|
|
DeliveryAppointmentCar::query()->insert($insert);
|
|
|
});
|
|
|
dispatch(new DeliveryAppointmentCheck($appointment->id))->delay(Carbon::parse($appointment->appointment_date." ".(explode("-",DeliveryAppointment::PERIOD[$appointment->date_period])[1]).":00:01"));
|
|
|
- //当日或次日预约单广播
|
|
|
- if (strtotime(date('Y-m-d',strtotime("+2 day")))>strtotime($appointment->appointment_date." 00:00:00")){
|
|
|
+ // x当日或次日预约单广播 √大于当前时间的都广播
|
|
|
+ if (strtotime($appointment->appointment_date." 00:00:00")>strtotime(date('Y-m-d'))){
|
|
|
$appointment->load("cars");
|
|
|
event(new DeliveryAppointmentEvent($appointment->cars[0]));
|
|
|
}
|
|
|
@@ -246,7 +246,7 @@ class DeliveryAppointmentController extends Controller
|
|
|
//当日或次日预约单广播
|
|
|
$old = $appointment->appointment_date == date('Y-m-d') ? 0 : ($appointment->appointment_date == date('Y-m-d',strtotime('+1 day') ? 1 : 2));
|
|
|
$new = $selectDate["date"] == date('Y-m-d') ? 0 : ($selectDate["date"] == date('Y-m-d',strtotime('+1 day') ? 1 : 2));
|
|
|
- if ($old==2 && $new==2)$this->success(); //超过广播区间不推送
|
|
|
+ //if ($old==2 && $new==2)$this->success(); //超过广播区间不推送
|
|
|
if (($old-$new)!=0 || $appointment->date_period!=$selectDate["time"]){
|
|
|
$appointment->cars[0]->change = true;
|
|
|
$appointment->cars[0]->old = $old;
|
|
|
@@ -385,8 +385,12 @@ class DeliveryAppointmentController extends Controller
|
|
|
$query->withCount("cars")->with("owner");
|
|
|
}])->whereHas("deliveryAppointment",function ($query)use($period,$warehouse,$date){
|
|
|
/** @var Builder $query */
|
|
|
- $query->where("appointment_date",$date)
|
|
|
- ->where("warehouse_id",$warehouse)->whereIn("status",[0,2]);
|
|
|
+ if ($date){
|
|
|
+ $query->where("appointment_date",$date);
|
|
|
+ }else{
|
|
|
+ $query->where("appointment_date",">",date("Y-m-d"));
|
|
|
+ }
|
|
|
+ $query->where("warehouse_id",$warehouse)->whereIn("status",[0,2]);
|
|
|
})->where(function ($query)use($period){
|
|
|
/** @var Builder $query */
|
|
|
$query->where("status",1)->orWhereHas("deliveryAppointment",function (Builder $query)use($period){
|
|
|
@@ -457,7 +461,7 @@ class DeliveryAppointmentController extends Controller
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- $result = ["list"=>$list,"success"=>$success,"work"=>$work,"notReached"=>$notReached,"nextDay"=>$this->carList(0,date("Y-m-d",strtotime("+1 day")),$warehouse)];
|
|
|
+ $result = ["list"=>$list,"success"=>$success,"work"=>$work,"notReached"=>$notReached,"nextDay"=>$this->carList(0,/*date("Y-m-d",strtotime("+1 day"))*/null,$warehouse)];
|
|
|
$nextTime = DeliveryAppointment::PERIOD[$index+1] ?? null;
|
|
|
if ($nextTime){
|
|
|
$nextTime = explode("-",$nextTime)[0];
|
|
|
@@ -567,7 +571,7 @@ html;
|
|
|
if (!$car || !$car->deliveryAppointment)$this->error("单据不存在");
|
|
|
if (!$car->delivery_time)$this->error("尚未签到");
|
|
|
if (mb_substr($car->delivery_time,0,10)!=date('Y-m-d'))$this->error("禁止越天逾期操作");
|
|
|
- $car->update(["status"=>2]);
|
|
|
+ $car->update(["status"=>2,"unloaded_at"=>date("Y-m-d H:i:s")]);
|
|
|
$status = app("DeliveryAppointmentService")->checkFull($car->delivery_appointment_id);
|
|
|
event(new DeliveryAppointmentEvent($car));
|
|
|
$this->success($status);
|