예제 #1
0
                    echo "[ HS_GATE_OUT ] {$conte} <br>";
                    // EDICODECO LOG
                    // $hoyX = date("Y-m-d H:i:s");
                    // $sql2 = "insert into EDICODECO_LOG (id_conte,eir,e_s,fec_trans,id_nav) values ('$idConte','$eir','S','$hoyX','$idNav')";
                    // $db2->query($sql2);
                }
            }
            $lin = "CNT+16:1'\r\n";
            fputs($fp2, $lin);
            $tlSegmentos++;
            // Ej. UNT+9+130101819301'
            $lin = "UNT+{$tlSegmentos}+1'\r\n";
            fputs($fp2, $lin);
            $lin = "UNZ+1+{$unbCodFin}'";
            fputs($fp2, $lin);
            // Cierre de archivo.
            fclose($fp2);
        }
        if (file_exists($fileEDIE) || file_exists($fileEDIS)) {
            // Se comenta, por que se esta probando. Att. Nestor.
            sendMail($fileEDIE, $fileEDIS, 'Hamburg Sud');
            // Envio por FTP a HS
            if (!empty($fileEDIE)) {
                sentToHSFTP($fileEDIE);
            }
            if (!empty($fileEDIS)) {
                sentToHSFTP($fileEDIS);
            }
        }
    }
}
예제 #2
0
     if (sentToHSFTP($fileEDIE) == 0) {
         // Si retorna "false" entonces regresa a 0 el campo flg_edicodeco en tabla ENTRADA.
         // 2 = Listo para enviar a FTP
         // 1 = Enviado.
         // 0 = No enviado.
         $sql = "update ENTRADA set flg_edicodeco='0' where flg_edicodeco='2' and id_naviera='{$idNav}' ";
         $db->query($sql);
         $flgFtpOK = 0;
     } else {
         $sql = "update ENTRADA set flg_edicodeco='1' where flg_edicodeco='2' and id_naviera='{$idNav}' ";
         $db->query($sql);
         $flgFtpOK = 1;
     }
 }
 if (!empty($fileEDIS)) {
     if (sentToHSFTP($fileEDIS) == 0) {
         // si existe error en el envio de FTP, debe regresar el valor a cero.
         $sql = "update SALIDA set flg_edicodeco='0' where flg_edicodeco='2' and id_naviera='{$idNav}' ";
         $db->query($sql);
         $flgFtpOK = 0;
     } else {
         // Si es exitoso el envio, entonces marcar a 1 el flg_edicodeco.
         $sql = "update SALIDA set flg_edicodeco='1' where flg_edicodeco='2' and id_naviera='{$idNav}' ";
         $db->query($sql);
         $flgFtpOK = 1;
     }
 }
 if ($flgFtpOK == 1) {
     sendMail($fileEDIE, $fileEDIS, 'Hamburg Sud');
 } elseif ($flgFtpOK == 0) {
     sendMailError("Hamburg Sud", "FTP Fallo la conexion");