代码更新
This commit is contained in:
@@ -41,4 +41,10 @@ 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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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