Merge branch 'master' of http://121.40.234.130:8899/root/wuHanXinRui
This commit is contained in:
@@ -41,4 +41,11 @@ public class DownloadWordDto implements Serializable {
|
||||
@WordProperty("资产使用人")
|
||||
private String user_name;
|
||||
|
||||
@WordProperty("投产日期")
|
||||
private String beginuse_date;
|
||||
|
||||
|
||||
@WordProperty("存放地点")
|
||||
private String setting_place;
|
||||
|
||||
}
|
||||
|
||||
@@ -140,6 +140,8 @@ public class DeviceScrapServiceImpl implements DeviceScrapService {
|
||||
.oraginal_value(jsonFile.getString("oraginal_value"))
|
||||
.net_amount(jsonFile.getString("net_amount"))
|
||||
.belong_dept(jsonDept.getString("name"))
|
||||
.beginuse_date(jsonFile.getString("beginuse_date"))
|
||||
.setting_place(jsonFile.getString("setting_place"))
|
||||
.user_name(jsonFile.getString("user_name")).build();
|
||||
// 获取本地模板
|
||||
String path = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("DEVICE_WORD_PATH").getValue();
|
||||
|
||||
@@ -57,6 +57,14 @@ public class DevicefaultcaeController {
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PostMapping("/getFaultList")
|
||||
@Log("获取故障下拉框")
|
||||
@ApiOperation("获取故障下拉框")
|
||||
//@PreAuthorize("@el.check('devicesparepartivt:add')")
|
||||
public ResponseEntity<Object> getFaultList() {
|
||||
return new ResponseEntity<>(devicefaultcaeService.getFaultList(),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改设备故障分析")
|
||||
@ApiOperation("修改设备故障分析")
|
||||
|
||||
@@ -16,6 +16,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -39,4 +41,18 @@ public class DeviceooestatController {
|
||||
return new ResponseEntity<>(deviceooestatService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/queryDtl")
|
||||
@Log("设备OEE指标分析查询明细")
|
||||
@ApiOperation("设备OEE指标分析查询明细")
|
||||
//@PreAuthorize("@el.check('devicesparepartivt:list')")
|
||||
public ResponseEntity<Object> queryDtl(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(deviceooestatService.queryDtl(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
|
||||
deviceooestatService.download(whereJson, response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
package org.nl.wms.sb.stat.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.nl.wms.sb.stat.service.dto.DevicesparepartivtDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -82,4 +83,6 @@ public interface DevicefaultcaeService {
|
||||
*/
|
||||
Map<String, Object> dtlQuery(Map whereJson, Pageable page);
|
||||
|
||||
JSONArray getFaultList();
|
||||
|
||||
}
|
||||
|
||||
@@ -25,4 +25,15 @@ public interface DeviceooestatService {
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryDtl(Map whereJson, Pageable page);
|
||||
|
||||
void download(Map whereJson, HttpServletResponse response) throws IOException;
|
||||
|
||||
}
|
||||
|
||||
@@ -47,17 +47,21 @@ public class DevicefaultcaeServiceImpl implements DevicefaultcaeService {
|
||||
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
|
||||
String class_idStr = (String) whereJson.get("class_idStr");
|
||||
String device_gz = MapUtil.getStr(whereJson, "device_gz");
|
||||
String class_idStr2 = (String) whereJson.get("class_idStr2");
|
||||
|
||||
String device_code = MapUtil.getStr(whereJson, "device_code");
|
||||
String dept_id = MapUtil.getStr(whereJson, "dept_id");
|
||||
String begin_time = MapUtil.getStr(whereJson, "begin_time");
|
||||
String end_time = MapUtil.getStr(whereJson, "end_time");
|
||||
|
||||
if (ObjectUtil.isEmpty(begin_time)) {
|
||||
throw new BadRequestException("请选择日期");
|
||||
}
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "1");
|
||||
map.put("begin_time", begin_time);
|
||||
map.put("end_time", end_time);
|
||||
map.put("device_gz", device_gz);
|
||||
if (ObjectUtil.isNotEmpty(device_code)) map.put("device_code", "%"+device_code+"%");
|
||||
if (ObjectUtil.isNotEmpty(dept_id)) map.put("dept_id", "%"+dept_id+"%");
|
||||
//处理设备当前节点的所有子节点
|
||||
@@ -69,44 +73,50 @@ public class DevicefaultcaeServiceImpl implements DevicefaultcaeService {
|
||||
String classIds = classstandardService.getAllChildIdStr(class_idStr);
|
||||
map.put("classIds", classIds);
|
||||
}
|
||||
//处理故障当前节点的所有子节点
|
||||
if (!StrUtil.isEmpty(device_gz)) {
|
||||
map.put("device_gz", device_gz);
|
||||
String classIds2 = classstandardService.getChildIdStr(device_gz);
|
||||
map.put("classIds2", classIds2);
|
||||
} else if (ObjectUtil.isNotEmpty(class_idStr2)) {
|
||||
String classIds2 = classstandardService.getAllChildIdStr(class_idStr2);
|
||||
map.put("classIds2", classIds2);
|
||||
}
|
||||
|
||||
JSONObject json = WQL.getWO("EM_DEVICEFAULTCAE01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "re.devicerecord_id DESC");
|
||||
// 处理平均故障间隔时间 && 平均故障修复时间
|
||||
/* WQLObject tab = WQLObject.getWQLObject("EM_BI_DeviceRepairRequest");
|
||||
WQLObject tab = WQLObject.getWQLObject("EM_BI_DeviceRepairRequest");
|
||||
JSONArray content = json.getJSONArray("content");
|
||||
for (int i = 0; i < content.size(); i++) {
|
||||
JSONObject jsonObject = content.getJSONObject(i);
|
||||
String devicerecord_id = jsonObject.getString("devicerecord_id");
|
||||
JSONArray arr = tab.query("devicerecord_id = '" + devicerecord_id + "' and is_delete = '0'").getResultJSONArray(0);
|
||||
|
||||
// 计算平均故障修复时间
|
||||
String nunm = jsonObject.getString("nunm");
|
||||
String create_time_all = "0";
|
||||
String finish_time_all = "0";
|
||||
for (int j = 0; j < arr.size(); j++) {
|
||||
JSONObject jsonObject1 = arr.getJSONObject(j);
|
||||
// 去掉时间中的特殊字符
|
||||
String create_time = jsonObject1.getString("create_time").replaceAll("[[\\s-:punct:]]","");
|
||||
String create_time = jsonObject1.getString("create_time").substring(0,10).replaceAll("[[\\s-:punct:]]","");
|
||||
String finish_time = "0";
|
||||
if (ObjectUtil.isNotEmpty(jsonObject1.getString("finish_time"))) {
|
||||
finish_time = jsonObject1.getString("finish_time").replaceAll("[[\\s-:punct:]]","");
|
||||
finish_time = jsonObject1.getString("finish_time").substring(0,10).replaceAll("[[\\s-:punct:]]","");
|
||||
}
|
||||
// 相加
|
||||
create_time_all = String.valueOf(NumberUtil.add(create_time_all,create_time));
|
||||
finish_time_all = String.valueOf(NumberUtil.add(finish_time_all,finish_time));
|
||||
}
|
||||
BigDecimal avgRep_time = NumberUtil.div(String.valueOf(NumberUtil.sub(finish_time_all, create_time_all)), nunm);
|
||||
jsonObject.put("avgRep_time",String.valueOf(avgRep_time));
|
||||
BigDecimal mul = NumberUtil.mul(NumberUtil.sub(finish_time_all, create_time_all), 24);
|
||||
BigDecimal div = NumberUtil.div(mul.toString(), nunm);
|
||||
|
||||
if (div.intValue() < 0) {
|
||||
jsonObject.put("avgRep_time","0");
|
||||
} else {
|
||||
jsonObject.put("avgRep_time",String.valueOf(div));
|
||||
}
|
||||
|
||||
// 计算平均故障间隔时间
|
||||
String re_end_time = end_time.substring(0, 10).replaceAll("[[\\s-:punct:]]", "");
|
||||
String re_begin_time = begin_time.substring(0, 10).replaceAll("[[\\s-:punct:]]", "");
|
||||
|
||||
BigDecimal add = NumberUtil.add(NumberUtil.sub(re_end_time, re_begin_time).toString(), "1");
|
||||
BigDecimal avgVal_time = NumberUtil.div(NumberUtil.mul(add, 24).toString(), nunm);
|
||||
jsonObject.put("avgVal_time",avgVal_time.toString());
|
||||
}
|
||||
json.put("content",content);*/
|
||||
json.put("content",content);
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -243,4 +253,10 @@ public class DevicefaultcaeServiceImpl implements DevicefaultcaeService {
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getFaultList() {
|
||||
JSONArray resultJSONArray = WQL.getWO("EM_DEVICEFAULTCAE01").addParam("flag", "3").process().getResultJSONArray(0);
|
||||
return resultJSONArray;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,9 +5,11 @@ package org.nl.wms.sb.stat.service.impl;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.utils.FileUtil;
|
||||
import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||
import org.nl.wms.sb.stat.service.DeviceooestatService;
|
||||
import org.nl.wql.WQL;
|
||||
@@ -15,8 +17,9 @@ import org.nl.wql.util.WqlUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
@@ -51,15 +54,63 @@ public class DeviceooestatServiceImpl implements DeviceooestatService {
|
||||
map.put("classIds", classIds);
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(begin_time)) {
|
||||
map.put("flag", "1");
|
||||
} else {
|
||||
map.put("flag", "2");
|
||||
map.put("begin_time",begin_time);
|
||||
map.put("end_time",end_time);
|
||||
}
|
||||
map.put("flag", "2");
|
||||
map.put("begin_time",begin_time);
|
||||
map.put("end_time",end_time);
|
||||
JSONObject json = WQL.getWO("EM_DEVICEOOESTAT001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "file.device_code ASC");
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryDtl(Map whereJson, Pageable page) {
|
||||
|
||||
String begin_time = MapUtil.getStr(whereJson, "startTime");
|
||||
String end_time = MapUtil.getStr(whereJson, "endTime");
|
||||
String devicerecord_id = MapUtil.getStr(whereJson, "devicerecord_id");
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "1");
|
||||
map.put("begin_time", begin_time);
|
||||
map.put("end_time", end_time);
|
||||
map.put("devicerecord_id", devicerecord_id);
|
||||
JSONObject json = WQL.getWO("EM_DEVICEOOESTAT001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "run.run_date ASC");
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(Map whereJson, HttpServletResponse response) throws IOException {
|
||||
String begin_time = MapUtil.getStr(whereJson, "startTime");
|
||||
String end_time = MapUtil.getStr(whereJson, "endTime");
|
||||
String devicerecord_id = MapUtil.getStr(whereJson, "devicerecord_id");
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "1");
|
||||
map.put("begin_time", begin_time);
|
||||
map.put("end_time", end_time);
|
||||
map.put("devicerecord_id", devicerecord_id);
|
||||
|
||||
JSONArray rows = WQL.getWO("EM_DEVICEOOESTAT001").addParamMap(map).process().getResultJSONArray(0);
|
||||
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject jo = rows.getJSONObject(i);
|
||||
Map<String, Object> dtl_map = new LinkedHashMap<>();
|
||||
dtl_map.put("日期", jo.getString("run_date"));
|
||||
dtl_map.put("设备编码", jo.getString("device_code"));
|
||||
dtl_map.put("设备名称", jo.getString("device_name"));
|
||||
dtl_map.put("工作时间(分钟)", jo.getString("run_times"));
|
||||
dtl_map.put("准备时间(分钟)", jo.getString("prepare_times"));
|
||||
dtl_map.put("故障时间(分钟)", jo.getString("error_times"));
|
||||
dtl_map.put("工装调整时间(分钟)", jo.getString("adjust_times"));
|
||||
dtl_map.put("生产总量", jo.getString("product_qty"));
|
||||
dtl_map.put("不合格数", jo.getString("nok_qty"));
|
||||
dtl_map.put("理论生产节拍(分钟)", jo.getString("theory_beat"));
|
||||
dtl_map.put("OEE指标", jo.getString("oee_value"));
|
||||
list.add(dtl_map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.devicerecord_id TYPEAS s_string
|
||||
输入.device_gz TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
@@ -57,8 +58,8 @@
|
||||
FROM
|
||||
EM_BI_DeviceRepairRequest re
|
||||
LEFT JOIN EM_BI_EquipmentFile file ON file.devicerecord_id = re.devicerecord_id
|
||||
LEFT JOIN EM_BI_DeviceFaultClass fclass ON fclass.device_faultclass_id = re.device_faultclass_id
|
||||
LEFT JOIN md_pb_classstandard class ON file.material_type_id = class.class_id
|
||||
LEFT JOIN md_pb_classstandard class2 ON re.device_faultclass_id = class2.class_id
|
||||
LEFT JOIN sys_dept dept ON file.use_deptid = dept.dept_id
|
||||
WHERE
|
||||
re.is_delete = '0'
|
||||
@@ -66,8 +67,8 @@
|
||||
class.class_id in 输入.classIds
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.classIds2 <> ""
|
||||
class2.class_id in 输入.classIds2
|
||||
OPTION 输入.device_gz <> ""
|
||||
fclass.device_faultclass_id = 输入.device_gz
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.device_code <> ""
|
||||
@@ -99,7 +100,7 @@
|
||||
SELECT
|
||||
re.*,
|
||||
dept.name,
|
||||
class.class_name,
|
||||
fclass.device_faultclass_name AS class_name,
|
||||
pari.real_start_date,
|
||||
pari.real_end_date,
|
||||
pari.outsourceaskfor_optid,
|
||||
@@ -110,7 +111,7 @@
|
||||
FROM
|
||||
EM_BI_DeviceRepairRequest re
|
||||
LEFT JOIN EM_BI_EquipmentFile file ON file.devicerecord_id = re.devicerecord_id
|
||||
LEFT JOIN md_pb_classstandard class ON re.device_faultclass_id = class.class_id
|
||||
LEFT JOIN EM_BI_DeviceFaultClass fclass ON fclass.device_faultclass_id = re.device_faultclass_id
|
||||
LEFT JOIN sys_dept dept ON file.use_deptid = dept.dept_id
|
||||
LEFT JOIN EM_BI_DeviceRepairMst pari ON pari.source_bill_id = re.request_id
|
||||
WHERE
|
||||
@@ -131,4 +132,17 @@
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
QUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
EM_BI_DeviceFaultClass
|
||||
WHERE
|
||||
is_delete = '0'
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -19,6 +19,7 @@
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.dept_code TYPEAS s_string
|
||||
输入.devicerecord_id TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
@@ -82,6 +83,10 @@
|
||||
run.run_date <= 输入.end_time
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.devicerecord_id <> ""
|
||||
run.devicerecord_id = 输入.devicerecord_id
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
Reference in New Issue
Block a user