Skip to content

Commit e782e1c

Browse files
author
lucaslioli
committed
Desfeitos os últimos 2 commits
1 parent 01bffd5 commit e782e1c

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

app/Nota.php

+8-9
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public static function store_nfce($key)
245245
// Verifica se Nota existe, se sim, pula para a próxima
246246
$nota = DB::table('notas')->where('chave_acesso', $key)->first();
247247
if(!is_null($nota)){
248-
echo "<br/>Nota fiscal já cadastrada. ".$nota->chave_acesso;
248+
// echo "<br/>Nota fiscal já cadastrada. ".$nota->chave_acesso;
249249
return "400";
250250
}
251251

@@ -276,13 +276,12 @@ public static function store_nfce($key)
276276
'telefone' => $data->estabelecimento->telefone
277277
]);
278278
} catch (\Illuminate\Database\QueryException $e) {
279-
echo "<br/>Falha ao cadastrar estabelecimento ".$data->estabelecimento->nome;
279+
// echo "<br/>Falha ao cadastrar estabelecimento ".$data->estabelecimento->nome;
280280
$ERROS++;
281281
}
282282
}
283283

284284
try {
285-
286285
$nota = Nota::create([
287286
'user_id' => 1,
288287
'estabelecimento_id' => $estabelecimento->id,
@@ -291,8 +290,8 @@ public static function store_nfce($key)
291290
'data_emissao' => $data->nfce->data_emissao,
292291
'hora_emissao' => $data->nfce->hora_emissao
293292
]);
294-
} catch (Exception $e) {
295-
echo "<br/>Falha ao cadastrar nota: ".$e;
293+
} catch (\Illuminate\Database\QueryException $e) {
294+
// echo "<br/>Falha ao cadastrar nota";
296295
$ERROS++;
297296
}
298297

@@ -318,7 +317,7 @@ public static function store_nfce($key)
318317
'ncm' => $produto->ncm
319318
]);
320319
} catch (\Illuminate\Database\QueryException $e) {
321-
echo "<br/>Falha ao cadastrar produto ".$produto->descricao." da nota ".$key;
320+
// echo "<br/>Falha ao cadastrar produto ".$produto->descricao." da nota ".$key;
322321
$ERROS++;
323322
break;
324323
}
@@ -329,7 +328,7 @@ public static function store_nfce($key)
329328
->where('id', $produto_result->id)
330329
->update(['valor' => $produto->valor]);
331330
} catch (\Illuminate\Database\QueryException $e) {
332-
echo "<br/>Falha ao atualizar produto ".$produto->descricao." da nota ".$nota->id." ERRO: ".$e;
331+
// echo "<br/>Falha ao atualizar produto ".$produto->descricao." da nota ".$nota->id." ERRO: ".$e;
333332
$ERROS++;
334333
break;
335334
}
@@ -339,11 +338,11 @@ public static function store_nfce($key)
339338

340339
if($ERROS){
341340
DB::rollback();
342-
echo "<br/>ERRO - ".$key."";
341+
// echo "<br/>ERRO - ".$key."";
343342
return "400";
344343
}else{
345344
DB::commit();
346-
echo "Ok - ".$key."<br/>";
345+
// echo "Ok - ".$key."<br/>";
347346
return "200";
348347
}
349348
}

0 commit comments

Comments
 (0)