Project

General

Profile

Project progress work #205 » screen2.blade.php

Yutthapong Sricha, 07 Nov 2023 16:08

 
1
@extends("layout.menu")
2

    
3
@php 
4
 $strYear = date("d-m-y");
5
 
6
@endphp
7

    
8
<?php
9

    
10
  // function test(){
11
  //   return str_replace("world","Peter","Hello world!");
12
  // }
13

    
14
  $date = date("Y-m-d");
15
  //$date = "2023-09-21"; // change date here.
16
  //$dateOnex = date("Y-m-d", strtotime("+1 day", strtotime($date))); 
17

    
18
  $H_check = date("H");
19
  //$H_check = 20;
20
  if( $H_check>=8 && $H_check<20 ){
21
    $dateOne = $date; 
22
    //$dateOne = date("Y-m-d", strtotime("-1 day", strtotime($date))); 
23
		$dateAll = "$date 8:00:00.000";
24
		$datemid = $dateOne." 19:59:59.000";
25
    $list_blocks = array("$date 08:00"=>"block_a", 
26
                        "$date 09:00"=>"block_b",
27
                        "$date 10:00"=>"block_c",
28
                        "$date 11:00"=>"block_d",
29
                        "$date 12:00"=>"block_e",
30
                        "$date 13:00"=>"block_f",
31
                        "$date 14:00"=>"block_g",
32
                        "$date 15:00"=>"block_h",
33
                        "$date 16:00"=>"block_i",
34
                        "$date 17:00"=>"block_j",
35
                        "$date 18:00"=>"block_k",
36
                        "$date 19:00"=>"block_l",
37
                        "$date 20:00"=>"block_m");
38
  }else{
39
    //$dateOne = $date; 
40
    $dateOne = date("Y-m-d", strtotime("+1 day", strtotime($date)));  
41
    $dateAll = "$date 20:00:00.000";
42
    $datemid = $dateOne." 07:59:59.000";
43
    $list_blocks = array("$date 20:00"=>"block_a",
44
                        "$date 21:00"=>"block_b",
45
                        "$date 22:00"=>"block_c",
46
                        "$date 23:00"=>"block_d",
47
                        "$dateOne 00:00"=>"block_e",
48
                        "$dateOne 01:00"=>"block_f",
49
                        "$dateOne 02:00"=>"block_g",
50
                        "$dateOne 03:00"=>"block_h",
51
                        "$dateOne 04:00"=>"block_i",
52
                        "$dateOne 05:00"=>"block_j",
53
                        "$dateOne 06:00"=>"block_k",
54
                        "$dateOne 07:00"=>"block_l",
55
                        "$dateOne 08:00"=>"block_m");
56
  }
57

    
58
    $list_step = array(
59
                        array("title"=>"DIE BOND", "plan"=>"diebond_plan",  "act"=>"diebond_act", "act_time"=>"diebond_act_time",  "diff"=>"diebond_plan_diff",),
60
                        array("title"=>"OVEN DIEBOND", "plan"=>"oven_diebond_plan",  "act"=>"oven_diebond_act", "act_time"=>"ovediebond_act_time",  "diff"=>"oven_diebond_plan_diff",),
61
                        array("title"=>"WIRE BOND", "plan"=>"wirebond_plan",  "act"=>"wirebond_act", "act_time"=>"wirebond_act_time",  "diff"=>"wirebond_plan_diff",),
62
                        array("title"=>"BONDING INS", "plan"=>"bonding_ins_plan",  "act"=>"bonding_ins_act", "act_time"=>"bondingins_act_time",  "diff"=>"bonding_ins_plan_diff",),
63
                        array("title"=>"MOLD", "plan"=>"mold_plan",  "act"=>"mold_act", "act_time"=>"mold_act_time",  "diff"=>"mold_plan_diff",),
64
                        array("title"=>"OVEN MOLD", "plan"=>"oven_mold_plan",  "act"=>"oven_mold_act", "act_time"=>"ovemold_act_time",  "diff"=>"oven_mold_plan_diff",),
65
                        array("title"=>"DICER", "plan"=>"dicer_plan",  "act"=>"dicer_act", "act_time"=>"dicer_act_time", "diff"=>"dicer_plan_diff",),
66
                        array("title"=>"APPEARANCE", "plan"=>"appea_plan",  "act"=>"appea_act", "act_time"=>"appea_act_time", "diff"=>"appea_plan_diff",),
67
                        array("title"=>"CLASSIFYING", "plan"=>"classi_plan",  "act"=>"classi_act", "act_time"=>"classi_act_time", "diff"=>"classi_plan_diff",),
68
                            );
69

    
70
    $list_lot_no = $lot_no;                    
71
?>
72

    
73

    
74
@section("script")
75
<script type="text/javascript">
76
  var scrollerID;
77
  var interval = 30;
78
  var documentH = 0;
79
  var paused = true;
80
  var clockUpdateID;
