|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
namespace App\Services;
|
|
namespace App\Services;
|
|
|
|
|
|
|
|
|
|
+use App\Order;
|
|
|
use App\OwnerFeeDetail;
|
|
use App\OwnerFeeDetail;
|
|
|
use App\Services\common\BatchUpdateService;
|
|
use App\Services\common\BatchUpdateService;
|
|
|
use App\Services\common\QueryService;
|
|
use App\Services\common\QueryService;
|
|
@@ -277,4 +278,39 @@ class WaybillService
|
|
|
else OwnerFeeDetail::query()->create($obj);
|
|
else OwnerFeeDetail::query()->create($obj);
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 生成德邦单据
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param Order|\stdClass $order
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ */
|
|
|
|
|
+ public function createDbBill(Order $order)
|
|
|
|
|
+ {
|
|
|
|
|
+ $order->loadMissing("logistic");
|
|
|
|
|
+ if (!$order->logistic || substr($order->logistic->code,0,2) != 'DB')return;
|
|
|
|
|
+ if (Waybill::query()->selectRaw("1")->where("wms_bill_number",$order->code)->first())return;
|
|
|
|
|
+ $waybill = Waybill::query()->create([
|
|
|
|
|
+ 'type'=> "德邦物流",
|
|
|
|
|
+ 'waybill_number'=> Uuid::uuid1(),
|
|
|
|
|
+ 'owner_id'=> $order->owner_id,
|
|
|
|
|
+ 'wms_bill_number'=> $order->code,
|
|
|
|
|
+ 'destination'=> $order->address,
|
|
|
|
|
+ 'recipient'=> $order->consignee_name,
|
|
|
|
|
+ 'recipient_mobile'=>$order->consignee_phone,
|
|
|
|
|
+ 'source_bill'=> $order->client_code,
|
|
|
|
|
+ 'is_to_pay'=> strstr($order->logistic->code,'DF')===false ? 0 : 1,
|
|
|
|
|
+ 'destination_city_id'=>$order->city ? app(RegionService::class)->getCity($receiveInputting['C_City']) : null,
|
|
|
|
|
+ 'order_id'=> $order->id,
|
|
|
|
|
+ ]);
|
|
|
|
|
+ $waybill->update([
|
|
|
|
|
+ "waybill_number" => 'BSDB'.date ("ymd").str_pad($waybill->id>99999?$waybill->id%99999:$waybill->id,4,"0",STR_PAD_LEFT),
|
|
|
|
|
+ ]);
|
|
|
|
|
+ WaybillAuditLog::query()->create([
|
|
|
|
|
+ 'waybill_id'=>$waybill->id,
|
|
|
|
|
+ 'audit_stage'=>'创建',
|
|
|
|
|
+ 'user_id'=>Auth::id() ?? 0,
|
|
|
|
|
+ ]);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|