|
|
@@ -536,7 +536,7 @@ html;
|
|
|
if (!$car || !$car->deliveryAppointment)return ["status"=>417];
|
|
|
$car->update(["delivery_time"=>date("Y-m-d H:i:s"),"status"=>1]);
|
|
|
if (Carbon::now()->gt(Carbon::parse($car->deliveryAppointment->appointment_date." ".explode("-",DeliveryAppointment::PERIOD[$car->deliveryAppointment->date_period])[1].":00:00"))){
|
|
|
- $available = app("DeliveryAppointmentService")->getAvailableCapacity($car->deliveryAppointment->appointment_date,$car->deliveryAppointment->date_period,$car->deliveryAppointment->warehouse_id);
|
|
|
+ $available = app("DeliveryAppointmentService")->getAvailableCapacity(date("Y-m-d"),$period,$car->deliveryAppointment->warehouse_id);
|
|
|
if ($available<$car->deliveryAppointment->capacity)return ["status"=>417];
|
|
|
DeliveryAppointment::query()->where("id",$car->delivery_appointment_id)->update(["status" => 0]);
|
|
|
}
|
|
|
@@ -565,7 +565,8 @@ html;
|
|
|
/** @var DeliveryAppointmentCar|\stdClass $car */
|
|
|
$car = DeliveryAppointmentCar::query()->with("deliveryAppointment")->where("status",1)->find(request("id"));
|
|
|
if (!$car || !$car->deliveryAppointment)$this->error("单据不存在");
|
|
|
- //if ($car->deliveryAppointment->appointment_date!=date('Y-m-d'))$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]);
|
|
|
$status = app("DeliveryAppointmentService")->checkFull($car->delivery_appointment_id);
|
|
|
event(new DeliveryAppointmentEvent($car));
|
|
|
@@ -579,6 +580,8 @@ html;
|
|
|
{
|
|
|
$this->gate("入库管理-入库预约-预约管理-签到");
|
|
|
if (!request("id"))$this->error("非法参数");
|
|
|
+ $period = app("DeliveryAppointmentService")->getPeriod();
|
|
|
+ if ($period===false)$this->error("当前非工作时间,请在指定时间内送货");
|
|
|
/** @var DeliveryAppointmentCar|\stdClass $car */
|
|
|
$car = DeliveryAppointmentCar::query()->whereHas("deliveryAppointment",function (Builder $query){
|
|
|
$query->whereIn("status",[0,3]);
|
|
|
@@ -586,7 +589,7 @@ html;
|
|
|
if (!$car || !$car->deliveryAppointment)$this->error("单据不存在");
|
|
|
$car->update(["status"=>1,"delivery_time"=>date("Y-m-d H:i:s")]);
|
|
|
if (Carbon::now()->gt(Carbon::parse($car->deliveryAppointment->appointment_date." ".explode("-",DeliveryAppointment::PERIOD[$car->deliveryAppointment->date_period])[1].":00:00"))){
|
|
|
- $available = app("DeliveryAppointmentService")->getAvailableCapacity($car->deliveryAppointment->appointment_date,$car->deliveryAppointment->date_period,$car->deliveryAppointment->warehouse_id);
|
|
|
+ $available = app("DeliveryAppointmentService")->getAvailableCapacity(date("Y-m-d"),$period,$car->deliveryAppointment->warehouse_id);
|
|
|
if ($available<$car->deliveryAppointment->capacity)$this->error("仓库产能不足,请另择日期送货");
|
|
|
DeliveryAppointment::query()->where("id",$car->delivery_appointment_id)->update(["status" => 0]);
|
|
|
}
|