81
  var loaddataID;
82
  var list_lot_no = <?=json_encode($lot_no)?>;
83

    
84
  <?if( isset($list_lot_no) && count($list_lot_no)>0 ){?>
85
      $(document).ready(function () {
86
        
87
        var loadDataID;
88

    
89
        loadData();
90
        clockUpdate();
91
        clockUpdateID = setInterval( function(){ clockUpdate(); }, 1000);
92

    
93
        init_auto_scroll();
94

    
95
        document.addEventListener('keydown', (event) => {
96
          if (event.key === 'Enter') {
97
            paused = !paused;
98
            if(paused){
99
              clearInterval(scrollerID);
100
            }else{
101
              scrollerID = start_auto_scroll();
102
            }
103
          }
104
        });
105

    
106
        loaddataID = setInterval(function(){ loadData(); },60000);
107

    
108
        setTimeout(function() {
109
                  paused = true; 
110
                  clearInterval(scrollerID);
111
                  location.replace("screen1");
112
        }, 600000);
113
      });
114

    
115

    
116
      //timerefresh(10);
117
  <?}else{?>
118
       $(document).ready(function () {
119
            setTimeout(function() {
120
                    location.replace("screen1");
121
            }, 60000);
122
       });
123
  <?}?>  
124

    
125
// function timerefresh(t)
126
// {
127
//     if(t==0){
128
//       loadData();
129
//         }
130
//     else{
131
//         t--;
132
//       }
133
//     window.setTimeout("timerefresh('"+t+"')",10000)
134
// }
135

    
136
function clockUpdate() {
137
  var date = new Date();
138
  var h = addZero(twelveHour(date.getHours()));
139
  var m = addZero(date.getMinutes());
140
  var s = addZero(date.getSeconds());
141

    
142
  var time = h + ':' + m + ':' + s;
143
  document.getElementById("digital-time").innerText = time;
144
  document.getElementById("digital-time").textContent = time;
145

    
146
}  
147

    
148
  function addZero(x) {
149
    if (x < 10) {
150
      return x = '0' + x;
151
    } else {
152
      return x;
153
    }
154
  }
155

    
156
  function twelveHour(x) {
157
    if (x > 24) {
158
      return x = x - 24;
159
    } else if (x == 0) {
160
      return x = 24;
161
    } else {
162
      return x;
163
    }
164
  }
