|
|
@@ -30,174 +30,171 @@ use Zttp\Zttp;
|
|
|
|
|
|
class TestController extends Controller
|
|
|
{
|
|
|
- private $data=[];
|
|
|
+ private $data = [];
|
|
|
+
|
|
|
public function __construct()
|
|
|
{
|
|
|
- $this->data["active_test"]="active";
|
|
|
+ $this->data["active_test"] = "active";
|
|
|
}
|
|
|
- public function method(Request $request,$method)
|
|
|
+
|
|
|
+ public function method(Request $request, $method)
|
|
|
{
|
|
|
- return call_user_func([$this, $method],$request);
|
|
|
+ return call_user_func([$this, $method], $request);
|
|
|
}
|
|
|
- function packageFromLog(Request $request){ //x $packagesBatch=Package::where('batch_number',$batch_number)->first();
|
|
|
-
|
|
|
- ini_set('max_execution_time',2500);
|
|
|
- ini_set('memory_limit','1526M');
|
|
|
- $uploaded=0;
|
|
|
- $count=DB::table('logs')->where('operation','like',"%PackageController::new_%" )
|
|
|
- ->where('created_at','>',"2020-06-08 15:46:00")
|
|
|
- ->where('created_at','<',"2020-06-08 15:47:00")
|
|
|
- ->where('type',"request_new_")
|
|
|
+
|
|
|
+ function packageFromLog(Request $request)
|
|
|
+ { //x $packagesBatch=Package::where('batch_number',$batch_number)->first();
|
|
|
+
|
|
|
+ ini_set('max_execution_time', 2500);
|
|
|
+ ini_set('memory_limit', '1526M');
|
|
|
+ $uploaded = 0;
|
|
|
+ $count = DB::table('logs')->where('operation', 'like', "%PackageController::new_%")
|
|
|
+ ->where('created_at', '>', "2020-06-08 15:46:00")
|
|
|
+ ->where('created_at', '<', "2020-06-08 15:47:00")
|
|
|
+ ->where('type', "request_new_")
|
|
|
->count();
|
|
|
- $requests=DB::table('logs')->where('operation','like',"%PackageController::new_%" )
|
|
|
- ->where('created_at','>',"2020-06-08 15:46:00")
|
|
|
- ->where('created_at','<',"2020-06-08 15:47:00")
|
|
|
- ->where('type',"request_new_")
|
|
|
+ $requests = DB::table('logs')->where('operation', 'like', "%PackageController::new_%")
|
|
|
+ ->where('created_at', '>', "2020-06-08 15:46:00")
|
|
|
+ ->where('created_at', '<', "2020-06-08 15:47:00")
|
|
|
+ ->where('type', "request_new_")
|
|
|
->get();
|
|
|
- $requests->each(function($request)use(&$uploaded){
|
|
|
- $requestJson=json_decode($request->description,true);
|
|
|
- $response = Zttp::withHeaders([ 'content-type' => 'application/json',
|
|
|
+ $requests->each(function ($request) use (&$uploaded) {
|
|
|
+ $requestJson = json_decode($request->description, true);
|
|
|
+ $response = Zttp::withHeaders(['content-type' => 'application/json',
|
|
|
])->post('https://was.baoshi56.com/api/thirdPart/flux/package/new',
|
|
|
$requestJson
|
|
|
);
|
|
|
- if($response->json()&&$response->json()['response']&&$response->json()['response']['flag']=='Y')
|
|
|
- $uploaded+=1;
|
|
|
+ if ($response->json() && $response->json()['response'] && $response->json()['response']['flag'] == 'Y')
|
|
|
+ $uploaded += 1;
|
|
|
});
|
|
|
- dd($uploaded.'/'.$count);
|
|
|
+ dd($uploaded . '/' . $count);
|
|
|
|
|
|
|
|
|
}
|
|
|
- function t2(Request $request){ //x $packagesBatch=Package::where('batch_number',$batch_number)->first();
|
|
|
-
|
|
|
- $uploaded=0;
|
|
|
- $count=DB::table('logs')->where('operation','like',"%PackageController::new_%" )
|
|
|
- ->where('created_at','>',"2020-06-03 14:02:00")
|
|
|
- ->where('created_at','<',"2020-06-03 15:05:00")
|
|
|
- ->where('type',"request_new_")
|
|
|
- ->where('description','like',"%W200603000117%")
|
|
|
+
|
|
|
+ function t2(Request $request)
|
|
|
+ { //x $packagesBatch=Package::where('batch_number',$batch_number)->first();
|
|
|
+
|
|
|
+ $uploaded = 0;
|
|
|
+ $count = DB::table('logs')->where('operation', 'like', "%PackageController::new_%")
|
|
|
+ ->where('created_at', '>', "2020-06-03 14:02:00")
|
|
|
+ ->where('created_at', '<', "2020-06-03 15:05:00")
|
|
|
+ ->where('type', "request_new_")
|
|
|
+ ->where('description', 'like', "%W200603000117%")
|
|
|
->count();
|
|
|
- $requests=DB::table('logs')->where('operation','like',"%PackageController::new_%" )
|
|
|
- ->where('created_at','>',"2020-06-03 14:02:00")
|
|
|
- ->where('created_at','<',"2020-06-03 15:05:00")
|
|
|
- ->where('description','like',"%W200603000117%")
|
|
|
- ->where('type',"request_new_")
|
|
|
+ $requests = DB::table('logs')->where('operation', 'like', "%PackageController::new_%")
|
|
|
+ ->where('created_at', '>', "2020-06-03 14:02:00")
|
|
|
+ ->where('created_at', '<', "2020-06-03 15:05:00")
|
|
|
+ ->where('description', 'like', "%W200603000117%")
|
|
|
+ ->where('type', "request_new_")
|
|
|
->get();
|
|
|
- $requests->each(function($request)use(&$uploaded){
|
|
|
- $requestJson=json_decode($request->description,true);
|
|
|
- $response = Zttp::withHeaders([ 'content-type' => 'application/json',
|
|
|
+ $requests->each(function ($request) use (&$uploaded) {
|
|
|
+ $requestJson = json_decode($request->description, true);
|
|
|
+ $response = Zttp::withHeaders(['content-type' => 'application/json',
|
|
|
])->post('https://was.baoshi56.com/api/thirdPart/flux/package/new',
|
|
|
$requestJson
|
|
|
);
|
|
|
- if($response->json()&&$response->json()['response']&&$response->json()['response']['flag']=='Y')
|
|
|
- $uploaded+=1;
|
|
|
+ if ($response->json() && $response->json()['response'] && $response->json()['response']['flag'] == 'Y')
|
|
|
+ $uploaded += 1;
|
|
|
});
|
|
|
- dd($uploaded.'/'.$count);
|
|
|
+ dd($uploaded . '/' . $count);
|
|
|
|
|
|
|
|
|
}
|
|
|
- function tj(Request $request){
|
|
|
- $waybills=Waybill::where('created_at','like','%2020-05-25%')->orWhere('created_at','like','%2020-05-30%')->get();
|
|
|
- $controller=(new WaybillController());
|
|
|
- $waybills->each(function ($waybill)use($controller){
|
|
|
+
|
|
|
+ function tj(Request $request)
|
|
|
+ {
|
|
|
+ $waybills = Waybill::where('created_at', 'like', '%2020-05-25%')->orWhere('created_at', 'like', '%2020-05-30%')->get();
|
|
|
+ $controller = (new WaybillController());
|
|
|
+ $waybills->each(function ($waybill) use ($controller) {
|
|
|
$controller->accomplishToWMS($waybill);
|
|
|
});
|
|
|
dd($waybills->count());
|
|
|
}
|
|
|
- function injectJS(Request $request){
|
|
|
- $items=RejectedBillItem::whereHas('rejectedBill',function($query){
|
|
|
- return $query->where('id_owner',2);
|
|
|
- })->where('created_at','>','2019-12-23 18:11:00')->where('created_at','<','2019-12-24 11:25:00')->get();
|
|
|
+
|
|
|
+ function injectJS(Request $request)
|
|
|
+ {
|
|
|
+ $items = RejectedBillItem::whereHas('rejectedBill', function ($query) {
|
|
|
+ return $query->where('id_owner', 2);
|
|
|
+ })->where('created_at', '>', '2019-12-23 18:11:00')->where('created_at', '<', '2019-12-24 11:25:00')->get();
|
|
|
(new RejectedBillItemController())->collectionsToPackConfirm($items);
|
|
|
}
|
|
|
+
|
|
|
public function tj2(Request $request)
|
|
|
{
|
|
|
$rejected = Rejected::find(10);
|
|
|
- $rejectedJianshang=new \App\Http\Controllers\api\jianshang\RejectedController();
|
|
|
- dd( $rejectedJianshang->sendRejected($rejected));
|
|
|
+ $rejectedJianshang = new \App\Http\Controllers\api\jianshang\RejectedController();
|
|
|
+ dd($rejectedJianshang->sendRejected($rejected));
|
|
|
}
|
|
|
+
|
|
|
public function excelIt()
|
|
|
{
|
|
|
- $excel=new ExcelController();
|
|
|
+ $excel = new ExcelController();
|
|
|
return $excel->makeExcel();
|
|
|
}
|
|
|
+
|
|
|
public function featureIt()
|
|
|
{
|
|
|
- LogisticNumberFeatureController::loadRecentRejectedsToFeatures(5,2500);
|
|
|
+ LogisticNumberFeatureController::loadRecentRejectedsToFeatures(5, 2500);
|
|
|
}
|
|
|
+
|
|
|
public function newSku()
|
|
|
{
|
|
|
- $url='http://bswcs/api/sorting/flux/newSku';
|
|
|
+ $url = 'http://bswcs/api/sorting/flux/newSku';
|
|
|
$response = Zttp::post($url, [
|
|
|
- 'request'=>[
|
|
|
+ 'request' => [
|
|
|
[
|
|
|
- "SKU"=> "1234567890",
|
|
|
- "NAME"=> "瑞士莲**巧克力",
|
|
|
- "Alternate_SKU1"=> "1122334455",
|
|
|
- "GrossWeight"=> "1.2",
|
|
|
- "Cube"=> "0.75",
|
|
|
- "SKULength"=> "0.25",
|
|
|
- "SKUWidth"=> "0.15",
|
|
|
- "SKUHigh"=> "0.05"
|
|
|
+ "SKU" => "1234567890",
|
|
|
+ "NAME" => "瑞士莲**巧克力",
|
|
|
+ "Alternate_SKU1" => "1122334455",
|
|
|
+ "GrossWeight" => "1.2",
|
|
|
+ "Cube" => "0.75",
|
|
|
+ "SKULength" => "0.25",
|
|
|
+ "SKUWidth" => "0.15",
|
|
|
+ "SKUHigh" => "0.05"
|
|
|
],
|
|
|
[
|
|
|
- "SKU"=> "1234567892",
|
|
|
- "NAME"=> "跳跳饼",
|
|
|
- "Alternate_SKU1"=> "",
|
|
|
- "GrossWeight"=> "1.3",
|
|
|
- "Cube"=> "0.75",
|
|
|
- "SKULength"=> "0.25",
|
|
|
- "SKUWidth"=> "0.15",
|
|
|
- "SKUHigh"=> "0.25"
|
|
|
+ "SKU" => "1234567892",
|
|
|
+ "NAME" => "跳跳饼",
|
|
|
+ "Alternate_SKU1" => "",
|
|
|
+ "GrossWeight" => "1.3",
|
|
|
+ "Cube" => "0.75",
|
|
|
+ "SKULength" => "0.25",
|
|
|
+ "SKUWidth" => "0.15",
|
|
|
+ "SKUHigh" => "0.25"
|
|
|
],
|
|
|
]
|
|
|
]);
|
|
|
return $response->json();
|
|
|
}
|
|
|
|
|
|
- public function changePackage(){
|
|
|
- $packages=Package::where('delivery_number','<>',null)->where('logistic_id',null)->get();
|
|
|
+ public function changePackage()
|
|
|
+ {
|
|
|
+ $packages = Package::where('delivery_number', '<>', null)->where('logistic_id', null)->get();
|
|
|
dd($packages);
|
|
|
- $packages=Package::whereRaw('delivery_number IS NOT NULL AND logistic_id IS NULL')->get();
|
|
|
- $logistics=Logistic::get();
|
|
|
- $packages->each(function ($package)use($logistics){
|
|
|
- $logistics->each(function ($logistic)use($package){
|
|
|
- if ($package->WMSReflectPackage->CarrierID==$logistic->code){
|
|
|
- $package->logistic_id=$logistic->id;
|
|
|
+ $packages = Package::whereRaw('delivery_number IS NOT NULL AND logistic_id IS NULL')->get();
|
|
|
+ $logistics = Logistic::get();
|
|
|
+ $packages->each(function ($package) use ($logistics) {
|
|
|
+ $logistics->each(function ($logistic) use ($package) {
|
|
|
+ if ($package->WMSReflectPackage->CarrierID == $logistic->code) {
|
|
|
+ $package->logistic_id = $logistic->id;
|
|
|
return;
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
return "OK";
|
|
|
}
|
|
|
- public function tNull(){
|
|
|
+
|
|
|
+ public function tNull()
|
|
|
+ {
|
|
|
}
|
|
|
|
|
|
public function deletePackageAuthority()
|
|
|
{
|
|
|
- $authorities=Authority::where('name','like','%包裹信息%')->get();
|
|
|
- $authorities->each(function ($authority){
|
|
|
+ $authorities = Authority::where('name', 'like', '%包裹信息%')->get();
|
|
|
+ $authorities->each(function ($authority) {
|
|
|
$authority->delete();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- function test($l1,$l2){
|
|
|
- if ($l1 === null) return $l2;
|
|
|
- if ($l2 === null) return $l1;
|
|
|
-
|
|
|
- if ($l1->val < $l2->val) {
|
|
|
- $l1->next = $this->test($l1->next, $l2);
|
|
|
- return $l1;
|
|
|
- } else {
|
|
|
- $l2->next = $this->test($l1, $l2->next);
|
|
|
- return $l2;
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-class ListNode {
|
|
|
- public $val = 0;
|
|
|
- public $next = null;
|
|
|
- function __construct($val = 0, $next = null) {
|
|
|
- $this->val = $val;
|
|
|
- $this->next = $next;
|
|
|
- }
|
|
|
}
|