コード例 #1
0
    function getBatchSummary()
    {
        $db = Database::getInstance();
        $cxn = $db->getConnection();
        $bn = new Batch();
        $bn->setBatchID($this->batchid);
        $bqty = $bn->getBatchQty();
        $query = "SELECT cust.Customer_Name,Machine_Name,\nSUM(CASE WHEN Activity_ID=1 THEN TIMESTAMPDIFF(minute,Start_Date_Time,End_Date_Time) END) AS Production,\nSUM(CASE WHEN Activity_ID=2 THEN TIMESTAMPDIFF(minute,Start_Date_Time,End_Date_Time) END) AS Setup,\nSUM(CASE WHEN Activity_ID=16 THEN TIMESTAMPDIFF(minute,Start_Date_Time,End_Date_Time) END) AS Proving,\nSUM(CASE WHEN Activity_ID=3 THEN TIMESTAMPDIFF(minute,Start_Date_Time,End_Date_Time) END) AS Rework,\nSUM(CASE WHEN Activity_ID=9 THEN TIMESTAMPDIFF(minute,Start_Date_Time,End_Date_Time) END) AS CMM,\nSUM(TIMESTAMPDIFF(minute,Start_Date_Time,End_Date_Time)) AS Total From ActivityLog as actl\nINNER JOIN Production as prod ON prod.Activity_Log_ID=actl.Activity_Log_ID\nINNER JOIN Operation as ope On ope.Operation_ID=prod.Operation_ID\nINNER JOIN Component as comp on comp.Drawing_ID=ope.Drawing_ID\nINNER JOIN Customer as cust ON cust.Customer_ID=comp.Customer_ID \nINNER JOIN Machine as mach ON mach.Machine_ID=actl.Machine_ID\nWHERE ope.Drawing_ID={$this->drawingid} AND Batch_ID='{$this->batchid}' AND mach.Machine_ID!=9 GROUP BY mach.Machine_ID;";
        if (!($res = $cxn->query($query))) {
            exit("error (getBatchSummary1: {$query} ) : {$cxn->error}");
        }
        echo '<table class="pcd">';
        echo '<tr><th>Machines used</th><th>Production</th><th>Set Up</th><th>Prog. Proving</th><th>Rework</th><th>CMM Programing</th><th>Total</th></tr>';
        $mtime = 0;
        $mtimewcmm = 0;
        while ($row = mysqli_fetch_assoc($res)) {
            if ($row['Production'] != '') {
                $p = $this->min2hm($row['Production']);
                $mtime += $row['Production'];
            } else {
                $p = '';
            }
            if ($row['Setup'] != '') {
                $s = $this->min2hm($row['Setup']);
                $mtime += $row['Setup'];
            } else {
                $s = '';
            }
            if ($row['Proving'] != '') {
                $pp = $this->min2hm($row['Proving']);
                $mtime += $row['Proving'];
            } else {
                $pp = '';
            }
            if ($row['Rework'] != '') {
                $rw = $this->min2hm($row['Rework']);
            } else {
                $rw = '';
            }
            if ($row['CMM'] != '') {
                $cmm = $this->min2hm($row['CMM']);
            } else {
                $cmm = '';
            }
            if ($row['Total'] != '') {
                $t = $this->min2hm($row['Total']);
            } else {
                $t = '';
            }
            echo '<tr><td>' . $row['Machine_Name'] . '</td><td>' . $p . '</td><td>' . $s . '</td><td>' . $pp . '</td><td>' . $rw . '</td><td>' . $cmm . '</td><td>' . $t . '</td></tr>';
        }
        $tti = $this->min2hm($mtime);
        $avgtime = $mtime / $bqty;
        $avt = $this->min2hm($avgtime);
        $q8 = "SELECT TIME_TO_SEC(ADDTIME(Clamping_Time,Machining_Time)) as tmt FROM Operation as ope\nINNER JOIN Component as comp on comp.Drawing_ID=ope.Drawing_ID\nWHERE ope.Drawing_ID={$this->drawingid} AND ope.In_Op_List=1;";
        if (!($res8 = $cxn->query($q8))) {
            exit("error (getBatchSummary2: {$q8} ) : {$cxn->error}");
        }
        $stime = 0;
        while ($ror8 = mysqli_fetch_assoc($res8)) {
            $stime += $ror8['tmt'];
        }
        $stime = $this->min2hm($stime / 60);
        $q2 = "SELECT cust.Customer_Name,Machine_Name,\nSUM(CASE WHEN Activity_ID=11 THEN TIMESTAMPDIFF(minute,Start_Date_Time,End_Date_Time) END) AS FAI,\nSUM(CASE WHEN Activity_ID=4 THEN TIMESTAMPDIFF(minute,Start_Date_Time,End_Date_Time) END) AS Fixture,\nSUM(TIMESTAMPDIFF(minute,Start_Date_Time,End_Date_Time)) AS Total From ActivityLog as actl\nINNER JOIN NonProduction as nprod ON nprod.Activity_Log_ID=actl.Activity_Log_ID\nINNER JOIN BNo_MI_Challans as bmc on bmc.Batch_ID=nprod.Batch_ID\nINNER JOIN MI_Drg_Qty as mdq on mdq.MI_Drg_Qty_Id=bmc.MI_Drg_Qty_ID\nINNER JOIN Component as comp on comp.Drawing_ID=mdq.Drawing_ID\nINNER JOIN Customer as cust ON cust.Customer_ID=comp.Customer_ID\nINNER JOIN Machine as mach ON mach.Machine_ID=actl.Machine_ID\nWHERE mdq.Drawing_ID={$this->drawingid} AND nprod.Batch_ID={$this->batchid} GROUP BY mach.Machine_ID;";
        if (!($r2 = $cxn->query($q2))) {
            exit("error (getBatchSummary3: {$q2} ) : {$cxn->error}");
        }
        if ($r2->num_rows > 0) {
            echo '<table class="pcd"><tr><th>Machine</th><th>Fixture Work</th><th>FAI</th><th>Total</th></tr>';
            while ($row = mysqli_fetch_assoc($r2)) {
                if ($row['FAI'] != '') {
                    $fai = $this->min2hm($row['FAI']);
                } else {
                    $fai = '';
                }
                if ($row['Fixture'] != '') {
                    $fxt = $this->min2hm($row['Fixture']);
                } else {
                    $fxt = '';
                }
                if ($row['Total'] != '') {
                    $t = $this->min2hm($row['Total']);
                } else {
                    $t = '';
                }
                echo '<tr><td>' . $row['Machine_Name'] . '</td><td>' . $fxt . '</td><td>' . $fai . '</td><td>' . $t . '</td></tr>';
            }
        }
        $q3 = "SELECT ope.Operation_Desc,TIME_TO_SEC(ADDTIME(Clamping_Time,Machining_Time)) as tmt,\nSUM(CASE WHEN Activity_ID=1 THEN TIMESTAMPDIFF(minute,Start_Date_Time,End_Date_Time) END) AS Production,\nSUM(CASE WHEN Activity_ID=2 THEN TIMESTAMPDIFF(minute,Start_Date_Time,End_Date_Time) END) AS Setup,\nSUM(CASE WHEN Activity_ID=16 THEN TIMESTAMPDIFF(minute,Start_Date_Time,End_Date_Time) END) AS Proving,\nSUM(CASE WHEN Activity_ID=3 THEN TIMESTAMPDIFF(minute,Start_Date_Time,End_Date_Time) END) AS Rework,\nSUM(CASE WHEN Activity_ID=9 THEN TIMESTAMPDIFF(minute,Start_Date_Time,End_Date_Time) END) AS CMM,\nSUM(TIMESTAMPDIFF(minute,Start_Date_Time,End_Date_Time)) AS Total From ActivityLog as actl\nINNER JOIN Production as prod ON prod.Activity_Log_ID=actl.Activity_Log_ID\nINNER JOIN Operation as ope On ope.Operation_ID=prod.Operation_ID\nINNER JOIN Component as comp on comp.Drawing_ID=ope.Drawing_ID\nINNER JOIN Customer as cust ON cust.Customer_ID=comp.Customer_ID \nWHERE ope.Drawing_ID={$this->drawingid} AND Batch_ID={$this->batchid} GROUP BY ope.Operation_ID;";
        if (!($r3 = $cxn->query($q3))) {
            exit("error (getBatchSummary4: {$q3} ) : {$cxn->error}");
        }
        if ($r3->num_rows > 0) {
            echo '<table class="pcd"><tr><th>Operation</th><th>Standard Time/Part</th><th>Avg Time/Part</th><th>Setup/Batch</th><th>Proving/Batch</th>
							<th>Production/Batch</th><th>Rework</th><th>Total</th></tr>';
            while ($row = mysqli_fetch_assoc($r3)) {
                if ($row['Production'] != '') {
                    $p = $this->min2hm($row['Production']);
                    $apt = $this->min2hm($row['Production'] / $bqty);
                } else {
                    $p = '';
                }
                if ($row['Setup'] != '') {
                    $s = $this->min2hm($row['Setup']);
                } else {
                    $s = '';
                }
                if ($row['Proving'] != '') {
                    $pp = $this->min2hm($row['Proving']);
                } else {
                    $pp = '';
                }
                if ($row['Rework'] != '') {
                    $rw = $this->min2hm($row['Rework']);
                } else {
                    $rw = '';
                }
                if ($row['CMM'] != '') {
                    $cmm = $this->min2hm($row['CMM']);
                } else {
                    $cmm = '';
                }
                if ($row['Total'] != '') {
                    $t = $this->min2hm($row['Total']);
                } else {
                    $t = '';
                }
                if ($row['tmt'] != '') {
                    $tmt = $this->min2hm($row['tmt'] / 60);
                } else {
                    $tmt = '';
                }
                echo '<tr><td>' . $row['Operation_Desc'] . '</td><td>' . $tmt . '</td><td>' . $apt . '</td><td>' . $s . '</td><td>' . $pp . '</td><td>' . $p . '</td><td>' . $rw . '</td><td>' . $t . '</td></tr>';
            }
        }
        echo '<p>Cycle Time(STD) ' . $stime . '<p/>';
        echo '<p>Cycle Time (Avg) ' . $avt . '<p/>';
        echo '<p>Total hours for the Batch ' . $tti . '<p/>';
    }
コード例 #2
0
ファイル: batchno.php プロジェクト: sknagesh/divyaeng2
 $cqty = $_POST['cqty'];
 //commited quantites
 $cremark = $_POST['cremark'];
 //commitment remarks
 $miid = $_POST['MI_Drg_Qty_ID'];
 //inward challan ids
 $mqty = $_POST['mqty'];
 //challan vice quanties in batch
 $hcode = $_POST['hcode'];
 //heat codes
 $bn->saveBatch();
 $batchid = $bn->getBatchID();
 $i = 0;
 $j = count($cdates);
 while ($i < $j) {
     $bn->setBatchID($batchid);
     $bn->setCommitedDate($cdates[$i]);
     $bn->setCommitedQty($cqty[$i]);
     $bn->setCommitedRemarks($cremark[$i]);
     $bn->saveCommitment();
     $i++;
 }
 $i = 0;
 $j = count($miid);
 while ($i < $j) {
     $bn->setBatchID($batchid);
     $bn->setMIDQID($miid[$i]);
     $bn->setQuantity($mqty[$i]);
     $bn->setHeatCode($hcode[$i]);
     $bn->saveQtyDetails();
     $i++;