165

    
166
// function clockUpdate() {
167
//   var date = new Date();
168
//   $('.digital-clock').css({'color': '#FFFF'});
169
//   function addZero(x) {
170
//     if (x < 10) {
171
//       return x = '0' + x;
172
//     } else {
173
//       return x;
174
//     }
175
//   }
176

    
177
//   function twelveHour(x) {
178
//     if (x > 24) {
179
//       return x = x - 24;
180
//     } else if (x == 0) {
181
//       return x = 24;
182
//     } else {
183
//       return x;
184
//     }
185
//   }
186

    
187
//   var h = addZero(twelveHour(date.getHours()));
188
//   var m = addZero(date.getMinutes());
189
//   var s = addZero(date.getSeconds());
190

    
191
//   $('.digital-clock').text(h + ':' + m + ':' + s)
192
// }
193

    
194
function find_block(val_chk){
195
      count = 0;
196
        for (const [key, block] of Object.entries(list_blocks)) {
197
                if(key==val_chk){
198
                    return { "block_no": count , "block_time":key, "block_name":block };
199
                }  
200
                count +=1;         
201
        }
202
        return false;
203
}
204

    
205
    function loadData() {
206
      $.ajax({
207
 
208
        url:'{{url("loaddataScreen2")}}',
209
        type:'get',
210
        data:'',
211
        dataType:'json',
212
        complete: function (jqXHR) {
213
          if( jqXHR.status==500){
214
            location.replace("screen2");
215
          }
216
        },
217
        success:function(ret){
218
              list_blocks = <?=json_encode($list_blocks)?>;
219
              list_step = <?=json_encode($list_step)?>;
220
              $("#Output").empty();
221
              $("#Outputlot").empty();
222
              $("#Resultok").empty();
223
              $("#Resultpercen").empty();
224
              $("#Png").empty();
225
              day_cal = ret['day_cal'];
226
              dateshow = ret['dateshow'];
227
              timeshow = ret['timeshow'];
228
              $('#id_dateshow').text(dateshow);
229
              //$('#digital-time').text(timeshow);
230
              lot_data = ret['lot_data'];
231
              lot_not_start = ret['lot_not_start'];
232
              lot_finish = ret['lot_finish'];
233
              date_point = ret['dateAll']; // 2023-09-21 19:59:59.000
234
              $('#id_total').text(lot_data.length);
235
              $('#id_not_start').text(lot_not_start[0]['notstart']);
236
              $('#id_finish').text(lot_finish[0]['finish']);
237

    
238
              for(let x in list_lot_no ){
239
       
240
                  lot_no = list_lot_no[x]['lot_no'];      
241

    
242
                  const row_array_lot = lot_data.filter(function(list_lot) { return list_lot.lot_no === lot_no; });
243
                  row_lot = row_array_lot[0];
244
       
245
                  dibond = true; ovendie = true; wirebond = true; bondingins=true; mold=true; ovenmold=true; dicer=true;  appea = true; classi=true;
246
                  block_check = '';
247
                  key_check = '';
248
                  block_no = 0;
249
          
250
                   if( (row_lot['block_classi_act']!='undefined' 
251
                      && row_lot['block_classi_act'].toString().length > 10) 
252
                      && (Date.parse(row_lot['block_classi_act']) < Date.parse(Object.keys(list_blocks)[12]) 
253
                      && Date.parse(row_lot['block_classi_act']) >= Date.parse(Object.keys(list_blocks)[0]) ) ){
254
                          row_block = find_block(row_lot['block_classi_act']);
255
                          if( row_block!=false ){
256
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']).text("CLASSIFYING").addClass("font-bold  f12");
257
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').text(row_lot['classi_plan'].substring(0, row_lot['classi_plan'].length - 7)).addClass("time-text-plan  f12");
258
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_act').text(row_lot['classi_act_time']).addClass("time-text-act ");
259
                            //(row_lot['lot_no']+' block_classi_act = '+row_lot['block_classi_act']);
260
                            //console.log(row_lot['lot_no']+' classi_plan_diff = '+row_lot['classi_plan_diff']);
261
                            if( numeral(row_lot['classi_plan_diff']).value() > 4 ){
262
                                $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').addClass("bg-red");
263
                            }else if( numeral(row_lot['classi_plan_diff']).value() < -4 ){
264
                                $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').addClass("bg-yellow");
265
                            }      
266
                            block_no = row_block['block_no']-1;
267
                            prev_step = 8;
268
                          }
269
                   }
270

    
271

    
272
                   if( (row_lot['block_appea_act']!='undefined' 
273
                      && row_lot['block_appea_act'].toString().length > 10) 
274
                      && (Date.parse(row_lot['block_appea_act']) < Date.parse(Object.keys(list_blocks)[12]) 
275
                      && Date.parse(row_lot['block_appea_act']) >= Date.parse(Object.keys(list_blocks)[0]) ) ){
276
                          row_block = find_block(row_lot['block_appea_act']);
277
                          if( row_block!=false ){
278
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']).text("APPEARANCE").addClass("font-bold  f12");
279
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').text(row_lot['appea_plan'].substring(0, row_lot['appea_plan'].length - 7)).addClass("time-text-plan  f12");
280
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_act').text(row_lot['appea_act_time']).addClass("time-text-act ");
281
                            //console.log(row_lot['lot_no']+' block_appea_act = '+row_lot['block_appea_act']);
282
                            //console.log(row_lot['lot_no']+' appea_plan_diff = '+row_lot['appea_plan_diff']);
283
                            if( numeral(row_lot['appea_plan_diff']).value() > 4 ){
284
                                $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').addClass("bg-red");
285
                            }else if( numeral(row_lot['appea_plan_diff']).value() < -4 ){
286
                                $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').addClass("bg-yellow");
287
                            }  
288
                            block_no = row_block['block_no']-1;
289
                            prev_step = 7;
290
                          }
291
                   }
292
                  
293
 
294
                   if( (row_lot['block_dicer_act']!='undefined' 
295
                      && row_lot['block_dicer_act'].toString().length > 10) 
296
                      && (Date.parse(row_lot['block_dicer_act']) < Date.parse(Object.keys(list_blocks)[12]) 
297
                      && Date.parse(row_lot['block_dicer_act']) >= Date.parse(Object.keys(list_blocks)[0]) ) ){
298
                          row_block = find_block(row_lot['block_dicer_act']);
299
                          if( row_block!=false ){
300
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']).text("DICER").addClass("font-bold  f12");
301
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').text(row_lot['dicer_plan'].substring(0, row_lot['dicer_plan'].length - 7)).addClass("time-text-plan  f12");
302
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_act').text(row_lot['dicer_act_time']).addClass("time-text-act ");
303
                            //console.log(row_lot['lot_no']+' block_dicer_act = '+row_lot['block_dicer_act']);
304
                            //console.log(row_lot['lot_no']+' dicer_plan_diff = '+row_lot['dicer_plan_diff']);
305
                            if( numeral(row_lot['dicer_plan_diff']).value() > 4 ){
306
                                $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').addClass("bg-red");
307
                            }else  if( numeral(row_lot['dicer_plan_diff']).value() < -4 ){
308
                                $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').addClass("bg-yellow");
309
                            }
310
                            block_no = row_block['block_no']-1;
311
                            prev_step = 6;
312
                          }
313
                   }
314

    
315

    
316
                   if( (row_lot['block_ovemold_act']!='undefined' 
317
                      && row_lot['block_ovemold_act'].toString().length > 10) 
318
                      && (Date.parse(row_lot['block_ovemold_act']) < Date.parse(Object.keys(list_blocks)[12]) 
319
                      && Date.parse(row_lot['block_ovemold_act']) >= Date.parse(Object.keys(list_blocks)[0]) ) ){
320
                          row_block = find_block(row_lot['block_ovemold_act']);
321
                          if( row_block!=false ){
322
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']).text("OVEN MOLD").addClass("font-bold  f12");
323
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').text(row_lot['oven_mold_plan'].substring(0, row_lot['oven_mold_plan'].length - 7)).addClass("time-text-plan  f12");
324
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_act').text(row_lot['ovemold_act_time']).addClass("time-text-act ");
325
                            //console.log(row_lot['lot_no']+' block_ovemold_act = '+row_lot['block_ovemold_act']);
326
                           // console.log(row_lot['lot_no']+' oven_mold_plan_diff = '+row_lot['oven_mold_plan_diff']);
327
                            if( numeral(row_lot['oven_mold_plan_diff']).value() > 4 ){
328
                                $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').addClass("bg-red");
329
                            }else if( numeral(row_lot['oven_mold_plan_diff']).value() < -4 ){
330
                                $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').addClass("bg-yellow");
331
                            }   
332
                            block_no = row_block['block_no']-1;
333
                            prev_step = 5;
334
                          }
335
                   }
336

    
337

    
338
                   if( (row_lot['block_mold_act']!='undefined' 
339
                      && row_lot['block_mold_act'].toString().length > 10) 
340
                      && (Date.parse(row_lot['block_mold_act']) < Date.parse(Object.keys(list_blocks)[12]) 
341
                      && Date.parse(row_lot['block_mold_act']) >= Date.parse(Object.keys(list_blocks)[0]) ) ){
342
                          row_block = find_block(row_lot['block_mold_act']);
343
                          if( row_block!=false ){
344
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']).text("MOLD").addClass("font-bold  f12");
345
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').text(row_lot['mold_plan'].substring(0, row_lot['oven_mold_plan'].length - 7)).addClass("time-text-plan  f12");
346
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_act').text(row_lot['mold_act_time']).addClass("time-text-act ");
347
                            //console.log(row_lot['lot_no']+' block_mold_act = '+row_lot['block_mold_act']);
348
                            //console.log(row_lot['lot_no']+' mold_plan_diff = '+row_lot['mold_plan_diff']);
349
                            if( numeral(row_lot['mold_plan_diff']).value() > 4 ){
350
                                $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').addClass("bg-red");
351
                            }else if( numeral(row_lot['mold_plan_diff']).value() < -4 ){
352
                                $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').addClass("bg-yellow");
353
                            }   
354
                            block_no = row_block['block_no']-1;
355
                            prev_step = 4;
356
                          }
357
                   }                   
358

    
359

    
360
                   if( (row_lot['block_bondingins_act']!='undefined' 
361
                      && row_lot['block_bondingins_act'].toString().length > 10) 
362
                      && (Date.parse(row_lot['block_bondingins_act']) < Date.parse(Object.keys(list_blocks)[12]) 
363
                      && Date.parse(row_lot['block_bondingins_act']) >= Date.parse(Object.keys(list_blocks)[0]) ) ){
364
                          row_block = find_block(row_lot['block_bondingins_act']);
365
                          if( row_block!=false ){
366
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']).text("BONDING INS").addClass("font-bold  f12");
367
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').text(row_lot['bonding_ins_plan'].substring(0, row_lot['bonding_ins_plan'].length - 7)).addClass("time-text-plan  f12");
368
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_act').text(row_lot['bondingins_act_time']).addClass("time-text-act ");
369
                            //console.log(row_lot['lot_no']+' block_bondingins_act = '+row_lot['block_bondingins_act']);
370
                            //console.log(row_lot['lot_no']+' bonding_ins_plan_diff = '+row_lot['bonding_ins_plan_diff']);
371
                            if( numeral(row_lot['bonding_ins_plan_diff']).value() > 4 ){
372
                                $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').addClass("bg-red");
373
                            }else if( numeral(row_lot['bonding_ins_plan_diff']).value() < -4 ){
374
                                $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').addClass("bg-yellow");
375
                            }   
376
                            block_no = row_block['block_no']-1;
377
                            prev_step = 3;
378
                          }
379
                   } 
380

    
381

    
382
                   if( (row_lot['block_wirebond_act']!='undefined' 
383
                      && row_lot['block_wirebond_act'].toString().length > 10) 
384
                      && (Date.parse(row_lot['block_wirebond_act']) < Date.parse(Object.keys(list_blocks)[12]) 
385
                      && Date.parse(row_lot['block_wirebond_act']) >= Date.parse(Object.keys(list_blocks)[0]) ) ){
386
                          row_block = find_block(row_lot['block_wirebond_act']);
387
                          if( row_block!=false ){
388
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']).text("WIRE BOND").addClass("font-bold  f12");
389
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').text(row_lot['wirebond_plan'].substring(0, row_lot['wirebond_plan'].length - 7)).addClass("time-text-plan  f12");
390
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_act').text(row_lot['wirebond_act_time']).addClass("time-text-act ");
391
                            //console.log(row_lot['lot_no']+' block_wirebond_act = '+row_lot['block_wirebond_act']);
392
                            console.log(row_lot['lot_no']+' wirebond_plan_diff = '+row_lot['wirebond_plan_diff']);
393
                            if( numeral(row_lot['wirebond_plan_diff']).value() > 4 ){
394
                                $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').addClass("bg-red");
395
                            }else if( numeral(row_lot['wirebond_plan_diff']).value() < -4 ){
396
                                $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').addClass("bg-yellow");
397
                            }   
398
                            block_no = row_block['block_no']-1;
399
                            prev_step = 2;
400
                          }
401
                   } 
402

    
403

    
404
                   if( (row_lot['block_ovediebond_act']!='undefined' 
405
                      && row_lot['block_ovediebond_act'].toString().length > 10) 
406
                      && (Date.parse(row_lot['block_ovediebond_act']) < Date.parse(Object.keys(list_blocks)[12]) 
407
                      && Date.parse(row_lot['block_ovediebond_act']) >= Date.parse(Object.keys(list_blocks)[0]) ) ){
408
                          row_block = find_block(row_lot['block_ovediebond_act']);
409
                          if( row_block!=false ){
410
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']).text("OVEN DIEBOND").addClass("font-bold  f12");
411
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').text(row_lot['oven_diebond_plan'].substring(0, row_lot['oven_diebond_plan'].length - 7)).addClass("time-text-plan  f12");
412
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_act').text(row_lot['ovediebond_act_time']).addClass("time-text-act ");
413
                            //console.log(row_lot['lot_no']+' block_ovediebond_act = '+row_lot['block_ovediebond_act']);
414
                           // console.log(row_lot['lot_no']+' oven_diebond_plan_diff = '+row_lot['oven_diebond_plan_diff']);
415
                            if( numeral(row_lot['oven_diebond_plan_diff']).value() > 4 ){
416
                                $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').addClass("bg-red");
417
                            }else if( numeral(row_lot['oven_diebond_plan_diff']).value() < -4 ){
418
                                $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').addClass("bg-yellow");
419
                            }   
420
                            block_no = row_block['block_no']-1;
421
                            prev_step = 1;
422
                          }
423
                   } 
424

    
425

    
426
                   if( (row_lot['block_diebond_act']!='undefined' 
427
                      && row_lot['block_diebond_act'].toString().length > 10) 
428
                      && (Date.parse(row_lot['block_diebond_act']) < Date.parse(Object.keys(list_blocks)[12]) 
429
                      && Date.parse(row_lot['block_diebond_act']) >= Date.parse(Object.keys(list_blocks)[0]) ) ){
430
                          row_block = find_block(row_lot['block_diebond_act']);
431
                          if( row_block!=false ){
432
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']).text("DIE BOND").addClass("font-bold  f12");
433
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').text(row_lot['diebond_plan'].substring(0, row_lot['diebond_plan'].length - 7)).addClass("time-text-plan  f12");
434
                            $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_act').text(row_lot['diebond_act_time']).addClass("time-text-act ");
435
                            //console.log(row_lot['lot_no']+' block_diebond_act = '+row_lot['block_diebond_act']);
436
                           // console.log(row_lot['lot_no']+' diebond_plan_diff = '+row_lot['diebond_plan_diff']);
437
                            if( numeral(row_lot['diebond_plan_diff']).value() > 4 ){
438
                                $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').addClass("bg-red");
439
                            }else if( numeral(row_lot['diebond_plan_diff']).value() < -4 ){
440
                                $('#'+row_lot['lot_no']+'_'+row_block['block_name']+'_plan').addClass("bg-yellow");
441
                            }   
442
                            block_no = row_block['block_no']-1;
443
                            prev_step = 0;
444
                          }
445
                   } 
446

    
447

    
448
                  if( block_no>0 ){
449
                                            
450
                                            for( j=block_no; j>=0; j-- ){
451
                                                  prev_step--; 
452
                                                  if( prev_step>=0 ){
453
                                                    key_lot = Object.values(list_step)[prev_step];
454
                                                    $('#'+row_lot['lot_no']+'_'+Object.values(list_blocks)[j]).text(key_lot['title']).addClass("font-bold  f12");
455
                                                    $('#'+row_lot['lot_no']+'_'+Object.values(list_blocks)[j]+'_plan').text(row_lot[key_lot['plan']]).addClass("time-text-plan ");
456
                                                    $('#'+row_lot['lot_no']+'_'+Object.values(list_blocks)[j]+'_act').text(row_lot[key_lot['act_time']]).addClass("time-text-act ");
457
                                                    //console.log(row_lot['lot_no']+Date.parse(row_lot[key_lot['act']]) , Date.parse(date_point));
458
                                                     // console.log(row_lot['lot_no']+ ' '+key_lot['plan'] +' = '+Date.parse(row_lot[key_lot['plan']]) );
459
                                                     // console.log(row_lot['lot_no']+ ' '+key_lot['act'] +' = '+Date.parse(row_lot[key_lot['act']]) );
460
                                                     // console.log(row_lot['lot_no']+' plan d-m-y  = '+ row_lot[key_lot['plan']].substring(0, 10) );
461
                                                    //console.log(row_lot['lot_no']+ ' '+' block '+' = '+Object.values(list_blocks)[j] );
462
                                                    if( numeral(row_lot[key_lot['diff']]).value() > 4 || row_lot[key_lot['act']]=="NaN" || Date.parse(row_lot[key_lot['act']]) < Date.parse(date_point) ){
463
                                                          if( Date.parse(row_lot[key_lot['plan']]) > Date.parse(row_lot[key_lot['act']]) && day_cal==row_lot[key_lot['plan']].substring(0, 10) ){
464
                                                              $('#'+row_lot['lot_no']+'_'+Object.values(list_blocks)[j]+'_plan').addClass("bg-yellow");
465
                                                          }else{
466
                                                                //if( numeral(row_lot[key_lot['diff']]).value() > 4 ){
467
                                                                  $('#'+row_lot['lot_no']+'_'+Object.values(list_blocks)[j]+'_plan').addClass("bg-red");
468
                                                                //}
469
                                                          }   
470
                                                          $('#'+row_lot['lot_no']+'_'+Object.values(list_blocks)[j]+'_plan').text(row_lot[key_lot['plan']].substring(0, row_lot[key_lot['plan']].length - 7)).addClass("time-text-plan  f12");
471
                                                          $('#'+row_lot['lot_no']+'_'+Object.values(list_blocks)[j]+'_act').text(row_lot[key_lot['act']].substring(0, row_lot[key_lot['act']].length - 7)).addClass("time-text-act f12");
472
                                                    }
473
                                                  }
474
                                            }
475
                  }
476
                    
477
              }
478
 
479
        },
480
        error:function(err){
481
            alert('Error : '+err.responseText);
482
        }
483
      });
484

    
485
    }
