|
|
@@ -27,6 +27,7 @@ use App\Events\SendEmailEvent;
|
|
|
use App\Exceptions\Exception;
|
|
|
use App\Http\Controllers\api\thirdPart\haiq\PickStationController;
|
|
|
use App\Http\Controllers\api\thirdPart\hengli\PackageController;
|
|
|
+use App\Http\Controllers\api\thirdPart\weight\WeightBaseController;
|
|
|
use App\Http\Requests\ForeignHaiRobotic_taskUpdateRequest;
|
|
|
use App\Http\Requests\TestAaRequest;
|
|
|
use App\Imports\OrderTrackingImport;
|
|
|
@@ -1286,4 +1287,60 @@ where purch.islower=1 and deliver.id>'.$id);
|
|
|
}
|
|
|
ProcurementCheckSheet::query()->insert($insert_);
|
|
|
}
|
|
|
+ public function testPro(){
|
|
|
+ /**@var SupplierService $supplierService*/
|
|
|
+ $supplierService=app(SupplierService::class);
|
|
|
+ $supplier_ids=$supplierService->screenSupplierIds();
|
|
|
+// $status=0;
|
|
|
+// $procurements=Procurement::query()
|
|
|
+// ->withCount('procurementQuotations')
|
|
|
+// ->with('ownerMaterial.material')
|
|
|
+// ->where('status',$status)
|
|
|
+// ->whereHas("ownerMaterial",function (Builder $query)use($supplier_ids){
|
|
|
+// $query->whereHas("material",function (Builder $query)use($supplier_ids){
|
|
|
+// $query->whereHas("supplier",function (Builder $query)use($supplier_ids){
|
|
|
+// $query->whereIn('id',$supplier_ids);
|
|
|
+// });
|
|
|
+// });
|
|
|
+// })
|
|
|
+// ->get();
|
|
|
+// $keys = [];
|
|
|
+// foreach ($procurements as $key=>$procurement){
|
|
|
+//// if ($procurement->procurement_quotations_count>0 && $status==0 )$keys[]= $key;
|
|
|
+// if ($procurement->type==2 && $procurement->supplier_id )$keys[]= $key;
|
|
|
+// if (Carbon::parse($procurement->deadline)->gt(Carbon::now())) $procurement->deadline=Carbon::parse($procurement->deadline)->diffInMilliseconds();
|
|
|
+// else $procurement->deadline=0;
|
|
|
+// }
|
|
|
+// $procurements = $procurements->diffKeys($keys);
|
|
|
+// dd($procurements);
|
|
|
+ $status=0;//0:待报价,2:待接单
|
|
|
+ $procurements=Procurement::query()
|
|
|
+ ->withCount('procurementQuotations')
|
|
|
+ ->with(['ownerMaterial.material','procurementQuotations'])
|
|
|
+ ->where('status',$status)
|
|
|
+ ->get();
|
|
|
+ dd($procurements);
|
|
|
+ $keys = [];
|
|
|
+ foreach ($procurements as $key=>$procurement){
|
|
|
+ if ($procurement->procurement_quotations_count>0 ){
|
|
|
+ foreach ($procurement->procurementQuotations as $procurementQuotation){
|
|
|
+ if (in_array($procurementQuotation->supplier_id,$supplier_ids))$keys[]= $key;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($procurement->type==2 && $procurement->supplier_id )$keys[]= $key;
|
|
|
+ if (Carbon::parse($procurement->deadline)->gt(Carbon::now())) $procurement->deadline=Carbon::parse($procurement->deadline)->diffInMilliseconds();
|
|
|
+ else $procurement->deadline=0;
|
|
|
+ }
|
|
|
+ $procurements = $procurements->diffKeys($keys);
|
|
|
+ dd($procurements);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function pushToWmsWeight()
|
|
|
+ {
|
|
|
+ $orderPackages = OrderPackage::query()->where('measuring_machine_id',12)->where('uploaded_to_wms','!=','是')->whereNotNull('weight')->get();
|
|
|
+ $packageController = new WeightBaseController();
|
|
|
+ foreach ($orderPackages as $orderPackage) {
|
|
|
+ $packageController->activityWaveNoProcessing($orderPackage);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|