data["active_test"] = "active"; } public function method(Request $request, $method) { try { return call_user_func([$this, $method], $request); }catch (\BadMethodCallException $e){ dd("方法不存在"); } } public function test(Request $request) { $sql = <<input("limit"); $mapper = [ "created_at"=>"日期","checked_numbers"=>"审核号", "owner_name"=>"客户名称","order_number"=>"订单号", "sender"=>"姓名","mobile_sender"=>"手机", "logistic_number"=>"原单单号","logistic_number_return"=>"退回单号","logistic_name"=>"退回公司", "fee_collected"=>"到付费用","loaded"=>"是否入库", "item_barcode"=>"商品条码","item_name"=>"商品名称", "item_amount"=>"商品数量","quality_label_name"=>"商品质量","item_remark"=>"备注","operator_name"=>"录入人","remark"=>"退单备注" ]; $column = array_values($mapper); $data = DB::select(DB::raw($sql." limit {$limit},10000")); if (count($data)==0){ dd("完成了"); } $list = []; foreach ($data as $item){ $list[] = [ $item->created_at, $item->checked_numbers, $item->owner_name, $item->order_number, $item->sender, $item->mobile_sender, $item->logistic_number, $item->logistic_number_return, $item->logistic_name, $item->fee_collected, $item->loaded, $item->item_barcode, $item->item_name, $item->item_amount, $item->quality_label_name, $item->item_remark, $item->operator_name, $item->remark, ]; } return Export::make($column,$list,"退货记录"); Log::error(json_encode($request->header(),JSON_UNESCAPED_UNICODE)); return json_encode($request->header(),JSON_UNESCAPED_UNICODE); } private function paramDefault($waybill):array { $update = []; if (!$waybill->order_type){ $update["order_type"] = $waybill->order_type = Waybill::ORDER_TYPE_DEFAULT; } if (!$waybill->transport_type){ $update["transport_type"] = $waybill->transport_type = "JZKH"; } if (!$waybill->cargo_name){ $update["cargo_name"] = $waybill->cargo_name = "补货"; } if (!$waybill->total_number){ $update["total_number"] = $waybill->total_number = 1; } if (!$waybill->total_weight){ $update["total_weight"] = $waybill->total_weight = 1; } if (!$waybill->package_service){ $update["package_service"] = $waybill->package_service = '托膜'; } if (!$waybill->deliveryType_id){ $update["deliveryType_id"] = $waybill->deliveryType_id = 3; } if (!$waybill->pay_type){ $update["pay_type"] = $waybill->pay_type = Waybill::PAY_TYPE_DEFAULT; } if (!$waybill->back_sign_bill){ $update["back_sign_bill"] = $waybill->back_sign_bill = Waybill::BACK_SIGN_BILL_DEFAULT; } return array($update,$waybill); } public function test(Request $request) { $waybill = Waybill::query()->where("waybill_number","BSDB2112284814") ->first(); $waybill->load("order"); if (!$waybill->order){ dd("德邦单号获取失败1"); return; } $update = $this->paramDefault($waybill); $waybill->update($update); $bill = app('DbOpenService')->getDbOrderNo($waybill); if (!$bill || $bill["result"]=="false"){ dd($bill); return; } $waybill->update([ "carrier_bill"=>$bill['mailNo'], "waybill_number"=>$bill['mailNo'], "station_no"=>$bill['stationNo'], "arrived_org_simple_name"=>$bill['arrivedOrgSimpleName'], "much_higher_delivery"=>$bill['muchHigherDelivery'], ]); if (!app("WaybillService")->notifyFlux($waybill)){ dd("德邦单号回传FLUX失败"); return; } dd(1); $c = "test"; $a = function ($b)use($c){ return $b.$c; }; $this->test1($a,"a"); dd(2); $w = Waybill::query()->get(); foreach ($w->chunk(50) as $a){ dd($a); } $path = ''; $id = 252; $file = fopen($path, "r"); $user=array(); $i=0; //输出文本中所有的行,直到文件结束为止。 while(! feof($file)){ $user[$i]= trim(fgets($file));//fgets()函数从文件指针中读取一行 $i++; } fclose($file); foreach ($user as $item){ $arr = explode(",",$item); if (count($arr)!=2){ dump($item); continue; } DB::table("details")->insert([ "name" => $arr[0], "size" => $arr[1], "created_at" => date("Y-m-d H:i:s"), "updated_at" => date("Y-m-d H:i:s"), "header_id" => $id ]); } } public function test123(){ $rejected_bill = RejectedBill::query()->find(2); $service = new WorkOrderService(); $service->syncWorkOrder($rejected_bill); } public function assignBatch($code) { $batches = Batch::query()->where("code",$code)->get(); if (!$batches->count()){ $wave = DB::connection("oracle")->selectOne(DB::raw("select * from DOC_WAVE_HEADER where WAVENO = ?"),[$code]); if (!$wave){ dd("FLUX无波次"); } $owner = app("OwnerService")->codeGetOwner($wave->customerid); $obj = [ "wms_status" => $this->wms_status($wave), "wms_type"=>$wave->descr, "created_at"=>date("Y-m-d H:i:s"), "wms_created_at"=>$wave->addtime, "updated_at"=>$wave->edittime, "owner_id"=>$owner->id, ]; $wave = Batch::query()->where("code",$code)->first(); if (!$wave){ $obj["code"] = $code; $wave = Batch::query()->create($obj); }else{ Batch::query()->where("code",$code)->update($obj); } $ordernos = array_column(DB::connection("oracle")->select(DB::raw("select orderno from DOC_WAVE_DETAILS where WAVENO = ?"),[$code]),"orderno"); Order::query()->whereIn("code",$ordernos)->update([ "batch_id"=>$wave->id ]); Order::query()->with(["batch","bin"])->whereIn("code",$ordernos)->get()->each(function ($order){ if (!$order->bin){ $bin = DB::connection("oracle")->selectOne(DB::raw("select seqno from DOC_WAVE_DETAILS where waveno = ? and orderno = ?"),[$order->batch->code,$order->code]); if ($bin){ OrderBin::query()->create([ 'order_id' => $order->id, 'number' => $bin->seqno, ]); } } }); $batches = Batch::query()->where("code",$code)->get(); } app("BatchService")->assignTasks($batches); } public function testRequest(Request $request){ return json_encode($request->header(),JSON_UNESCAPED_UNICODE) ; } }