486

    
487

    
488
    function init_auto_scroll(){
489
      window.scrollTo(0, 0);
490
      documentH = $( document ).height()-10;
491

    
492
      setTimeout( function(){ paused=false; js_control_auto_mode(); } , 10000);
493
    }
494

    
495
        function start_auto_scroll(){
496
            clearInterval(scrollerID);
497
            var id = setInterval(function(){
498
              window.scrollBy(0,2);
499
                      if( window.innerHeight + window.scrollY >= documentH ){
500
                          stop_auto_scroll();
501

    
502
                          //paused = true; 
503
                          //clearInterval(scrollerID);
504
                            
505
                          // setTimeout(function() {
506
                          //     location.replace("screen1");
507
                          // }, 10000);
508
                      }
509
            },interval);
510
            return id;
511
        }
512

    
513

    
514
        function stop_auto_scroll(){
515
           clearInterval(scrollerID);
516
           paused = true;
517
           setTimeout( function(){ init_auto_scroll(); } , 10000);
518

    
519
        }
520

    
521

    
522
        function js_control_auto_mode(){
523
              if(paused == false) {
524
                  scrollerID = start_auto_scroll();
525
              }
526
              
527
              if(paused == true){
528
                  stop_auto_scroll();
529
              }
530
        }
531

    
532
        //scrollerID = setTimeout( function(){ start_auto_scroll() } ,10000);  
