Esempio n. 1
0
/**
 * @param $pnIdUtilisateur
 * @param $chk
 */
function getSuppPlanche($pnIdUtilisateur, $chk)
{
    $objSmartgang = new smartgang();
    $objSmartgang->getConDbo();
    //-- conn to dbo
    $objSmartgang->logFile(basename(__FILE__), __FUNCTION__, "RUN", "arg=>{$chk}");
    $data_planche = $objSmartgang->getDataPlanchToSupp($pnIdUtilisateur, $chk);
    if (is_array($data_planche) && count($data_planche) > 0) {
        foreach ($data_planche as $key => $arg) {
            $pnIdPlanche = intval($arg->IDPlanche);
            if (is_numeric($pnIdPlanche) && $pnIdPlanche > 0) {
                $qSql = "EXEC dbo.P_CommandeCommentaireInternePersoAjoute {$pnIdUtilisateur},{$pnIdPlanche},null,'planche detruite en attente amalgame'";
                $objSmartgang->execMsSql($qSql);
                $path = "http://" . $_SERVER['SERVER_ADDR'] . "/appli/smartgang/rollback.php?numero={$pnIdPlanche}";
                $url = "{$path}";
                $options = $objSmartgang->curlopt($url);
                //-- options cURL
                $ch = curl_init();
                curl_setopt_array($ch, $options);
                $content = curl_exec($ch);
                //-- exec cURL to url
                $objSmartgang->logFile(basename(__FILE__), __FUNCTION__, "EXE", "{$url}");
                if (curl_error($ch)) {
                    $objSmartgang->logFile(basename(__FILE__), __FUNCTION__, "ERR", "{$pnIdPlanche} | method cURLexec() : " . curl_error($ch) . $content);
                }
                //-- LOG
                $objSmartgang->logFile(basename(__FILE__), __FUNCTION__, "OK ", "{$pnIdPlanche}");
                curl_close($ch);
            }
        }
    }
    $objSmartgang->logFile(basename(__FILE__), __FUNCTION__, "END", "arg=>{$chk}");
}
Esempio n. 2
0
                //-- recuperation des infos de planches
                $objSmartgang->getPapierBrochure($pnIdCommande, $pnIdPlanche);
                //-- add format "BROCHURE" if needed
                $resu_info = $objSmartgang->getInfoPlanche($pnIdPlanche);
                //-- recup info planche
                $objSmartgang->getFicheFabV2($resu_info);
                //-- create Fiche de fab negoce PDF
                $objSmartgang->getXmlFile($pnIdPlanche);
                //-- genere le xml de la fiche de fab
                sleep(120);
                //-- wait 120sec to be sur that all the files are copied
                $objSmartgang->getImport($resu_info);
                //-- appel au script de déplacement des fichiers dans IMPORTS
                $objSmartgang->getRenameImport($pnIdPlanche, $pnIdCommande);
                //-- rename IMPORTS
                if ($pnIdPlanche > 0) {
                    $resu_negoce = $objSmartgang->execMsSql("SELECT\n     CONVERT(CHAR(11),TP.DateExpeditionUrgente, 13) AS DateExp\n     , TP.IDAtelier AS IDAtelier\n     , TA.Code AS CodeAtelier\n FROM\n     dbo.TBL_PLANCHE AS TP\n     JOIN TBL_ATELIER AS TA ON TP.IDAtelier = TA.IDAtelier\n WHERE\n     TP.IDPlanche = '{$pnIdPlanche}'");
                    $pdDateExpe = $resu_negoce[0]->DateExp;
                    $idatelier = $resu_negoce[0]->IDAtelier;
                    $psCodeAtelier = $resu_negoce[0]->CodeAtelier;
                    $objSmartgang->logFile(basename(__FILE__), "script", "OK ", ": Commande -> {$pnIdCommande} | IdPlanche => {$pnIdPlanche} | DateExp -> {$pdDateExpe} | Atelier : {$psCodeAtelier}");
                    $objSmartgang->getFicheRetirage($pnIdPlanche);
                    //-- create Fiche de fab retirage PDF
                }
            }
        }
    }
    $end = $objSmartgang->getmicrotime();
    $objSmartgang->logFile(basename(__FILE__), "script", "END", ": executed in " . round($end - $start, 5) . "sec\n");
    echo "{$pnIdPlanche}|{$pnIdCommande}|{$pdDateExpe}";
}
Esempio n. 3
0
 //-- success connect
 //-- LOG
 $objSmartgang->logFile(basename(__FILE__), "GangOffset", "EXE", "Commandes: {$pListeCommandes} / IDAtelier : {$pnIDAtelier} / IDPlancheFormat : {$pnIDPlancheFormat} / feuilleLargeur : {$feuilleLargeur} / feuilleHauteur : {$feuilleHauteur}");
 //-- offset ou num
 if ($pnIdActiviteProd == '2' or $pnIdActiviteProd == '1') {
     $pnIdPlanche = $objSmartgang->getCreationPlancheOffset($pListeCommandes, $pnIDPlancheFormat, $pnIDAtelier, $pnIdActiviteProd);
     //-- create planche SQL
     $objSmartgang->logFile(basename(__FILE__), "GangOffset", "EXE", ": Planche created - IdPlanche => {$pnIdPlanche}");
     if (is_numeric($pnIdPlanche)) {
         $resuWs = $objSmartgang->getWsdl($pnIdPlanche);
         //-- appel vers WS_bGenerationCoutPlanche pour générer les coûts de la planche
         if ($resuWs == "1") {
             //-- recuperation des infos de planches
             //-- mise à jour info planche
             $select = "SELECT TP.Libelle AS Libelle FROM dbo.TBL_PLANCHE AS TP WHERE TP.IDPlanche = '{$pnIdPlanche}'";
             $lib = $objSmartgang->execMsSql($select);
             $libelle = $lib[0]->Libelle;
             //$str = explode(',',$args['jobNumber']);
             $var = explode(" - ", $libelle);
             $var[0] = $pnQuantite;
             $libelleOk = implode(" - ", $var);
             $q = "UPDATE dbo.TBL_PLANCHE SET \n                              dbo.TBL_PLANCHE.Longueur = '{$feuilleLargeur}'\n                              ,dbo.TBL_PLANCHE.Largeur = '{$feuilleHauteur}' \n                              ,dbo.TBL_PLANCHE.Quantité = '{$pnQuantite}' \n                              ,dbo.TBL_PLANCHE.IDAtelier = '{$pnIDAtelier}' \n                              ,dbo.TBL_PLANCHE.Bascule = '{$pnIdBascule}' \n                              ,dbo.TBL_PLANCHE.IDProduitActiviteProduction = '{$pnIdActiviteProd}' \n                              ,dbo.TBL_PLANCHE.IDUtilisateurAjout = '{$pnIdMonteur}'\n                              ,dbo.TBL_PLANCHE.Libelle = '{$libelleOk}'\n                          WHERE dbo.TBL_PLANCHE.IDPlanche = '{$pnIdPlanche}'";
             $objSmartgang->execMsSql($q);
             //-- modification de la date d'expedition si necessaire
             if ($pdDateExp != "") {
                 $objSmartgang->execMsSql("UPDATE dbo.TBL_PLANCHE SET dbo.TBL_PLANCHE.DateExpeditionUrgente = '{$pdDateExp}' WHERE dbo.TBL_PLANCHE.IDPlanche = '{$pnIdPlanche}'");
             }
             $resu_info = $objSmartgang->getInfoPlanche($pnIdPlanche);
             if (is_array($resu_info)) {
                 $resu_ficheFab = $objSmartgang->getFicheFabV2($resu_info);
                 //-- récupération de la fiche de fab
Esempio n. 4
0
 $exaprint = new smartgang();
 $start = $exaprint->getmicrotime();
 $exaprint->logFile(basename(__FILE__), "script", "RUN", "IDPlanche: {$pnIdPlanche} - ExportPDF: {$exportAsked}");
 $deviceId = "Speedmaster 102";
 $bascule = "Sheetwise";
 $bleed = "2";
 $params = $exaprint->getParams();
 $pathMontage = $params['montage']['url'];
 $pathInputMxml = $params['metrix']['path'];
 $conDbo = $exaprint->getConDbo();
 if ($exportAsked != "non") {
     $exec = "exec dbo.P_FluxEvenementCreation null,{$pnIdPlanche},3,687,'MetrixAutomation',0";
 } else {
     $exec = "exec dbo.P_FluxEvenementCreation null,{$pnIdPlanche},2,687,'MetrixAutomation',0";
 }
 $exaprint->execMsSql($exec);
 $info_planche = $exaprint->getInfoPlanche($pnIdPlanche);
 $pListeCommandes = $info_planche['pListeCommandes'];
 $psCodeTete = $info_planche['psCodeTete'];
 $psActiviteProd = $info_planche['psActiviteProd'];
 $pdDateCreationPlanche = $info_planche['pdDateCreationPlanche'];
 $psCodeatelier = $info_planche['psCodeAtelier'];
 $pathImport = "Volumes/mnt/raid1/datas/Production/Chef_de_fab_v2/MONTAGE/{$psCodeTete}/{$pdDateCreationPlanche}/{$pnIdPlanche}/IMPORTS";
 $pathPlanche = "Volumes/Chef_de_fab_v2/MONTAGE/{$psCodeTete}/{$pdDateCreationPlanche}/{$pnIdPlanche}/{$psCodeatelier}_{$psActiviteProd}_{$pnIdPlanche}";
 $import_content = $exaprint->getReadDir("/" . $pathImport);
 $qGangSize = "SELECT TOP 1\n    TP.Largeur AS Largeur\n    , TP.Longueur AS Longueur\n    , TP.Bascule AS Bascule\n    , CASE WHEN TPTPOV.IDProduitOptionValeur = 181 THEN 'Sheetwise' WHEN TPTPOV.IDProduitOptionValeur = 238 THEN 'Sheetwise' ELSE 'OneSided' END AS IDProduitOptionValeur\nFROM\n    dbo.TBL_PLANCHE AS TP \n    LEFT OUTER JOIN dbo.TBL_PLANCHE_TL_PRODUIT_OPTION_VALEUR AS TPTPOV ON TP.IDPlanche = TPTPOV.IDPlanche\nWHERE\n    TP.EstSupp = '0'\n    AND TPTPOV.IDProduitOptionValeur IN (376,238,181,180)\n    AND TP.IDPlanche = {$pnIdPlanche}\nORDER BY\n  TPTPOV.IDProduitOptionValeur DESC";
 $gangSize = $exaprint->execMsSql($qGangSize);
 if (isset($gangSize[0]->IDProduitOptionValeur) && $gangSize[0]->IDProduitOptionValeur != '') {
     $bascule = $gangSize[0]->IDProduitOptionValeur;
 }
 switch ($gangSize[0]->Bascule) {
Esempio n. 5
0
 }
 if (isset($_POST['device']) && $_POST['device'] != "") {
     $deviceId = $_POST['device'];
 }
 if (isset($_POST['largeurFeuille']) && $_POST['largeurFeuille'] != "") {
     $largeurFeuille = $_POST['largeurFeuille'];
 }
 if (isset($_POST['hauteurFeuille']) && $_POST['hauteurFeuille'] != "") {
     $hauteurFeuille = $_POST['hauteurFeuille'];
 }
 //    if(isset($_POST['bascule']) && $_POST['bascule'] != "") { $bascule = $_POST['bascule']; }
 $exaprint->logFile(basename(__FILE__), "script", "RUN", "Commande: " . $_POST['listIdCommande'] . " - ExportPDF: {$exportAsked} - {$hauteurFeuille} x {$largeurFeuille}");
 foreach ($array_IdCommande as $clee => $pnIdCommande) {
     $q = "SELECT TOP 1\n    TC.LargeurFluxPao AS LargeurFluxPao,\n    TC.HauteurFluxPao AS HauteurFluxPao,\n    TCL.Quantite AS Quantite,\n    TFE.Commentaire AS CommFlux,\n    TPFPT.LibelleTraduit AS FamilleDeProduction,    \n    TPOV.CodificationLongue AS CodificationLongue,\n    TPOV.Codification AS Codification,\n    CASE WHEN TPOV.Codification = '' THEN TPOV.CodificationLongue ELSE TPOV.Codification END AS codif\nFROM\n    dbo.TBL_COMMANDE AS TC\n    LEFT OUTER JOIN dbo.TBL_COMMANDE_LIGNE AS TCL ON TC.IDCommande = TCL.IDCommande\n    LEFT OUTER JOIN dbo.TBL_PRODUIT_FAMILLE_PRODUCTION_TRAD AS TPFPT ON TPFPT.IDProduitFamilleProduction = TCL.IDProduitFamilleProduction AND TPFPT.IDLangue = 1\n    LEFT OUTER JOIN dbo.TBL_FLUX_EVENEMENT AS TFE ON TFE.IDCommande = TC.IDCommande AND TFE.IDFluxEvenementType = 30\n    \n    LEFT OUTER JOIN dbo.TBL_PRODUIT ON TCL.IDProduit = dbo.TBL_PRODUIT.IDProduit\n\n    LEFT OUTER JOIN TBL_PRODUIT_TL_OPTION_PRODUIT AS TPTOP ON TPTOP.IDProduit = TBL_PRODUIT.IDProduit\n    LEFT OUTER JOIN TBL_COMMANDE_LIGNE_TL_OPTION_PRODUIT AS TCLTOP ON (TCL.IDCommandeLigne = TCLTOP.IDCommandeLigne)\n    LEFT OUTER JOIN TBL_PRODUIT_TL_PRODUIT_OPTION_VALEUR_PRODUIT_OPTION_FAMILLE_PRODUIT AS TPTPOVPOFP\n    LEFT OUTER JOIN TBL_PRODUIT_OPTION_VALEUR_TRAD AS TPOVT ON (TPOVT.IDProduitOptionValeur = TPTPOVPOFP.IDProduitOptionValeur AND TPOVT.IDLangue = 1)\n      LEFT OUTER JOIN TBL_PRODUIT_OPTION_VALEUR AS TPOV\n        LEFT OUTER JOIN TBL_PRODUIT_OPTION AS TPO\n          LEFT OUTER JOIN TBL_PRODUIT_OPTION_TRAD AS TPOT ON (TPOT.IDProduitOption = TPO.IDProduitOption AND TPOT.IDLangue = 1)\n        ON (TPO.IDProduitOption = TPOV.IDProduitOption)\n      ON (TPOV.IDProduitOptionValeur = TPTPOVPOFP.IDProduitOptionValeur)\n    ON (TPTPOVPOFP.IDProduitTLProduitOptionValeurProduitOptionFamilleProduit = TPTOP.IDProduitTLProduitOptionValeurProduitOptionFamilleProduit AND TPTPOVPOFP.Actif = 1)\n\nWHERE\n    TC.EstAnnule = '0'\n    AND TC.EstSuspendu = 0\n    AND TPO.IDProduitOption = 75\n    AND TC.IDCommande = {$pnIdCommande}";
     $exaprint->getConDbo();
     $info_commande = $exaprint->execMsSql($q);
     $id = $suff . "-" . $info_commande[0]->codif;
     $commFlux = $info_commande[0]->CommFlux;
     $array_filename = explode('|', $commFlux);
     $fileName = $array_filename[2];
     $arrayProduct[] = array("Name" => $fileName, "ContentFile" => "/Volumes/Chef_de_fab_v2/z_A-MONTER/" . $info_commande[0]->FamilleDeProduction . "/" . $fileName, "FinishedTrimHeight" => $info_commande[0]->HauteurFluxPao, "FinishedTrimWidth" => $info_commande[0]->LargeurFluxPao, "ID" => "{$pnIdCommande}", "Type" => "Flat", "RequiredQuantity" => $info_commande[0]->Quantite, "DisplayColor" => array("RGBColorRef" => array("rRef" => "Ref_200")), "ComponentPool" => array(array("Component" => array("Active" => "True", "FinishedGrain" => "Same", "ID" => "{$fileName}", "Priority" => "5", "RequestedNumberOut" => "1", "StockRef" => array("rRef" => "Ref_stock_paper")))), "PagePool" => array("PageDefaults" => array("BleedBottom" => $bleed, "BleedLeft" => $bleed, "BleedRight" => $bleed, "BleedTop" => $bleed), "Page" => array(array("Folio" => "Recto", "Number" => "1"), array("Folio" => "Verso", "Number" => "2"))));
     $arrayLayout[] = array("rRef" => "{$fileName}");
 }
 $arrayBascule = array(array("Side" => "1", "PressRef" => array("rRef" => "Ref_23")));
 if ($bascule == 'Sheetwise') {
     $arrayBascule = array(array("Side" => "1", "PressRef" => array("rRef" => "Ref_23")), array("Side" => "2", "PressRef" => array("rRef" => "Ref_23")));
 }
 $data_json = array();
 $data_json["ResourcePool"] = array("RGBColor" => array(array("ID" => "Ref_100", "Blue" => "0", "Green" => "255", "Red" => "255"), array("ID" => "Ref_200", "Blue" => "102", "Green" => "255", "Red" => "204"), array("ID" => "Ref_300", "Blue" => "255", "Green" => "102", "Red" => "102"), array("ID" => "Ref_400", "Blue" => "230", "Green" => "230", "Red" => "230")), "Ink" => array(array("ID" => "Ref_ink_cyan", "Name" => "Cyan", "Type" => "ProcessCyan", "CMYKColorRef" => array("rRef" => "Ref_cyan")), array("ID" => "Ref_ink_magenta", "Name" => "Magenta", "Type" => "ProcessMagenta", "CMYKColorRef" => array("rRef" => "Ref_magenta")), array("ID" => "Ref_ink_yellow", "Name" => "Yellow", "Type" => "ProcessYellow", "CMYKColorRef" => array("rRef" => "Ref_yellow")), array("ID" => "Ref_ink_black", "Name" => "Black", "Type" => "ProcessBlack", "CMYKColorRef" => array("rRef" => "Ref_black"))), "CMYKColor" => array(array("ID" => "Ref_cyan", "Black" => "0", "Cyan" => "100", "Magenta" => "0", "Yellow" => "0"), array("ID" => "Ref_magenta", "Black" => "0", "Cyan" => "0", "Magenta" => "100", "Yellow" => "0"), array("ID" => "Ref_yellow", "Black" => "0", "Cyan" => "0", "Magenta" => "0", "Yellow" => "100"), array("ID" => "Ref_black", "Black" => "100", "Cyan" => "100", "Magenta" => "0", "Yellow" => "0")), "Stock" => array("ID" => "Ref_stock_paper", "Vendor" => "House", "Name" => "House Stock", "Weight" => "350", "WeightUnit" => "gsm", "Thickness" => "0.35", "Grade" => "2", "DryingTimeMultiplier" => "1", "StockSheet" => array(array("ID" => "Ref_19", "Width" => $largeurFeuille . "0", "Height" => $hauteurFeuille . "0", "Grain" => "Horizontal", "CostPerThousand" => "1"))), "Press" => array(array("ID" => "Ref_23", "DeviceID" => $deviceId)), "TrimMarks" => array("ID" => "Ref_100", "Length" => "3", "DistanceFromPageTrim" => "3", "ThicknessPoints" => "0.25", "OverPageContent" => "False", "AllSeparations" => "True"));
 $data_json["Project"] = array("AutoNumberOut" => "True", "Description" => "Generated by AWS Lambda", "Name" => "{$id}", "Notes" => "MetrixAutomationProByEboxSquad", "ProjectID" => "{$id}", "StopBleedsOverlapping" => "True", "ReadOnly" => "False", "ProductPool" => array("Product" => $arrayProduct), "LayoutPool" => array("Layout" => array("ID" => "Ref_layout", "PageToBleedGap" => $bleed, "PrintingMethod" => $bascule, "SheetSide" => $arrayBascule, "StockSheetRef" => array("rRef" => "Ref_19"), "ComponentRefPool" => array("ComponentRef" => $arrayLayout))));
 $data_json["CommandPool"] = array("Run" => array("CheckProductContent" => array("Name" => "Check Product Content", "IfAnyProductHasNoContent" => "Ignore", "IfAnyProductContentIsNotAvailable" => "DisallowExporting"), "AutoPlanLayout" => array("Name" => "Auto Plan (Layout)", "UseLargestDatabasePressSheet" => "False", "AreaToStartTests" => "70", "AutoLayoutTimeOutSeconds" => "5", "TotalTimeOutPerStockSeconds" => "60", "GapBetweenPlacementGroups" => "2.5"), "ApplyStandards" => array("Name" => "Apply Standards", "OnlyExportIfAllLayoutsAreStandards" => "False"), "SetProjectProperty" => array("Name" => "Set Project Property", "Object" => "Project", "Property" => "NeedsAttention", "Value" => "True", "OnlyDoIfExporting" => "NotAllowed"), "SaveToMetrixDatabase" => array("Name" => "Save To Metrix Database"), "CheckProject" => array("Name" => "Chack Project", "OnlyExportIfStatusAtLeast" => "OK"), "ExportMetrixXML" => array(array("Name" => "Export Metrix XML", "DestinationFolder" => "/Volumes/Chef_de_fab_v2/MetrixExport/Listes/mxml/{$folder}", "ExportDataFor" => "WholeProject", "MXMLVersion" => "1.0", "ExportToZipFile" => "False")), "ExportLayoutImages" => array(array("Name" => "Export Layout Images", "DestinationFolder" => "/Volumes/Chef_de_fab_v2/MetrixExport/Listes/jpeg/{$folder}/{$id}", "MaxImageWidthPixels" => "800", "MaxImageHeightPixels" => "800", "ShowPreviews" => "True", "ExportToZipFile" => "False")), "SendEmail" => array("Name" => "Send 'Needs Attention' Email to Administrator", "To" => "Administrator", "SubjectFileName" => "Could Not Export Subject.txt", "BodyFileName" => "Could Not Export Body.txt", "AttachLogFile" => "True", "OnlyDoIfExporting" => "NotAllowed")));