forked from HANYANG/HANYANG_MES
204 lines
7.2 KiB
PHP
204 lines
7.2 KiB
PHP
<?php
|
|
$cate_id = "PRODUCT_PLANING"; //현재 메뉴 ID 필수!!!
|
|
include_once "{$_SERVER['DOCUMENT_ROOT']}/common.inc.php";
|
|
include_once _SVC_INC_PATH_ . "/auth_check.php";
|
|
|
|
include_once _SVC_INC_PATH_ ."/header.php";
|
|
|
|
include_once _SVC_INC_PATH_ ."/frame_header.php";
|
|
|
|
$varsFactList = $cmv_obj->getFacilityList2();
|
|
?>
|
|
<div id="mtop_title_block">
|
|
<div id="mtop_title">
|
|
<div class="title"><i class="<?=$GLOBALS['_Menu_']['menu_class']?>"></i> <?=$GLOBALS['_Menu_']['menu_name']?></div>
|
|
<div class="top_breadcrumb"><?=$top_breadcrumb?></div>
|
|
</div>
|
|
<div id="mtop_btn_group">
|
|
<!-- 버튼 -->
|
|
</div>
|
|
</div>
|
|
|
|
<div id="mtop_search" class="form-inline">
|
|
<!--
|
|
<div class="search_item form-inline">
|
|
<span class="label_title">계획일 </span>
|
|
<input type="date" max="9999-12-31" max="9999-12-31" id="S_SO_PLAN_DT" name="S_SO_DT_ST" class="form-control">
|
|
</div>
|
|
<div class="search_item form-inline">
|
|
<span class="label_title">수주번호 </span>
|
|
<span><input type="text" id="S_PLAN_NO" name="S_SO_NO" class="form-control"></span>
|
|
</div>-->
|
|
<div class="search_item form-inline mr-5 w-100 justify-content-between">
|
|
<span>
|
|
<span class="label_title">설비 </span>
|
|
<!--
|
|
<span><input type="text" id="S_FACLT_CD" name="S_FACLT_CD" class="form-control" hidden></span>
|
|
<span><input type="text" id="S_FACLT_NM" name="S_FACLT_NM" class="form-control"></span>-->
|
|
<span>
|
|
<select id="S_FACLT_CD" class="form-controlm form-select-sm">
|
|
<?= getSelectOptions( $varsFactList, $emptv="-전 체-" ) ?>
|
|
</select>
|
|
</span>
|
|
</span>
|
|
<span class="font07">
|
|
<?php foreach( $GLOBALS['_TLColor'] as $k => $tlc ){?>
|
|
<span class="btn btn-sm btn_pcolor col_odia<?=substr($k,-1)?>"></span><?=$tlc[1]?>,
|
|
<?php }?>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="main_content">
|
|
|
|
<div class="ctop_title">
|
|
<div class="content_title">생산계획</div>
|
|
<div class="text-center form-inline">
|
|
<button type="button" id="btn_plan_prev" class="btn btn-secondary"><i class="fa-solid fa-angle-left"></i></button>
|
|
<select id="S_DT_TYPE" name="S_DT_TYPE" class="form-controlm form-select-sm">
|
|
<option value="">일단위</option>
|
|
<option value="W">주단위</option>
|
|
<option value="M">월단위</option>
|
|
</select>
|
|
<input type="date" max="9999-12-31" id="S_SO_PLAN_DT" name="S_SO_DT_ST" class="form-control">
|
|
<select id="S_DT_ADTERM" name="S_DT_ADTERM" class="form-control form-select w50">
|
|
<?php for($a=1;$a<=31;$a++){?>
|
|
<option value="<?=$a?>"><?=$a?></option>
|
|
<?php }?>
|
|
</select>
|
|
<button type="button" id="btn_plan_next" class="btn btn-secondary"><i class="fa-solid fa-angle-right"></i></button>
|
|
</div>
|
|
<div class="content_btn_group">
|
|
<a href="./planing_ready.php" id="btnNewTask" class="btn btn-nobd"><i class="fa-solid fa-plus"></i> 생산계획 추가</a>
|
|
<button id="btnPutPPlan" class="btn btn_prim"><i class="fa-solid fa-diagram-next"></i> 저장</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="tbl_block cont_hfix">
|
|
<div id="ProdPlan" class="h-100"><div></div></div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
include_once _SVC_INC_PATH_ ."/frame_footer.php";
|
|
|
|
include_once _SVC_INC_PATH_ ."/footer.php";
|
|
?>
|
|
|
|
<style>
|
|
<?php
|
|
foreach( $GLOBALS['_TLColor'] as $k => $tlc ){
|
|
?>
|
|
.col_odia<?=substr($k,-1)?> { background-color: <?=$tlc[0]?> }
|
|
|
|
<?php
|
|
}
|
|
?>
|
|
</style>
|
|
<script>
|
|
let varsItem = <?=json_encode($cmv_obj->getItemList())?>;
|
|
let varsFactInfo = <?=json_encode($cmv_obj->getFacilityList())?>;
|
|
let varOPGRP = <?=json_encode($cmv_obj->getOperationList())?>
|
|
</script>
|
|
|
|
<script>
|
|
let gantt_obj = {};
|
|
let ajax_url = './planing.ajax.php';
|
|
let ready_ajax_url = './planing_ready.ajax.php';
|
|
|
|
let gantt_ext = null,
|
|
ganttdata = null,
|
|
colors = ['blue', 'green', 'orange', ],
|
|
works = ['황삭','1차정삭','2차정삭','3차정삭','투공'],
|
|
addday = <?=$_REQUEST['a']?:0?>;
|
|
|
|
const weekOfMonth = (date, numOfDay) => {
|
|
let ndate = null;
|
|
if( typeof date === 'string' ){
|
|
ndate = luxon.DateTime.fromString(date,'y-MM-dd');
|
|
}else{
|
|
ndate = luxon.DateTime.fromMillis(date);
|
|
}
|
|
let fdate = luxon.DateTime.fromFormat(ndate.toFormat('y-MM-01'),'y-MM-dd');
|
|
let weeks = ndate.toFormat('W') - fdate.toFormat('W');
|
|
|
|
let fweek = fdate.toFormat('c');
|
|
if( fweek <= ((typeof numOfDay == 'undefined')?4:numOfDay) ){
|
|
weeks++;
|
|
}
|
|
return weeks;
|
|
}
|
|
|
|
const generateData = (currentStart, currentEnd) => {
|
|
const rows = [];
|
|
const tasks = [];
|
|
|
|
let days = Math.floor((currentEnd - currentStart)/86400000) + 1;
|
|
gantt_obj.varsFactInfo.forEach( (vf, i) => {
|
|
let rand_bool = Math.random() < 0.2;
|
|
|
|
rows.push({
|
|
id: vf.FACLT_CD,
|
|
headerHtml: vf.FACLT_NM,
|
|
label: vf.FACLT_NM,
|
|
classes: rand_bool ? ['row-disabled'] : undefined,
|
|
enableDragging: true,
|
|
usrdata: {
|
|
FACLT_CD: vf.FACLT_CD,
|
|
FACLT_NM: vf.FACLT_NM,
|
|
},
|
|
});
|
|
|
|
for( let a=0 ; a<2*days ; a++ ){
|
|
let from_d = null
|
|
do{
|
|
from_d = Math.random()*(currentEnd - currentStart);
|
|
//console.log(from_d);
|
|
}while( from_d > ((currentEnd - currentStart) - 3600000*5) );
|
|
|
|
let enable_rand = Math.floor(Math.random()*10)%2;
|
|
|
|
let to_d = null;
|
|
do{
|
|
to_d = Math.random()*(currentEnd - currentStart);
|
|
}while( to_d > (from_d + 3600000*5) || to_d < (from_d + 3600000*1) );
|
|
let from_dd = currentStart + from_d;
|
|
let to_dd = currentStart + to_d;
|
|
|
|
let col = Math.ceil(Math.random()*10);
|
|
|
|
tasks.push({
|
|
id: vf.FACLT_CD+'_'+a,
|
|
resourceId: vf.FACLT_CD,
|
|
cnt: a,
|
|
label: 'Task #'+vf.FACLT_CD +'_'+a,
|
|
from: from_dd,
|
|
to: to_dd,
|
|
classes: 'color'+col+' '+(enable_rand?'':'opacity-40 font-italic'),
|
|
html: set_task_title(works[(a%5)], from_dd, to_dd),
|
|
showButton: false,
|
|
usrdata: {
|
|
_STATUS_: '',
|
|
OP_CD: '',
|
|
OP_NM: works[(a%5)],
|
|
FACLT_CD: '',
|
|
FACLT_NM: 'CNC #' + (i+1).toString().padStart(2,'0'),
|
|
},
|
|
enableDragging: enable_rand,
|
|
});
|
|
}
|
|
} );
|
|
|
|
return { rows, tasks };
|
|
}
|
|
|
|
const set_task_title = (works, from, to) => {
|
|
return `<b>${works}</b> : ${luxon.DateTime.fromMillis(from).toFormat('MM-dd HH:mm')} ~ ${luxon.DateTime.fromMillis(to).toFormat('MM-dd HH:mm')}`
|
|
};
|
|
|
|
const task_title = (usrdata) => {
|
|
return `<div class='d-flex flex-column'><div class='font08 lh-1' style='line-height: 120%;'>${usrdata['OP_NM']} [${usrdata['MNG_NO']}]</div><div class='font06 lh-sm'>${usrdata['PLN_ST_TM']} ~ ${usrdata['PLN_ED_TM']}</div></div>`;
|
|
}
|
|
</script>
|
|
<script type="module" src="planing.js"></script>
|