533

    
534
</script>
535
@endsection
536

    
537

    
538
<style>
539

    
540
html,body {
541
    text-align: center;
542
    /* background: #DCDCDC; */
543
    background: #FFF;
544
    color: #000;
545
    margin: 0;
546
    
547
  }
548

    
549

    
550
  table, td, th {
551
    border: solid 1px #FFF;
552
    border-collapse: collapse;
553
    border-spacing:0;
554
    color: #000;
555
    /* background: #DCDCDC; */
556
    background: #FFF;
557
    /* font-weight: bold; */
558
    font-size:18px !important;
559
    padding:5px;
560
    height:40px;
561
    vertical-align: middle !important;
562
  }
563

    
564
.textAlignVer{
565
  display:block;
566
    filter: flipv fliph;
567
    position:relative;
568
    white-space:nowrap;
569
    font-size:12px;
570
    margin-top: 70px;
571

    
572
}
573

    
574
.textnumberright{
575
  style="text-align: right;"
576
}
577

    
578
@font-face {
579
  font-family: 'DIGITAL';
580
  src: url('https://cssdeck.com/uploads/resources/fonts/digii/DS-DIGII.TTF');
581
}
582

    
583

    
584
/* .digital-clock {
585
  margin: auto;
586
  top: 0;
587
  left: 0;
588
  bottom: 0;
589
  right: 0;
590
  color: #000;
591
  text-align: center;
592
  font: 50px/60px 'DIGITAL',;
593
} */
594
.memumain{
595
  text-align: center;
596
  font-size:16px;
597
  padding-top:5px;
598

    
599
}
600
/* .digital-date {
601
  margin: auto;
602
  top: 0;
603
  left: 0;
604
  bottom: 0;
605
  right: 0;
606
  color: #000;
607
  text-align: center;
608
  font: 50px/60px 'DIGITAL',;
609
} */
610

    
611

    
612
.border_bold{
613
    border: solid 0.2rem #000 !important;
614

    
615
}
616

    
617
.border-bold-thin{
618
    border: 0.1rem solid #000 !important;
619

    
620
}
621
.border-top-thin {
622
    border-top: 0.1rem solid #000 !important;
623
}
624

    
625
.border-right-thin {
626
    border-right: 0.1rem solid #000 !important;
627
}
628

    
629
.border-bottom-thin {
630
    border-bottom: 0.1rem solid #000 !important;
631
}
632

    
633
.border-left-thin {
634
    border-left: 0.1rem solid #000 !important;
635
}
636

    
637
.v-middle{
638
  vertical-align: middle !important;
639
}
640

    
641
.f20 {
642
  font-size: 20px !important;
643
}
644

    
645
.f18 {
646
  font-size: 18px !important;
647
}
648

    
649
.f17 {
650
  font-size: 17px !important;
651
}
652

    
653
.f16 {
654
  font-size: 16px !important;
655
}
656

    
657
.f14 {
658
  font-size: 14px !important;
659
}
660

    
661
.f12 {
662
   font-size: 12px !important;
663
}
664

    
665
.f10 {
666
   font-size: 10px !important;
667
}
668

    
669

    
670
.w5{
671
  width:5rem;
672
}
673

    
674
.w12{
675
  width:12rem;
676
}
677

    
678
.w20{
679
  width:20rem;
680
}
681

    
682
.w-6{
683
  width:6% !important;
684
}
685

    
686
.w-7{
687
  width:7% !important;
688
}
689

    
690
.w-8{
691
  width:8% !important;
692
}
693

    
694
.w-10{
695
  width:10% !important;
696
}
697

    
698
.w-15{
699
  width:15% !important;
700
}
701

    
702
.w-40{
703
  width:40% !important;
704
}
705

    
706
.w-70{
707
  width:70% !important;
708
}
709

    
710
.w-85{
711
  width:85% !important;
712
}
713

    
714
.w-90{
715
  width:90% !important;
716
}
717

    
718
.w-auto{
719
  width:100% !important;
720
}
721

    
722
.table-fixed td.text-over span {
723
    white-space: nowrap;
724
    /* overflow: hidden; */
725
    text-overflow: ellipsis;
726
    display: inline-block;
727
    max-width: 150px;
728
}
729

    
730
.bg-white {
731
   background: white;
732
   color: #000;
733
}
734

    
735
.bg-red {
736
  background: red !important;
737
  color:#FFF;
738
}
739

    
740
.bg-yellow {
741
  background: yellow !important;
742
  color:#000 !important;
743
}
744

    
745
.time-text-plan {
746
  background: #24ad04;
747
  color:#FFF;
748
  /* font-size: 20 !important; */
749
  font-weight: normal !important;
750
}
751

    
752
.time-text-act {
753
  background: #706e6e36;
754
  color:#000;
755
  /* font-size: 20 !important; */
756
  font-weight: normal !important;
757
}
758

    
759
.time-text-delay {
760
  background: red;
761
  color:#fff;
762
  /* font-size: 20 !important; */
763
  font-weight: normal !important;
764
}
765

    
766
.font-bold {
767
  font-weight: bold !important;
768
}
769

    
770
.v-align{
771
  vertical-align: middle !important;
772
}
773

    
774

    
775
</style>
776

    
777
@section("content")
778
<div class="w-auto no-gutters d-flex" style="color:#000;">
779
    <div class="w-85 flex-fill">
