修改
This commit is contained in:
@@ -75,6 +75,7 @@ public class DeviceScreenServiceImpl implements DeviceScreenService {
|
||||
public JSONObject oeeAndTeep(JSONObject param) {
|
||||
JSONObject oee = new JSONObject();
|
||||
JSONObject teep = new JSONObject();
|
||||
|
||||
//value1:过去一个月;value2:目标;value3:实际
|
||||
oee.put("value1", "78.0");
|
||||
oee.put("value2", "67.0");
|
||||
@@ -104,7 +105,8 @@ public class DeviceScreenServiceImpl implements DeviceScreenService {
|
||||
|
||||
@Override
|
||||
public JSONObject deviceErrorNum(JSONObject param) {
|
||||
JSONArray result = WQL.getWO("QDEVICE_SCREEN").addParam("flag", "2").process().getResultJSONArray(0);
|
||||
String today = DateUtil.today() + "%";
|
||||
JSONArray result = WQL.getWO("QDEVICE_SCREEN").addParam("flag", "2").addParam("today",today).process().getResultJSONArray(0);
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "查询成功!");
|
||||
@@ -115,6 +117,7 @@ public class DeviceScreenServiceImpl implements DeviceScreenService {
|
||||
@Override
|
||||
public JSONObject deviceManage(JSONObject param) {
|
||||
String today = DateUtil.today() + "%";
|
||||
final String now = DateUtil.today();
|
||||
Date today_begin = DateUtil.beginOfDay(DateUtil.date());
|
||||
//弯头工段
|
||||
JSONObject jo1 = new JSONObject();
|
||||
@@ -127,24 +130,24 @@ public class DeviceScreenServiceImpl implements DeviceScreenService {
|
||||
JSONObject device = wt_run_rows.getJSONObject(i);
|
||||
String start_time = device.getString("start_time");
|
||||
String end_time = device.getString("end_time");
|
||||
if (start_time.startsWith(today) && StrUtil.isNotEmpty(end_time)) {
|
||||
if (start_time.startsWith(now) && StrUtil.isNotEmpty(end_time)) {
|
||||
Date date1 = DateUtil.parse(start_time);
|
||||
Date date2 = DateUtil.parse(end_time);
|
||||
long between = DateUtil.between(date1, date2, DateUnit.HOUR);
|
||||
wt_mibf += between;
|
||||
}
|
||||
if (start_time.startsWith(today) && StrUtil.isEmpty(end_time)) {
|
||||
if (start_time.startsWith(now) && StrUtil.isEmpty(end_time)) {
|
||||
Date date1 = DateUtil.parse(start_time);
|
||||
Date date2 = DateUtil.date();
|
||||
long between = DateUtil.between(date1, date2, DateUnit.HOUR);
|
||||
wt_mibf += between;
|
||||
}
|
||||
if (!start_time.startsWith(today) && StrUtil.isEmpty(end_time)) {
|
||||
if (!start_time.startsWith(now) && StrUtil.isEmpty(end_time)) {
|
||||
Date date2 = DateUtil.date();
|
||||
long between = DateUtil.between(today_begin, date2, DateUnit.HOUR);
|
||||
wt_mibf += between;
|
||||
}
|
||||
if (!start_time.startsWith(today) && StrUtil.isNotEmpty(end_time)) {
|
||||
if (!start_time.startsWith(now) && StrUtil.isNotEmpty(end_time)) {
|
||||
Date date2 = DateUtil.parse(end_time);
|
||||
long between = DateUtil.between(today_begin, date2, DateUnit.HOUR);
|
||||
wt_mibf += between;
|
||||
@@ -157,24 +160,24 @@ public class DeviceScreenServiceImpl implements DeviceScreenService {
|
||||
JSONObject device = wt_err_rows.getJSONObject(i);
|
||||
String start_time = device.getString("start_time");
|
||||
String end_time = device.getString("end_time");
|
||||
if (start_time.startsWith(today) && StrUtil.isNotEmpty(end_time)) {
|
||||
if (start_time.startsWith(now) && StrUtil.isNotEmpty(end_time)) {
|
||||
Date date1 = DateUtil.parse(start_time);
|
||||
Date date2 = DateUtil.parse(end_time);
|
||||
long between = DateUtil.between(date1, date2, DateUnit.HOUR);
|
||||
wt_mttr += between;
|
||||
}
|
||||
if (start_time.startsWith(today) && StrUtil.isEmpty(end_time)) {
|
||||
if (start_time.startsWith(now) && StrUtil.isEmpty(end_time)) {
|
||||
Date date1 = DateUtil.parse(start_time);
|
||||
Date date2 = DateUtil.date();
|
||||
long between = DateUtil.between(date1, date2, DateUnit.HOUR);
|
||||
wt_mttr += between;
|
||||
}
|
||||
if (!start_time.startsWith(today) && StrUtil.isEmpty(end_time)) {
|
||||
if (!start_time.startsWith(now) && StrUtil.isEmpty(end_time)) {
|
||||
Date date2 = DateUtil.date();
|
||||
long between = DateUtil.between(today_begin, date2, DateUnit.HOUR);
|
||||
wt_mttr += between;
|
||||
}
|
||||
if (!start_time.startsWith(today) && StrUtil.isNotEmpty(end_time)) {
|
||||
if (!start_time.startsWith(now) && StrUtil.isNotEmpty(end_time)) {
|
||||
Date date2 = DateUtil.parse(end_time);
|
||||
long between = DateUtil.between(today_begin, date2, DateUnit.HOUR);
|
||||
wt_mttr += between;
|
||||
@@ -190,62 +193,62 @@ public class DeviceScreenServiceImpl implements DeviceScreenService {
|
||||
double zh_mibf = 0;
|
||||
double zh_mttr = 0;
|
||||
//计算mibf
|
||||
JSONArray zh_run_rows = WQL.getWO("QDEVICE_SCREEN").addParam("flag", "3").addParam("worksection_type_scode", "01").addParam("today", today).process().getResultJSONArray(0);
|
||||
JSONArray zh_run_rows = WQL.getWO("QDEVICE_SCREEN").addParam("flag", "3").addParam("worksection_type_scode", "02").addParam("today", today).process().getResultJSONArray(0);
|
||||
for (int i = 0; i < zh_run_rows.size(); i++) {
|
||||
JSONObject device = zh_run_rows.getJSONObject(i);
|
||||
String start_time = device.getString("start_time");
|
||||
String end_time = device.getString("end_time");
|
||||
if (start_time.startsWith(today) && StrUtil.isNotEmpty(end_time)) {
|
||||
if (start_time.startsWith(now) && StrUtil.isNotEmpty(end_time)) {
|
||||
Date date1 = DateUtil.parse(start_time);
|
||||
Date date2 = DateUtil.parse(end_time);
|
||||
long between = DateUtil.between(date1, date2, DateUnit.HOUR);
|
||||
wt_mibf += between;
|
||||
zh_mibf += between;
|
||||
}
|
||||
if (start_time.startsWith(today) && StrUtil.isEmpty(end_time)) {
|
||||
if (start_time.startsWith(now) && StrUtil.isEmpty(end_time)) {
|
||||
Date date1 = DateUtil.parse(start_time);
|
||||
Date date2 = DateUtil.date();
|
||||
long between = DateUtil.between(date1, date2, DateUnit.HOUR);
|
||||
wt_mibf += between;
|
||||
zh_mibf += between;
|
||||
}
|
||||
if (!start_time.startsWith(today) && StrUtil.isEmpty(end_time)) {
|
||||
if (!start_time.startsWith(now) && StrUtil.isEmpty(end_time)) {
|
||||
Date date2 = DateUtil.date();
|
||||
long between = DateUtil.between(today_begin, date2, DateUnit.HOUR);
|
||||
wt_mibf += between;
|
||||
zh_mibf += between;
|
||||
}
|
||||
if (!start_time.startsWith(today) && StrUtil.isNotEmpty(end_time)) {
|
||||
if (!start_time.startsWith(now) && StrUtil.isNotEmpty(end_time)) {
|
||||
Date date2 = DateUtil.parse(end_time);
|
||||
long between = DateUtil.between(today_begin, date2, DateUnit.HOUR);
|
||||
wt_mibf += between;
|
||||
zh_mibf += between;
|
||||
}
|
||||
}
|
||||
|
||||
//计算mmttr
|
||||
JSONArray zh_err_rows = WQL.getWO("QDEVICE_SCREEN").addParam("flag", "4").addParam("worksection_type_scode", "01").addParam("today", today).process().getResultJSONArray(0);
|
||||
JSONArray zh_err_rows = WQL.getWO("QDEVICE_SCREEN").addParam("flag", "4").addParam("worksection_type_scode", "02").addParam("today", today).process().getResultJSONArray(0);
|
||||
for (int i = 0; i < zh_err_rows.size(); i++) {
|
||||
JSONObject device = zh_err_rows.getJSONObject(i);
|
||||
String start_time = device.getString("start_time");
|
||||
String end_time = device.getString("end_time");
|
||||
if (start_time.startsWith(today) && StrUtil.isNotEmpty(end_time)) {
|
||||
if (start_time.startsWith(now) && StrUtil.isNotEmpty(end_time)) {
|
||||
Date date1 = DateUtil.parse(start_time);
|
||||
Date date2 = DateUtil.parse(end_time);
|
||||
long between = DateUtil.between(date1, date2, DateUnit.HOUR);
|
||||
wt_mttr += between;
|
||||
zh_mttr += between;
|
||||
}
|
||||
if (start_time.startsWith(today) && StrUtil.isEmpty(end_time)) {
|
||||
if (start_time.startsWith(now) && StrUtil.isEmpty(end_time)) {
|
||||
Date date1 = DateUtil.parse(start_time);
|
||||
Date date2 = DateUtil.date();
|
||||
long between = DateUtil.between(date1, date2, DateUnit.HOUR);
|
||||
wt_mttr += between;
|
||||
zh_mttr += between;
|
||||
}
|
||||
if (!start_time.startsWith(today) && StrUtil.isEmpty(end_time)) {
|
||||
if (!start_time.startsWith(now) && StrUtil.isEmpty(end_time)) {
|
||||
Date date2 = DateUtil.date();
|
||||
long between = DateUtil.between(today_begin, date2, DateUnit.HOUR);
|
||||
wt_mttr += between;
|
||||
zh_mttr += between;
|
||||
}
|
||||
if (!start_time.startsWith(today) && StrUtil.isNotEmpty(end_time)) {
|
||||
if (!start_time.startsWith(now) && StrUtil.isNotEmpty(end_time)) {
|
||||
Date date2 = DateUtil.parse(end_time);
|
||||
long between = DateUtil.between(today_begin, date2, DateUnit.HOUR);
|
||||
wt_mttr += between;
|
||||
zh_mttr += between;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,62 +261,62 @@ public class DeviceScreenServiceImpl implements DeviceScreenService {
|
||||
double cp_mibf = 0;
|
||||
double cp_mttr = 0;
|
||||
//计算mibf
|
||||
JSONArray cp_run_rows = WQL.getWO("QDEVICE_SCREEN").addParam("flag", "3").addParam("worksection_type_scode", "01").addParam("today", today).process().getResultJSONArray(0);
|
||||
JSONArray cp_run_rows = WQL.getWO("QDEVICE_SCREEN").addParam("flag", "3").addParam("worksection_type_scode", "03").addParam("today", today).process().getResultJSONArray(0);
|
||||
for (int i = 0; i < cp_run_rows.size(); i++) {
|
||||
JSONObject device = cp_run_rows.getJSONObject(i);
|
||||
String start_time = device.getString("start_time");
|
||||
String end_time = device.getString("end_time");
|
||||
if (start_time.startsWith(today) && StrUtil.isNotEmpty(end_time)) {
|
||||
if (start_time.startsWith(now) && StrUtil.isNotEmpty(end_time)) {
|
||||
Date date1 = DateUtil.parse(start_time);
|
||||
Date date2 = DateUtil.parse(end_time);
|
||||
long between = DateUtil.between(date1, date2, DateUnit.HOUR);
|
||||
wt_mibf += between;
|
||||
cp_mibf += between;
|
||||
}
|
||||
if (start_time.startsWith(today) && StrUtil.isEmpty(end_time)) {
|
||||
if (start_time.startsWith(now) && StrUtil.isEmpty(end_time)) {
|
||||
Date date1 = DateUtil.parse(start_time);
|
||||
Date date2 = DateUtil.date();
|
||||
long between = DateUtil.between(date1, date2, DateUnit.HOUR);
|
||||
wt_mibf += between;
|
||||
cp_mibf += between;
|
||||
}
|
||||
if (!start_time.startsWith(today) && StrUtil.isEmpty(end_time)) {
|
||||
if (!start_time.startsWith(now) && StrUtil.isEmpty(end_time)) {
|
||||
Date date2 = DateUtil.date();
|
||||
long between = DateUtil.between(today_begin, date2, DateUnit.HOUR);
|
||||
wt_mibf += between;
|
||||
cp_mibf += between;
|
||||
}
|
||||
if (!start_time.startsWith(today) && StrUtil.isNotEmpty(end_time)) {
|
||||
if (!start_time.startsWith(now) && StrUtil.isNotEmpty(end_time)) {
|
||||
Date date2 = DateUtil.parse(end_time);
|
||||
long between = DateUtil.between(today_begin, date2, DateUnit.HOUR);
|
||||
wt_mibf += between;
|
||||
cp_mibf += between;
|
||||
}
|
||||
}
|
||||
|
||||
//计算mmttr
|
||||
JSONArray cp_err_rows = WQL.getWO("QDEVICE_SCREEN").addParam("flag", "4").addParam("worksection_type_scode", "01").addParam("today", today).process().getResultJSONArray(0);
|
||||
JSONArray cp_err_rows = WQL.getWO("QDEVICE_SCREEN").addParam("flag", "4").addParam("worksection_type_scode", "03").addParam("today", today).process().getResultJSONArray(0);
|
||||
for (int i = 0; i < cp_err_rows.size(); i++) {
|
||||
JSONObject device = cp_err_rows.getJSONObject(i);
|
||||
String start_time = device.getString("start_time");
|
||||
String end_time = device.getString("end_time");
|
||||
if (start_time.startsWith(today) && StrUtil.isNotEmpty(end_time)) {
|
||||
if (start_time.startsWith(now) && StrUtil.isNotEmpty(end_time)) {
|
||||
Date date1 = DateUtil.parse(start_time);
|
||||
Date date2 = DateUtil.parse(end_time);
|
||||
long between = DateUtil.between(date1, date2, DateUnit.HOUR);
|
||||
wt_mttr += between;
|
||||
cp_mttr += between;
|
||||
}
|
||||
if (start_time.startsWith(today) && StrUtil.isEmpty(end_time)) {
|
||||
if (start_time.startsWith(now) && StrUtil.isEmpty(end_time)) {
|
||||
Date date1 = DateUtil.parse(start_time);
|
||||
Date date2 = DateUtil.date();
|
||||
long between = DateUtil.between(date1, date2, DateUnit.HOUR);
|
||||
wt_mttr += between;
|
||||
cp_mttr += between;
|
||||
}
|
||||
if (!start_time.startsWith(today) && StrUtil.isEmpty(end_time)) {
|
||||
if (!start_time.startsWith(now) && StrUtil.isEmpty(end_time)) {
|
||||
Date date2 = DateUtil.date();
|
||||
long between = DateUtil.between(today_begin, date2, DateUnit.HOUR);
|
||||
wt_mttr += between;
|
||||
cp_mttr += between;
|
||||
}
|
||||
if (!start_time.startsWith(today) && StrUtil.isNotEmpty(end_time)) {
|
||||
if (!start_time.startsWith(now) && StrUtil.isNotEmpty(end_time)) {
|
||||
Date date2 = DateUtil.parse(end_time);
|
||||
long between = DateUtil.between(today_begin, date2, DateUnit.HOUR);
|
||||
wt_mttr += between;
|
||||
cp_mttr += between;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -494,12 +497,12 @@ public class DeviceScreenServiceImpl implements DeviceScreenService {
|
||||
//OEE计算目标:当天汇总/(产能x负荷时间);实际:(班制时间-故障时间)/班制时间 * (当天工单汇总/(产能*(符合时间-故障时间)))* 98%
|
||||
if (type.equals("1")) {
|
||||
//8是指符合时间,也就是每天的工作时间
|
||||
oee = NumberUtil.div(total_qty, NumberUtil.mul(8, productivity));
|
||||
oee = NumberUtil.div(total_qty, NumberUtil.mul(16, productivity));
|
||||
} else {
|
||||
//(班制时间-故障时间)/班制时间
|
||||
double value1 = NumberUtil.div(NumberUtil.sub(8 * 60, err_time), 8 * 60);
|
||||
double value1 = NumberUtil.div(NumberUtil.sub(16 * 60, err_time), 16 * 60);
|
||||
//(产能*(符合时间-故障时间)
|
||||
double value2 = NumberUtil.div(total_qty, NumberUtil.mul(productivity, value1));
|
||||
double value2 = NumberUtil.div(total_qty, NumberUtil.mul(productivity, NumberUtil.sub(16 * 60, err_time)));
|
||||
oee = NumberUtil.mul(value1, value2);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,8 @@
|
||||
LEFT JOIN pdm_bi_device device ON device.device_id = run.device_id
|
||||
WHERE
|
||||
run.status_type = '05'
|
||||
AND
|
||||
run.start_time LIKE 输入.today
|
||||
GROUP BY
|
||||
run.device_id
|
||||
ORDER BY err_num desc
|
||||
@@ -153,7 +155,7 @@
|
||||
LEFT JOIN pdm_bi_device device ON device.device_id = run.device_id
|
||||
WHERE
|
||||
run.status_type = '05'
|
||||
AND DATE_SUB( CURDATE(), INTERVAL 10 DAY ) <= date( start_time )
|
||||
AND DATE_SUB( CURDATE(), INTERVAL 30 DAY ) <= date( start_time )
|
||||
GROUP BY
|
||||
run.device_id
|
||||
|
||||
|
||||
Reference in New Issue
Block a user