with(['storeItems.store', 'warehouse', 'owner'])->where('is_fast_stored', '无')->orderBy('id', 'DESC'); $columnQueryRules = [ 'asn_code' => ['batch' => ''], 'remark' => ['batch' => '','timeLimit' => 15], 'created_at_start' => ['alias' => 'created_at', 'startDate' => ' 00:00:00'], 'created_at_end' => ['alias' => 'created_at', 'endDate' => ' 23:59:59'], 'owner' => ['alias' => 'owner_id','multi' => ','], 'warehouse' => ['alias' => 'warehouse_id','multi' => ','], 'status' => ['multi' => ','], 'stored_method' => ['multi' => ','], 'id' => ['multi' => ','] ]; $stores = app(QueryService::class)->query($params, $stores, $columnQueryRules, 'stores'); return $stores; } public function paginate(array $params) { return $this->conditionQuery($params)->paginate($params['paginate'] ?? 50); } public function create(array $params) { return Store::query()->create($params); } public function storeCreateByWms() { $created_at = config('sync.asn_sync.created_at'); $create_set = config('sync.asn_sync.cache_prefix.create_set'); $create_keys = config('sync.asn_sync.cache_prefix.create_keys'); $create_key = config('sync.asn_sync.cache_prefix.create'); /** @var OracleDocAsnHerderService $oracleDocAsnHerderService */ $oracleDocAsnHerderService = app(OracleDocAsnHerderService::class); $last_time = $this->getAsnLastSyncAt($created_at, 'create'); $asnHerders = $oracleDocAsnHerderService->getWmsAsnOnStartDateCreate($last_time); if (count($asnHerders)<1) return; $last_time = $asnHerders->first()['addtime']; $last_records = $asnHerders->where('addtime', $last_time); $this->createStore($asnHerders); $this->createStoreRejected($asnHerders); $this->deleteCacheKey($create_set, $create_keys); $this->setLastRecordsByRedis($create_key, $create_set, $create_keys, $last_records); $this->setAsnLastSyncAt($created_at, $last_time); } public function storeUpdateByWms() { $updated_at = config('sync.asn_sync.updated_at'); $update_set = config('sync.asn_sync.cache_prefix.update_set'); $update_keys = config('sync.asn_sync.cache_prefix.update_keys'); $update_key = config('sync.asn_sync.cache_prefix.update'); /** @var OracleDocAsnHerderService $oracleDocAsnHerderService */ $oracleDocAsnHerderService = app(OracleDocAsnHerderService::class); $last_time = $this->getAsnLastSyncAt($updated_at, 'update'); $asnHerders = $oracleDocAsnHerderService->getWmsAsnOnStartDateEdit($last_time); if (count($asnHerders)<1) return; $last_time = $asnHerders->first()['edittime']; $last_records = $asnHerders->where('edittime', $last_time); $this->createStore($asnHerders,"update"); $this->updateStore($asnHerders); $this->createStoreRejected($asnHerders); $this->deleteCacheKey($update_set, $update_keys); $this->setLastRecordsByRedis($update_key, $update_set, $update_keys, $last_records); $this->setAsnLastSyncAt($updated_at, $last_time); } public function createStore($asnHerders,$isUpdate=null) { if (!$asnHerders) return null; /** @var OwnerService $ownerService */ $ownerService = app(OwnerService::class); $owner_codes = []; $warehouse_codes = []; foreach ($asnHerders as $asnHerder) { if (!empty($asnHerder['customerid'])) $owner_codes[$asnHerder['customerid']] = $asnHerder['customerid']; if (!empty($asnHerder['warehouseid'])) $warehouse_codes[$asnHerder['warehouseid']] = $asnHerder['warehouseid']; } $owners = $ownerService->getOwnerByCodes($owner_codes); $warehouses = Warehouse::query()->get(); $owners_code_map=[]; foreach ($owners as $owner) { $owners_code_map[$owner->code] = $owner; } $warehouses_code_map=[]; foreach ($warehouses as $warehouse) { $warehouses_code_map[$warehouse->code] = $warehouse; } $params = $this->getParamsByAsnHeader($asnHerders, $owners_code_map, $warehouses_code_map); if (count($params) > 0) $this->insertStore($params); /** @var StoreItemService $storeItemService */ $storeItemService = app(StoreItemService::class); $storeItemService->storeItemCreateByWms($asnHerders); /** @var RejectedBillService $rejectedBillService */ $rejectedBillService = app(RejectedBillService::class); $rejectedBillService->syncLoadedStatusByAsnHerder($asnHerders); if (!$isUpdate)$this->pushJob($asnHerders); unset($asnHerders, $owners_code_map, $warehouses_code_map); } public function getParamsByAsnHeader($asnHerders, $owners_code_map, $warehouses_code_map) { $params = []; $stores = Store::query()->whereIn('asn_code', data_get($asnHerders, '*.asnno'))->get(); $store_asn_code_map = []; foreach ($stores as $store) { $store_asn_code_map[$store->asn_code] = $store; } foreach ($asnHerders as $asnHerder) { if ($store_asn_code_map[$asnHerder->asnno] ?? false) continue; $owner = $owners_code_map[$asnHerder->customerid] ?? null; $warehouse = $warehouses_code_map[$asnHerder->warehouseid] ?? null; $status = null; if ($asnHerder->asnStatus && $asnHerder->asnStatus->codename_c == '完全收货') $status = '已入库'; if ($asnHerder->asnStatus && $asnHerder->asnStatus->codename_c == '订单创建') $status = '未入库'; $params[] = [ 'asn_code' => $asnHerder->asnno, 'warehouse_id' => $warehouse->id ?? null, 'owner_id' => $owner->id ?? null, 'stored_method' => $asnHerder->asnType ? $asnHerder->asnType->codename_c : '', 'status' => $status ? $status : $asnHerder->asnStatus->codename_c, 'remark' => $asnHerder->notes ?? null, 'created_at' => $asnHerder->addtime ?? null, 'updated_at' => $asnHerder->edittime ?? null, ]; } return $params; } public function insertStore(array $params) { if (count($params) === 0) return; foreach (array_chunk($params, 1000) as $item) { try { $bool = $this->insert($item); if ($bool) { app('LogService')->log(__METHOD__, __FUNCTION__, "批量创建 store success " . count($item) . ' || ' . json_encode($item)); } else app('LogService')->log(__METHOD__, __FUNCTION__, "批量添加 store FAILED " . ' || ' . json_encode($item)); } catch (\Exception $e) { app('LogService')->log(__METHOD__, __FUNCTION__, "批量添加 store ERROR " . ' || ' . json_encode($params) . ' || ' . json_encode($e->getMessage()) . ' || ' . json_encode($e->getTraceAsString())); } } } public function updateStore($asnHerders) { if (!$asnHerders || $asnHerders->count() == 0) return null; /** * @var DataHandlerService $dataHandlerService * @var OwnerService $ownerService */ $ownerService = app(OwnerService::class); $dataHandlerService = app(DataHandlerService::class); $stores = $this->getByWms($asnHerders); $store_asn_code_map = $dataHandlerService->dataHeader(['asn_code'], $stores); $owners = $ownerService->getOwnerByCodes(array_unique(data_get($asnHerders,'*.customerid'))); $warehouses = Warehouse::query()->get(); $owner_code_map = $dataHandlerService->dataHeader(['code'], $owners); $warehouses_map = $dataHandlerService->dataHeader(['code'], $warehouses); $updateParams = [[ 'id', 'asn_code', 'warehouse_id', 'owner_id', 'stored_method', 'status', 'remark', 'updated_at' ]]; foreach ($asnHerders as $asnHerder) { $store = $dataHandlerService->getKeyValue(['asn_code' => $asnHerder->asnno], $store_asn_code_map); if (!$store) continue; $owner = $dataHandlerService->getKeyValue(['code' => $asnHerder->customerid], $owner_code_map); $warehouse = $dataHandlerService->getKeyValue(['code' => $asnHerder->warehouseid], $warehouses_map); $owner_id = $owner->id ?? null; $warehouse_id = $warehouse->id ?? null; $status = null; if ($asnHerder->asnStatus && $asnHerder->asnStatus->codename_c == '完全收货') $status = '已入库'; if ($asnHerder->asnStatus && $asnHerder->asnStatus->codename_c == '订单创建') $status = '未入库'; if ($store->asn_code != $asnHerder->asnno || $store->warehouse_id != $warehouse_id || $store->owner_id != $owner_id || $store->stored_method != ($asnHerder->asnType->codename_c ??'')|| $store->status != ($asnHerder->asnStatus->codename_c ?? '')|| $store->remark != $asnHerder->notes || $store->updated_at != $asnHerder->edittime) { $updateParams[] = [ 'id' => $store->id, 'asn_code' => $asnHerder->asnno, 'warehouse_id' => $warehouse_id, 'owner_id' => $owner_id, 'stored_method' => $asnHerder->asnType ? $asnHerder->asnType->codename_c : '', 'status' => $status ? $status : $asnHerder->asnStatus->codename_c, 'remark' => $asnHerder->notes, 'updated_at' => $asnHerder->edittime, ]; } } if (count($updateParams) > 1) { foreach (array_chunk($updateParams, 1000) as $item) { try { $bool=$this->batchUpdate($item); if ($bool) { app('LogService')->log(__METHOD__, __FUNCTION__, "批量修改 store success " . count($item) . ' || ' . json_encode($item)); } else app('LogService')->log(__METHOD__, __FUNCTION__, "批量修改 store FAILED " . ' || ' . json_encode($item)); } catch (\Exception $e) { app('LogService')->log(__METHOD__, __FUNCTION__, "批量修改 store ERROR " . ' || ' . json_encode($updateParams) . ' || ' . json_encode($e->getMessage()) . ' || ' . json_encode($e->getTraceAsString())); } } } /** @var StoreItemService $storeItemService */ $storeItemService = app(StoreItemService::class); $storeItemService->storeItemUpdateByWms($asnHerders); /** @var RejectedBillService $rejectedBillService */ $rejectedBillService = app(RejectedBillService::class); $rejectedBillService->syncLoadedStatusByAsnHerder($asnHerders); $this->pushJob($asnHerders); unset($updateParams, $asnHerders); } public function pushJob($asnHerders){ dispatch(new StoreCreateInstantBill(Store::query()->with(["storeItems"])->where('status','已入库')->whereIn('asn_code', data_get($asnHerders,'*.asnno'))->get())); } public function insert($params) { return Store::query()->insert($params); } public function batchUpdate($params) { return app(BatchUpdateService::class)->batchUpdate('stores', $params); } public function getByWms($asnHerders) { if (!$asnHerders) { return null; } $asn_nos = array_unique(data_get($asnHerders, '*.asnno')); return Store::query()->whereIn('asn_code', $asn_nos)->get(); } public function getAsnLastSyncAt($key, $type) { $last_time = ValueStore::query()->where('name', $key)->value('value'); if ($last_time) return $last_time; if ($type == 'create') { $store = Store::query()->orderByDesc('created_at')->first(); if ($store) return $store->created_at; } else { $store = Store::query()->orderByDesc('updated_at')->first(); if ($store) return $store->updated_at; } return Carbon::now()->subSeconds(65); } public function setAsnLastSyncAt($key, $last_time) { $asnLastSyncAt = ValueStore::query()->updateOrCreate([ 'name' => $key, ], [ 'name' => $key, 'value' => $last_time, ]); LogService::log(__METHOD__, __FUNCTION__, '修改或更新' . $key . json_encode($asnLastSyncAt)); return $asnLastSyncAt; } public function deleteCacheKey($set, $keys) { if (Cache::get($set)) { $cacheKeys = Cache::get($keys); if (!$cacheKeys) return; foreach ($cacheKeys as $cacheKey) { Cache::forget($cacheKey); } Cache::forget($keys); } } public function setLastRecordsByRedis($prefixKey, $set, $keys, $last_records) { $cacheKeys = []; foreach ($last_records as $last_record) { Cache::put($prefixKey . $last_record->customerid . '_' . $last_record->asnno, true); array_push($cacheKeys, $prefixKey . $last_record->customerid . '_' . $last_record->asnno); } Cache::put($keys, $cacheKeys); Cache::put($set, true); } public function createInstantBill(Store $store): bool { /** @var \stdClass $store */ if (!$store || $store->status != "已入库") return false; if (Cache::has("owner_fee_details:stores_".$store->id))return true; $store->loadMissing(["storeItems.commodity","warehouse"]); /** @var OwnerPriceOperationService $service */ $service = app("OwnerPriceOperationService"); list($id,$money,$taxFee) = $service->matching($store, Feature::MAPPING["store"], $store->owner_id, "入库"); if (app("OwnerFeeDetailService")->create([ "owner_id" => $store->owner_id, "worked_at" => $store->updated_at, "type" => "收货", "operation_bill" => $store->asn_code, "commodity_amount" => array_sum(array_column($store->storeItems->toArray(), "amount")), "work_fee" => $money, "owner_price_operation_id" => $id, "created_at" => date('Y-m-d H:i:s'), "outer_id" => $store->id, "outer_table_name" => "stores", "work_tax_fee" => $taxFee, ])){ $amount = 0; if ($store->storeItems)foreach ($store->storeItems as $item)$amount += $item->amount; $this->setStoreAmount($store->owner_id,$amount); Cache::put("owner_fee_details:stores_".$store->id,1,86400); return true; } return false; } public function createStoreRejected($asnHerders){ if (!$asnHerders) return null; $stores = $this->getByWms($asnHerders); $orders = Order::query()->whereIn('client_code', data_get($asnHerders, '*.asnreference2'))->get(); $store_rejecteds=StoreRejected::query()->whereIn('order_id',data_get($orders,'*.id'))->whereIn('store_id',data_get($stores,'*.id'))->get(); /** @var DataHandlerService $dataHandlerService */ $dataHandlerService = app(DataHandlerService::class); $order_map = $dataHandlerService->dataHeader(['client_code'], $orders); $store_map = $dataHandlerService->dataHeader(['asn_code'], $stores); $store_rejected_map=$dataHandlerService->dataHeader(['store_id','order_id','logistic_number_return'],$store_rejecteds); $insert_param=[]; foreach ($asnHerders as $asnHerder){ if (!$asnHerder->asnreference2) continue; $order=$dataHandlerService->getKeyValue(['client_code'=>$asnHerder->asnreference2],$order_map); $store=$dataHandlerService->getKeyValue(['asn_code'=>$asnHerder->asnno],$store_map); if (!$order || !$store)continue; $store_rejected=$dataHandlerService->getKeyValue(['store_id'=>$store->id,'order_id'=>$order->id,'logistic_number_return'=>$asnHerder->asnreference3],$store_rejected_map); if ($store_rejected) continue; $insert_param[]=[ 'store_id'=>$store->id, 'order_id'=>$order->id, 'logistic_number_return'=>$asnHerder->asnreference3 ?? '', 'created_at'=>Carbon::now()->toDateTimeString(), ]; } if (count($insert_param)>0) StoreRejected::query()->insert($insert_param); } /** * 入库件数丢失补偿逻辑 * * @param int $owner */ private function storeAmountCompensationLogic($owner) { $query = DB::raw(<<total ? $statistics->total : 0,2764800); } /** * 设置货主下的本月入库件数 * * @param int $owner * @param int $amount */ public function setStoreAmount($owner, $amount) { $date = date("Y-m"); if (!Cache::has($date."|A|".$owner))$this->storeAmountCompensationLogic($owner);//补偿逻辑 Cache::increment($date."|A|".$owner,$amount); } /** * 获取货主下的本月入库件数 * * @param int $owner * * @return int */ public function getStoreAmount($owner) { $date = date("Y-m"); if (!Cache::has($date."|A|".$owner))$this->storeAmountCompensationLogic($owner); return Cache::get($date."|A|".$owner); } public function warehousing(array $params) { $conn = oci_connect(config('database.connections.oracle.username'), config('database.connections.oracle.password'), config('database.connections.oracle.host'). '/' . config('database.connections.oracle.service_name'),"utf8"); $sp = "begin SPASN_Receiving_Process(:IN_Warehouse, :In_Process_Action, :In_ASNNo_C, :In_ASNLineNo_C, :In_FMTraceID_C, :In_New_TraceID_C, :In_ProductStatus," . ":In_ProductStatus_Descr, :In_HoldRejectCode_C, :In_HoldRejectReason_C, :In_PONo_C, :In_CustomerID, :In_SKU, :In_ReceivedQty, :In_RejectedQty,:In_UOM, :In_PackID," . " :In_ContainerID, :In_LotAtt01_C, :In_LotAtt02_C, :In_LotAtt03_C, :In_LotAtt04_C, :In_LotAtt05_C, :In_LotAtt06_C," . ":In_LotAtt07_C, :In_LotAtt08_C, :In_LotAtt09_C, :In_LotAtt10_C, :In_LotAtt11_C, :In_LotAtt12_C," . ":In_TotalCubic, :In_TotalGrossWeight, :In_TotalNetWeight, :In_TotalPrice, :In_UserDefine1, :In_UserDefine2,:In_UserDefine3, :In_UserDefine4, :In_UserDefine5, :In_FMLocation," . ":In_TOLocation_C,:In_QC_Type_C, :In_PlanToLoc_C,:In_ReceivingTime, :In_LPN, :In_Operator, :IN_RCVModule, :IN_RCVStation, :In_Language, :In_UserID, :OUT_Return_Code); end;"; $inParams = array( "IN_Warehouse"=>"", "In_Process_Action"=>"", "In_ASNNo_C"=>"", "In_ASNLineNo_C"=>"", "In_FMTraceID_C"=>"", "In_New_TraceID_C"=>"", "In_ProductStatus"=>"00", "In_ProductStatus_Descr"=>"正常", "In_HoldRejectCode_C"=>"OK", "In_HoldRejectReason_C"=>"正常", "In_PONo_C"=>"", "In_CustomerID"=>"", "In_SKU"=>"", "In_ReceivedQty"=>"", "In_RejectedQty"=>"", "In_UOM"=>"EA", "In_PackID"=>"", "In_ContainerID"=>"", "In_LotAtt01_C"=>"", "In_LotAtt02_C"=>"", "In_LotAtt03_C"=>"", "In_LotAtt04_C"=>"", "In_LotAtt05_C"=>"", "In_LotAtt06_C"=>"", "In_LotAtt07_C"=>"", "In_LotAtt08_C"=>"", "In_LotAtt09_C"=>"", "In_LotAtt10_C"=>"", "In_LotAtt11_C"=>"", "In_LotAtt12_C"=>"", "In_TotalCubic"=>"0.00", "In_TotalGrossWeight"=>"0.00", "In_TotalNetWeight"=>"0.00", "In_TotalPrice"=>"0.00", "In_UserDefine1"=>"", "In_UserDefine2"=>"", "In_UserDefine3"=>"", "In_UserDefine4"=>"", "In_UserDefine5"=>"", "In_FMLocation"=>"", "In_TOLocation_C"=>"", "In_QC_Type_C"=>"OK", "In_PlanToLoc_C"=>"", "In_ReceivingTime"=>"", "In_LPN"=>"*", "In_Operator"=>"WCS", "IN_RCVModule"=>"", "IN_RCVStation"=>"", "In_Language"=>"cn", "In_UserID"=>"WCS", "result"=>"" ); foreach ($params as $key=>$val)$inParams[$key] = $val; list($IN_Warehouse,$In_Process_Action,$In_ASNNo_C,$In_ASNLineNo_C,$In_FMTraceID_C,$In_New_TraceID_C,$In_ProductStatus, $In_ProductStatus_Descr,$In_HoldRejectCode_C,$In_HoldRejectReason_C,$In_PONo_C,$In_CustomerID,$In_SKU,$In_ReceivedQty, $In_RejectedQty,$In_UOM,$In_PackID,$In_ContainerID,$In_LotAtt01_C,$In_LotAtt02_C,$In_LotAtt03_C,$In_LotAtt04_C,$In_LotAtt05_C, $In_LotAtt06_C,$In_LotAtt07_C,$In_LotAtt08_C,$In_LotAtt09_C,$In_LotAtt10_C,$In_LotAtt11_C,$In_LotAtt12_C,$In_TotalCubic, $In_TotalGrossWeight,$In_TotalNetWeight,$In_TotalPrice,$In_UserDefine1,$In_UserDefine2,$In_UserDefine3,$In_UserDefine4, $In_UserDefine5,$In_FMLocation,$In_TOLocation_C,$In_QC_Type_C,$In_PlanToLoc_C,$In_ReceivingTime,$In_LPN,$In_Operator, $IN_RCVModule,$IN_RCVStation,$In_Language,$In_UserID,$result) = array_values($inParams); $stmt = oci_parse($conn, $sp); oci_bind_by_name($stmt, ':IN_Warehouse', $IN_Warehouse); oci_bind_by_name($stmt, ':In_Process_Action', $In_Process_Action); oci_bind_by_name($stmt, ':In_ASNNo_C', $In_ASNNo_C); oci_bind_by_name($stmt, ':In_ASNLineNo_C', $In_ASNLineNo_C); oci_bind_by_name($stmt, ':In_FMTraceID_C', $In_FMTraceID_C); oci_bind_by_name($stmt, ':In_New_TraceID_C', $In_New_TraceID_C); oci_bind_by_name($stmt, ':In_ProductStatus', $In_ProductStatus); oci_bind_by_name($stmt, ':In_ProductStatus_Descr', $In_ProductStatus_Descr); oci_bind_by_name($stmt, ':In_HoldRejectCode_C', $In_HoldRejectCode_C); oci_bind_by_name($stmt, ':In_HoldRejectReason_C', $In_HoldRejectReason_C); oci_bind_by_name($stmt, ':In_PONo_C', $In_PONo_C); oci_bind_by_name($stmt, ':In_CustomerID', $In_CustomerID); oci_bind_by_name($stmt, ':In_SKU', $In_SKU); oci_bind_by_name($stmt, ':In_ReceivedQty', $In_ReceivedQty); oci_bind_by_name($stmt, ':In_RejectedQty', $In_RejectedQty); oci_bind_by_name($stmt, ':In_UOM', $In_UOM); oci_bind_by_name($stmt, ':In_PackID', $In_PackID); oci_bind_by_name($stmt, ':In_ContainerID', $In_ContainerID); oci_bind_by_name($stmt, ':In_LotAtt01_C', $In_LotAtt01_C); oci_bind_by_name($stmt, ':In_LotAtt02_C', $In_LotAtt02_C); oci_bind_by_name($stmt, ':In_LotAtt03_C', $In_LotAtt03_C); oci_bind_by_name($stmt, ':In_LotAtt04_C', $In_LotAtt04_C); oci_bind_by_name($stmt, ':In_LotAtt05_C', $In_LotAtt05_C); oci_bind_by_name($stmt, ':In_LotAtt06_C', $In_LotAtt06_C); oci_bind_by_name($stmt, ':In_LotAtt07_C', $In_LotAtt07_C); oci_bind_by_name($stmt, ':In_LotAtt08_C', $In_LotAtt08_C); oci_bind_by_name($stmt, ':In_LotAtt09_C', $In_LotAtt09_C); oci_bind_by_name($stmt, ':In_LotAtt10_C', $In_LotAtt10_C); oci_bind_by_name($stmt, ':In_LotAtt11_C', $In_LotAtt11_C); oci_bind_by_name($stmt, ':In_LotAtt12_C', $In_LotAtt12_C); oci_bind_by_name($stmt, ':In_TotalCubic', $In_TotalCubic); oci_bind_by_name($stmt, ':In_TotalGrossWeight', $In_TotalGrossWeight); oci_bind_by_name($stmt, ':In_TotalNetWeight', $In_TotalNetWeight); oci_bind_by_name($stmt, ':In_TotalPrice', $In_TotalPrice); oci_bind_by_name($stmt, ':In_UserDefine1', $In_UserDefine1); oci_bind_by_name($stmt, ':In_UserDefine2', $In_UserDefine2); oci_bind_by_name($stmt, ':In_UserDefine3', $In_UserDefine3); oci_bind_by_name($stmt, ':In_UserDefine4', $In_UserDefine4); oci_bind_by_name($stmt, ':In_UserDefine5', $In_UserDefine5); oci_bind_by_name($stmt, ':In_FMLocation', $In_FMLocation); oci_bind_by_name($stmt, ':In_TOLocation_C', $In_TOLocation_C); oci_bind_by_name($stmt, ':In_QC_Type_C', $In_QC_Type_C); oci_bind_by_name($stmt, ':In_PlanToLoc_C', $In_PlanToLoc_C); oci_bind_by_name($stmt, ':In_ReceivingTime', $In_ReceivingTime); oci_bind_by_name($stmt, ':In_LPN', $In_LPN); oci_bind_by_name($stmt, ':In_Operator', $In_Operator); oci_bind_by_name($stmt, ':IN_RCVModule', $IN_RCVModule); oci_bind_by_name($stmt, ':IN_RCVStation', $IN_RCVStation); oci_bind_by_name($stmt, ':In_Language', $In_Language); oci_bind_by_name($stmt, ':In_UserID', $In_UserID); oci_bind_by_name($stmt, ':OUT_Return_Code', $result,300); oci_execute($stmt); oci_close($conn); return $result; } }