780
        <div style="padding:10px;" class="wrapper">
781
            <table class=" table table-sm border_bold table-fixed">
782
              <thead>
783
                    <tr>
784
                      <th colspan="16"  class="text-center border-bottom-thin "><h5 class="font-weight-bold">Production Control Board</h5></th>
785
                    </tr>
786

    
787
                    <tr>
788
                      <th rowspan="2"  class=" w-6 text-center border-bottom-thin border-right-thin"><p style="font-size:24px;">5W<p></th>
789
                      <th colspan="2"  class=" text-center border-bottom-thin border-right-thin"><h6 class="font-weight-bold">Date : <span id="id_dateshow"></span></h6></th>
790
                      <th colspan="2"  class=" text-center border-bottom-thin border-right-thin"><h6 class="font-weight-bold">Time : <span id="digital-time"></span></h6></th>
791
                      <th   class="w-6 text-center border-bottom-thin border-right-thin">&nbsp;</th>
792
                      <th   class="w-6 text-center border-bottom-thin border-right-thin"><h6 class="font-weight-bold">Total</h6></th>
793
                      <th   class="w-6 text-center border-bottom-thin border-right-thin"><h6 class="font-weight-bold" id="id_total"></h6></th>
794
                      <th   class="w-6 text-center border-bottom-thin border-right-thin"><h6 class="font-weight-bold" >Not Start</h6></th>
