|
|
@@ -58,49 +58,69 @@ class WaybillService
|
|
|
if ($param["recipient"] ?? false){
|
|
|
$recipient = $param["recipient"];
|
|
|
$waybills->where(function ($query)use($recipient){
|
|
|
- /** @var Builder $query */
|
|
|
- $query->where("waybills.recipient","like",$recipient."%")->orWhereHas("order",function ($query)use($recipient){
|
|
|
+ if (strpos($recipient, ',') || strpos($recipient, ',') || strpos($recipient, ' ')) {
|
|
|
+ $arr = array_filter(preg_split('/[,, ]+/is', $recipient));
|
|
|
/** @var Builder $query */
|
|
|
- $query->where("consignee_name",'like',$recipient."%");
|
|
|
- });
|
|
|
+ $query->whereIn("waybills.recipient",$arr)->orWhereHas("order",function ($query)use($arr){
|
|
|
+ /** @var Builder $query */
|
|
|
+ $query->whereIn("consignee_name",$arr);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ /** @var Builder $query */
|
|
|
+ $query->where("waybills.recipient","like",$recipient."%")->orWhereHas("order",function ($query)use($recipient){
|
|
|
+ /** @var Builder $query */
|
|
|
+ $query->where("consignee_name",'like',$recipient."%");
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
});
|
|
|
unset($param["recipient"]);
|
|
|
}
|
|
|
if ($param["recipient_mobile"] ?? false){
|
|
|
$recipientMobile = $param["recipient_mobile"];
|
|
|
$waybills->where(function ($query)use($recipientMobile){
|
|
|
- /** @var Builder $query */
|
|
|
- $query->where("waybills.recipient_mobile","like",$recipientMobile."%")->orWhereHas("order",function ($query)use($recipientMobile){
|
|
|
+ if (strpos($recipientMobile, ',') || strpos($recipientMobile, ',') || strpos($recipientMobile, ' ')) {
|
|
|
+ $arr = array_filter(preg_split('/[,, ]+/is', $recipientMobile));
|
|
|
/** @var Builder $query */
|
|
|
- $query->where("consignee_phone",'like',$recipientMobile."%");
|
|
|
- });
|
|
|
+ $query->whereIn("waybills.recipient_mobile",$arr)->orWhereHas("order",function ($query)use($arr){
|
|
|
+ /** @var Builder $query */
|
|
|
+ $query->whereIn("consignee_phone",$arr);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ /** @var Builder $query */
|
|
|
+ $query->where("waybills.recipient_mobile","like",$recipientMobile."%")->orWhereHas("order",function ($query)use($recipientMobile){
|
|
|
+ /** @var Builder $query */
|
|
|
+ $query->where("consignee_phone",'like',$recipientMobile."%");
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
});
|
|
|
unset($param["recipient_mobile"]);
|
|
|
}
|
|
|
|
|
|
- if($param['carrier_bill'] ?? false){ // 承运商单号
|
|
|
- $this->searchWay($waybills,$param['carrier_bill'],'waybills.carrier_bill');
|
|
|
- unset($param['carrier_bill']);
|
|
|
- }
|
|
|
- if($param['waybill_number'] ?? false) { // 运单号
|
|
|
- $this->searchWay($waybills,$param['waybill_number'],'waybills.waybill_number');
|
|
|
- unset($param['waybill_number']);
|
|
|
- }
|
|
|
- if($param['source_bill'] ?? false) {// 上游单号
|
|
|
- $this->searchWay($waybills,$param['source_bill'],'waybills.source_bill');
|
|
|
- unset($param['source_bill']);
|
|
|
- }
|
|
|
- if($param['wms_bill_number']?? false){ // wms单号
|
|
|
- $this->searchWay($waybills,$param['wms_bill_number'],'waybills.wms_bill_number');
|
|
|
- unset($param['wms_bill_number']);
|
|
|
- }
|
|
|
+// if($param['carrier_bill'] ?? false){ // 承运商单号
|
|
|
+// $this->searchWay($waybills,$param['carrier_bill'],'waybills.carrier_bill');
|
|
|
+// unset($param['carrier_bill']);
|
|
|
+// }
|
|
|
+// if($param['waybill_number'] ?? false) { // 运单号
|
|
|
+// $this->searchWay($waybills,$param['waybill_number'],'waybills.waybill_number');
|
|
|
+// unset($param['waybill_number']);
|
|
|
+// }
|
|
|
+// if($param['source_bill'] ?? false) {// 上游单号
|
|
|
+// $this->searchWay($waybills,$param['source_bill'],'waybills.source_bill');
|
|
|
+// unset($param['source_bill']);
|
|
|
+// }
|
|
|
+// if($param['wms_bill_number']?? false){ // wms单号
|
|
|
+// $this->searchWay($waybills,$param['wms_bill_number'],'waybills.wms_bill_number');
|
|
|
+// unset($param['wms_bill_number']);
|
|
|
+// }
|
|
|
$columnQueryRules=[
|
|
|
-// 'waybill_number' => ['like' => ''],
|
|
|
-// 'carrier_bill' => ['like' => ''],
|
|
|
-// 'wms_bill_number' => ['like' => ''],
|
|
|
- 'origination' => ['like' => ''],
|
|
|
-// 'source_bill' => ['like' => ''],
|
|
|
- 'car_owner_info' => ['like' => ''],
|
|
|
+ 'waybill_number' => ['batch' => ''],
|
|
|
+ 'carrier_bill' => ['batch' => ''],
|
|
|
+ 'wms_bill_number' => ['batch' => ''],
|
|
|
+ 'origination' => ['batch' => ''],
|
|
|
+ 'source_bill' => ['batch' => ''],
|
|
|
+ 'car_owner_info' => ['batch' => ''],
|
|
|
'created_at_start' => ['alias' => 'created_at' , 'startDate' => ':00'],
|
|
|
'created_at_end' => ['alias' => 'created_at' , 'endDate' => ':59'],
|
|
|
'uriType' => ['alias' => 'type'],
|