795
                      <th   class="w-6 text-center border-bottom-thin border-right-thin"><h6 class="font-weight-bold" id="id_not_start"></h6></th>
796
                      <th   class="w-6 text-center border-bottom-thin border-right-thin"><h6 class="font-weight-bold">Finish</h6></th>
797
                      <th   class="w-6 text-center border-bottom-thin border-right-thin"><h6 class="font-weight-bold" id="id_finish"></h6></th>
798
                      <th   class="w-6 text-center border-bottom-thin border-right-thin">&nbsp;</th>
799
                      <th   class="w-6 text-center border-bottom-thin border-right-thin time-text-plan"><h6 class="font-weight-bold">Finish</h6></th>
800
                      <th   class="w-6 text-center border-bottom-thin border-right-thin time-text-act"><h6 class="font-weight-bold">Plan</h6></th>
801
                      <th   class="w-6 text-center border-bottom-thin time-text-delay"><h6 class="font-weight-bold">Start Delay</h6></th>
802
                    </tr>
803

    
804
                    <tr>
805
                      <th class="w-8 text-center border-bottom-thin border-right-thin ">&nbsp;</th>
806
                      <th class="w-6 text-center border-bottom-thin border-right-thin ">&nbsp;</th>
807
                      <? if( isset($list_blocks) ) { 
808
                            foreach( $list_blocks as $key=>$block ){?>
809
                                <th class="w-6 text-center border-bottom-thin border-right-thin time-text-plan f20"><?=substr($key,11)?></th>
810
                      <?    } 
811
                        } ?>
812
                    </tr>
813
              </thead>
814
              <? $count = 0; ?>
815
              <tbody>
816
                    
817
                  <? if( isset($list_lot_no) && count($list_lot_no)>0){
818
                      foreach( $list_lot_no as $row_lot_no ){?>
819

    
820
                        <tr>
821
                              <td  rowspan="3" class="w-6 text-center border-bottom-thin border-right-thin v-align"><?=++$count?></td>
822
                              <td colspan="2" class=" text-center border-bottom-thin border-right-thin">LotNo</td>
823
                              <? if( isset($list_blocks) ) { 
824
                                    foreach( $list_blocks as $key=>$block ){?>
825
                                        <td class="w-6 text-center text-center border-bottom-thin border-right-thin " id="<?=$row_lot_no->lot_no?>_<?=$block?>"></td>
826
                              <?    } 
827
                                } ?>
828
                        </tr>
829
                        </tr>
830

    
831
                        <tr>
832
                              <td  class="w-8 text-center border-bottom-thin border-right-thin time-text-plan f20"><?=$row_lot_no->lot_no?></td>
833
                              <td  class="w-6 text-center border-bottom-thin border-right-thin time-text-plan f20">Plan</td>
834
                                <? if( isset($list_blocks) ) { 
835
                                      foreach( $list_blocks as $block ){?>
836
                                          <td class="w-6 text-center text-center border-bottom-thin border-right-thin" id="<?=$row_lot_no->lot_no?>_<?=$block?>_plan"></td>
837
                                <?    } 
838
                                  } ?>
839
                        </tr>
840

    
841
                        <tr>
842
                              <td  class="w-8 text-center border-bottom-thin border-right-thin time-text-act f20"><?=$row_lot_no->lot_no?></td>
843
                              <td  class="w-6 text-center border-bottom-thin border-right-thin time-text-act f20">Actual</td>
844
                                <? if( isset($list_blocks) ) { 
845
                                      foreach( $list_blocks as $block ){?>
846
                                          <td class="w-6 text-center text-center border-bottom-thin border-right-thin" id="<?=$row_lot_no->lot_no?>_<?=$block?>_act"></td>
847
                                <?    } 
848
                                  } ?>
849
                        </tr>    
850

    
851
                  <?  }
852
                    }?>
853

    
854
              </tbody>
855

    
856
            </table>
857

    
858
            @section("script")
859
              <script type="text/javascript">
860

    
861
              </script>
862
            @endsection
863
        </div>  
864
    </div>
865
     
866
</div>
867

    
868
@endsection
869

    
(2-2/2)