rev:维护工单看板数据信息

This commit is contained in:
zhangzq
2024-02-27 14:03:10 +08:00
parent b3ba7056e1
commit 1581392e26
15 changed files with 207 additions and 71 deletions

View File

@@ -141,9 +141,7 @@ public class WQLCore {
//开始加载系统默认wql根目录
System.out.println("开始水煎"+System.currentTimeMillis());
isSuccess = loadWQL(WQLCore.ROOT);
System.out.println("jieshu水煎"+System.currentTimeMillis());
return isSuccess;

View File

@@ -37,6 +37,7 @@ public class ScrapRateController {
@Log("查询废品率")
public ResponseEntity<Object> byMaterial(ScrapRateQuery query, PageQuery page) {
Page<Object> result = PageHelper.startPage(page.getPage() + 1, page.getSize());
query.setGroup("device_code");
List<Map> list = workorderService.scrapRate(query);
TableDataInfo build = TableDataInfo.build(list);
build.setTotalElements(result.getTotal());

View File

@@ -2,6 +2,8 @@ package org.nl.wms.analysis_manage.scrapRate.service.dto;
import lombok.Data;
import java.util.List;
/*
* @author ZZQ
* @Date 2023/10/8 10:25
@@ -16,6 +18,7 @@ public class ScrapRateQuery {
* 工序id
*/
private String workprocedure_id;
private List<String> workprocedure_ids;
/**
* 车间
*/
@@ -26,6 +29,7 @@ public class ScrapRateQuery {
private String[] create_time;
private String start_time;
private String end_time;
private String group;
public void setCreate_time(String[] create_time) {

View File

@@ -282,6 +282,9 @@ public class WordOrderUtils {
JSONObject map = new JSONObject();
String material_code = material_codes.next();
JSONObject jsonObject = wo_material.query("material_code = '" + material_code + "'").uniqueResult(0);
if (jsonObject==null){
continue;
}
map.put("material_code", material_code);
Integer material_num = top10.get(material_code);
top10.put(material_code, material_num + addT);

View File

@@ -1,5 +1,6 @@
package org.nl.wms.ext_manage.bigScreen.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
@@ -11,10 +12,15 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.nl.common.TableDataInfo;
import org.nl.common.utils.MapOf;
import org.nl.modules.wql.core.bean.ResultBean;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.WqlUtil;
import org.nl.start.auto.initial.ApplicationAutoInitial;
import org.nl.wms.analysis_manage.qlmanage.dto.QualityQuery;
import org.nl.wms.analysis_manage.scrapRate.service.dto.ScrapRateQuery;
import org.nl.wms.ext_manage.bigScreen.service.BigScreenService;
import org.nl.wms.ext_manage.bigScreen.service.dto.*;
@@ -23,6 +29,7 @@ import org.nl.wms.product_manage.service.device.IPdmBiDeviceService;
import org.nl.wms.product_manage.service.device.dao.PdmBiDevice;
import org.nl.wms.product_manage.service.workorder.IPdmProduceWorkorderService;
import org.nl.wms.product_manage.service.workprocedure.IPdmBiWorkprocedureService;
import org.nl.wms.product_manage.service.workprocedure.dao.PdmBiWorkprocedure;
import org.nl.wms.system_manage.service.dict.ISysDictService;
import org.nl.wms.system_manage.service.dict.dao.Dict;
import org.nl.wms.system_manage.service.param.ISysParamService;
@@ -33,7 +40,12 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.util.*;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@Service
@RequiredArgsConstructor
@@ -47,6 +59,8 @@ public class BigScreenServiceImpl implements BigScreenService, ApplicationAutoIn
private ISysDictService dictService;
@Autowired
private IPdmBiDeviceService deviceService;
@Autowired
private ISysParamService sysParamService;
List<TodayandplannumDto> todayandplannumDtos = new ArrayList<>();
YearinoutDto yearinoutDtos = new YearinoutDto();
@@ -120,62 +134,92 @@ public class BigScreenServiceImpl implements BigScreenService, ApplicationAutoIn
public JSONObject workScreen(JSONObject param) {
/**
* 1。配置web_flag对应工序id
* 判断是否虚拟数据
* 2.数据库查看当前工序设备,
* 3.查询设备对应工单信息
* 4.查询设备故障记录表
* 5.统计周工单
*/
JSONObject result = new JSONObject();
result.put("code","1");
result.put("desc","查询成功");
if (StringUtils.isNotEmpty(param.getString("web_flag"))){
Dict one = dictService.getOne(new UpdateWrapper<Dict>()
.eq("code", "WEB_FLAG")
.eq("label", param.getString("web_flag")));
String screenname = one.getName();
List<String> ids = new ArrayList<>();
if (StringUtils.isNotEmpty(one.getPara1())){
ids.add(one.getPara1());
Param off = sysParamService.getOne(new QueryWrapper<Param>().eq("code", "BIGSCREEN_ORDER"));
if (off!=null && "1".equals(off.getValue())){
String remark = off.getRemark();
JSONObject map = JSONObject.parseObject(remark);
JSONObject flag = map.getJSONObject(param.getString("web_flag"));
result.put("result",flag);
}else {
//获取工序信息
Dict one = dictService.getOne(new UpdateWrapper<Dict>()
.eq("code", "WEB_FLAG")
.eq("label", param.getString("web_flag")));
if (StringUtils.isNotEmpty(one.getPara1())) {
ids.add(one.getPara1());
}
if (StringUtils.isNotEmpty(one.getPara2())) {
ids.add(one.getPara2());
}
if (StringUtils.isNotEmpty(one.getPara3())) {
ids.add(one.getPara3());
}
List<PdmBiWorkprocedure> workprocedures = workprocedureService.list(new QueryWrapper<PdmBiWorkprocedure>()
.in("workprocedure_id", ids));
Map<String, String> workprodureMap = workprocedures.stream().collect(HashMap::new, (k, workprocedure) -> k.put(workprocedure.getWorkprocedure_id(), workprocedure.getWorkprocedure_name()), HashMap::putAll);
List arr1 = new ArrayList<>();
for (String id : ids) {
JSONObject sreenCount = deviceService.deviceSreenCount(id);
int i = sreenCount.getInteger("device_num") - sreenCount.getInteger("device_runningnum");
sreenCount.put("device_waitingnum",i<0?0:i);
sreenCount.put("shutdownnum",i<0?0:i);
sreenCount.put("workprocedure_name",workprodureMap.get(id));
arr1.add(sreenCount);
}
//日工单
List<Map> arr2 = workorderService.sreenDailyOrder(ids);
//设备报警信息arr4
List<Map> arr4 = deviceService.repairList(ids);
//故障曲线
List<Map> collect = arr4.stream().filter(map -> {
Object date_time = map.get("date_time");
if (date_time != null) {
return map.get("date_time").equals(DateUtil.today());
}
return false;
}).collect(Collectors.toList());
Map<String, List<Map>> todayarr = collect.stream().collect(Collectors.groupingBy(g -> String.valueOf(g.get("workprocedure_id"))));
Map<String, List<Map>> historyarr = arr4.stream().collect(Collectors.groupingBy(g -> String.valueOf(g.get("workprocedure_id"))));
List<Object[]> arr5 = new ArrayList<>();
arr5.add(new Object[]{"product","累计","今日"});
for (String id : ids) {
arr5.add(new Object[]{workprodureMap.get(id),historyarr.get(id)==null?0:historyarr.get(id).size(),todayarr.get(id)==null?0:todayarr.get(id).size()});
}
//周工单情况
ScrapRateQuery query = new ScrapRateQuery();
DateTime dateTime = DateUtil.offsetWeek(new Date(), -1);
query.setWorkprocedure_ids(ids);//统计月
query.setStart_time(DateFormatUtils.format(dateTime, "yyyy-MM-dd"));
List<Map> scrapRate = workorderService.scrapRate(query);
Map map = scrapRate.get(0);
Map jo3 = MapOf.of("sumfinishproduce_qty", map.get("real_qty"),
"sumproduce_qty", map.get("plan_qty"),
"sumproducing_qty", map.get("real_qty"),
"sumweek_qty", map.get("real_qty"));
result.put("result",MapOf.of("screenname",one.getValue(),
"arr1",arr1,"arr2",arr2,"arr4",arr4,"arr5",arr5,"jo3",jo3,"jo6",MapOf.of("sumproduce_orderqty","1","sumfinishproduce_orderqty","2","sumproducing_orderqty","3")));
}
if (StringUtils.isNotEmpty(one.getPara2())){
ids.add(one.getPara2());
}
if (StringUtils.isNotEmpty(one.getPara3())){
ids.add(one.getPara3());
}
//查询所有工序设备列表: private Boolean is_delete;
//
// /**
// * 是否在用
// */
// private Boolean is_used;
List<PdmBiDevice> list = deviceService.list(new QueryWrapper<PdmBiDevice>()
.in("workprocedure_id", ids)
.eq("is_delete", false));
}
String str = null;
String web_flag="1";
//1车间下料看板
if ("1".equals(web_flag)) {
str = "{\"code\":\"1\",\"desc\":\"查询成功\",\"result\":{\"screenname\":\"车间下料看板\",\"arr1\":[{\"workprocedure_name\":\"盘管双斜口下料\",\"device_runningnum\":\"0\",\"device_errornum\":\"0\",\"device_waitingnum\":\"0\",\"shutdownnum\":\"5\",\"device_num\":\"5\"},{\"workprocedure_name\":\"直管双斜口下料\",\"device_runningnum\":\"0\",\"device_errornum\":\"0\",\"device_waitingnum\":\"0\",\"shutdownnum\":\"1\",\"device_num\":\"1\"},{\"workprocedure_name\":\"盘管无屑下料\",\"device_runningnum\":\"0\",\"device_errornum\":\"1\",\"device_waitingnum\":\"0\",\"shutdownnum\":\"3\",\"device_num\":\"4\"},{\"workprocedure_name\":\"直管无屑下料\",\"device_runningnum\":\"0\",\"device_errornum\":\"0\",\"device_waitingnum\":\"0\",\"shutdownnum\":\"1\",\"device_num\":\"1\"}],\"arr2\":[{\"produceschedule_date\":\"2021-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"推弯一体机加工\",\"sysdic_name\":\"弯头工段\",\"worksection_type_scode\":\"01\",\"finishproduce_qty\":\"0\",\"produce_qty\":\"4200\",\"waiting_qty\":\"4200\",\"progress_qty\":\"0\"},{\"produceschedule_date\":\"2020-09-16\",\"produceorder_code\":\"0916014\",\"workprocedure_name\":\"盘管无屑下料\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"3500\",\"produce_qty\":\"3500\",\"waiting_qty\":\"0\",\"progress_qty\":\"100\"},{\"produceschedule_date\":\"2020-12-31\",\"produceorder_code\":\"1231013\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"790\",\"produce_qty\":\"3500\",\"waiting_qty\":\"2710\",\"progress_qty\":\"23\"},{\"produceschedule_date\":\"2020-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"4225\",\"produce_qty\":\"6000\",\"waiting_qty\":\"1775\",\"progress_qty\":\"70\"}],\"jo3\":{\"sumproduce_qty\":\"0\",\"sumfinishproduce_qty\":\"0\",\"sumproducing_qty\":\"0\",\"sumweek_qty\":\"0\"},\"arr4\":[{\"device_name\":\"L28\",\"devicestatus_name\":\"急停报警\",\"update_date\":\" 00:00:30\"},{\"device_name\":\"1-L22\",\"devicestatus_name\":\"急停报警\",\"update_date\":\" 00:00:24\"},{\"device_name\":\"L22-2\",\"devicestatus_name\":\"急停报警\",\"update_date\":\" 00:00:21\"},{\"device_name\":\"L22-1\",\"devicestatus_name\":\"急停报警\",\"update_date\":\" 00:00:20\"}],\"arr5\":[[\"product\",\"昨日\",\"今日\"],[\"盘管双斜口\",\"2\",\"2\"],[\"直管双斜口\",\"1\",\"1\"],[\"盘管无屑\",\"1\",\"1\"],[\"直管无屑\",\"0\",\"0\"]],\"jo6\":{\"sumproduce_orderqty\":\"\",\"sumfinishproduce_orderqty\":\"\",\"sumproducing_orderqty\":\"\"},\"arr7\":[{\"count\":\"0\",\"date\":\"07-10\"},{\"count\":\"0\",\"date\":\"07-11\"},{\"count\":\"0\",\"date\":\"07-12\"},{\"count\":\"0\",\"date\":\"07-13\"},{\"count\":\"0\",\"date\":\"07-14\"},{\"count\":\"0\",\"date\":\"07-15\"},{\"count\":\"0\",\"date\":\"07-16\"}]}}";
}
//2车间旋压看板
if ("2".equals(web_flag)) {
str = "{\"code\":\"1\",\"desc\":\"查询成功\",\"result\":{\"screenname\":\"车间旋压看板\",\"arr1\":[{\"workprocedure_name\":\"旋压下料\",\"device_runningnum\":\"0\",\"device_errornum\":\"0\",\"device_waitingnum\":\"0\",\"shutdownnum\":\"12\",\"device_num\":\"12\"},{\"workprocedure_name\":\"滚槽/打点\",\"device_runningnum\":\"0\",\"device_errornum\":\"0\",\"device_waitingnum\":\"0\",\"shutdownnum\":\"3\",\"device_num\":\"3\"},{\"workprocedure_name\":\"直管有屑下料\",\"device_runningnum\":\"0\",\"device_errornum\":\"0\",\"device_waitingnum\":\"0\",\"shutdownnum\":\"3\",\"device_num\":\"3\"}],\"arr2\":[{\"produceschedule_date\":\"2021-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"推弯一体机加工\",\"sysdic_name\":\"弯头工段\",\"worksection_type_scode\":\"01\",\"finishproduce_qty\":\"0\",\"produce_qty\":\"4200\",\"waiting_qty\":\"4200\",\"progress_qty\":\"0\"},{\"produceschedule_date\":\"2020-09-16\",\"produceorder_code\":\"0916014\",\"workprocedure_name\":\"盘管无屑下料\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"3500\",\"produce_qty\":\"3500\",\"waiting_qty\":\"0\",\"progress_qty\":\"100\"},{\"produceschedule_date\":\"2020-12-31\",\"produceorder_code\":\"1231013\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"790\",\"produce_qty\":\"3500\",\"waiting_qty\":\"2710\",\"progress_qty\":\"23\"},{\"produceschedule_date\":\"2020-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"4225\",\"produce_qty\":\"6000\",\"waiting_qty\":\"1775\",\"progress_qty\":\"70\"}],\"jo3\":{\"sumproduce_qty\":\"0\",\"sumfinishproduce_qty\":\"0\",\"sumproducing_qty\":\"0\",\"sumweek_qty\":\"0\"},\"arr4\":[],\"arr5\":[[\"product\",\"昨日\",\"今日\"],[\"旋压下料\",\"1\",\"0\"],[\"滚槽/打点\",\"0\",\"0\"],[\"直管有屑下料\",\"0\",\"0\"]],\"jo6\":{\"sumproduce_orderqty\":\"\",\"sumfinishproduce_orderqty\":\"\",\"sumproducing_orderqty\":\"\"},\"arr7\":[{\"count\":\"0\",\"date\":\"07-10\"},{\"count\":\"0\",\"date\":\"07-11\"},{\"count\":\"0\",\"date\":\"07-12\"},{\"count\":\"0\",\"date\":\"07-13\"},{\"count\":\"0\",\"date\":\"07-14\"},{\"count\":\"0\",\"date\":\"07-15\"},{\"count\":\"0\",\"date\":\"07-16\"}]}}";
}
//3车间三通看板
if ("3".equals(web_flag)) {
str = "{\"code\":\"1\",\"desc\":\"查询成功\",\"result\":{\"screenname\":\"车间三通看板\",\"arr1\":[{\"workprocedure_name\":\"三通拉伸\",\"device_runningnum\":\"1\",\"device_errornum\":\"0\",\"device_waitingnum\":\"1\",\"shutdownnum\":\"7\",\"device_num\":\"9\"},{\"workprocedure_name\":\"三通一体机加工\",\"device_runningnum\":\"1\",\"device_errornum\":\"0\",\"device_waitingnum\":\"0\",\"shutdownnum\":\"8\",\"device_num\":\"9\"}],\"arr2\":[{\"produceschedule_date\":\"2021-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"推弯一体机加工\",\"sysdic_name\":\"弯头工段\",\"worksection_type_scode\":\"01\",\"finishproduce_qty\":\"0\",\"produce_qty\":\"4200\",\"waiting_qty\":\"4200\",\"progress_qty\":\"0\"},{\"produceschedule_date\":\"2020-09-16\",\"produceorder_code\":\"0916014\",\"workprocedure_name\":\"盘管无屑下料\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"3500\",\"produce_qty\":\"3500\",\"waiting_qty\":\"0\",\"progress_qty\":\"100\"},{\"produceschedule_date\":\"2020-12-31\",\"produceorder_code\":\"1231013\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"790\",\"produce_qty\":\"3500\",\"waiting_qty\":\"2710\",\"progress_qty\":\"23\"},{\"produceschedule_date\":\"2020-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"4225\",\"produce_qty\":\"6000\",\"waiting_qty\":\"1775\",\"progress_qty\":\"70\"}],\"jo3\":{\"sumproduce_qty\":\"0\",\"sumfinishproduce_qty\":\"0\",\"sumproducing_qty\":\"0\",\"sumweek_qty\":\"0\"},\"arr4\":[{\"device_name\":\"L22-3\",\"devicestatus_name\":\"专机故障报警\",\"update_date\":\" 00:00:29\"},{\"device_name\":\"L22-1\",\"devicestatus_name\":\"专机故障报警\",\"update_date\":\" 00:00:29\"},{\"device_name\":\"L15-4\",\"devicestatus_name\":\"专机故障报警\",\"update_date\":\" 00:00:29\"},{\"device_name\":\"L15-3\",\"devicestatus_name\":\"专机故障报警\",\"update_date\":\" 00:00:28\"}],\"arr5\":[[\"product\",\"昨日\",\"今日\"],[\"三通\",\"4\",\"4\"],[\"三通一体机\",\"0\",\"0\"]],\"jo6\":{\"sumproduce_orderqty\":\"\",\"sumfinishproduce_orderqty\":\"\",\"sumproducing_orderqty\":\"\"},\"arr7\":[{\"count\":\"0\",\"date\":\"07-10\"},{\"count\":\"0\",\"date\":\"07-11\"},{\"count\":\"0\",\"date\":\"07-12\"},{\"count\":\"0\",\"date\":\"07-13\"},{\"count\":\"0\",\"date\":\"07-14\"},{\"count\":\"0\",\"date\":\"07-15\"},{\"count\":\"0\",\"date\":\"07-16\"}]}}";
}
//4车间推弯看板
if ("4".equals(web_flag)) {
str = "{\"code\":\"1\",\"desc\":\"查询成功\",\"result\":{\"screenname\":\"车间推弯看板\",\"arr1\":[{\"workprocedure_name\":\"推弯一体机加工\",\"device_runningnum\":\"3\",\"device_errornum\":\"9\",\"device_waitingnum\":\"3\",\"shutdownnum\":\"16\",\"device_num\":\"31\"}],\"arr2\":[{\"produceschedule_date\":\"2021-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"推弯一体机加工\",\"sysdic_name\":\"弯头工段\",\"worksection_type_scode\":\"01\",\"finishproduce_qty\":\"0\",\"produce_qty\":\"4200\",\"waiting_qty\":\"4200\",\"progress_qty\":\"0\"},{\"produceschedule_date\":\"2020-09-16\",\"produceorder_code\":\"0916014\",\"workprocedure_name\":\"盘管无屑下料\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"3500\",\"produce_qty\":\"3500\",\"waiting_qty\":\"0\",\"progress_qty\":\"100\"},{\"produceschedule_date\":\"2020-12-31\",\"produceorder_code\":\"1231013\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"790\",\"produce_qty\":\"3500\",\"waiting_qty\":\"2710\",\"progress_qty\":\"23\"},{\"produceschedule_date\":\"2020-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"4225\",\"produce_qty\":\"6000\",\"waiting_qty\":\"1775\",\"progress_qty\":\"70\"}],\"jo3\":{\"sumproduce_qty\":\"31952\",\"sumfinishproduce_qty\":\"108048\",\"sumproducing_qty\":\"0\",\"sumweek_qty\":\"140000\"},\"arr4\":[],\"arr5\":[[\"product\",\"昨日\",\"今日\"],[\"推弯一体机加工\",\"0\",\"0\"]],\"jo6\":{\"sumproduce_orderqty\":\"\",\"sumfinishproduce_orderqty\":\"\",\"sumproducing_orderqty\":\"\"},\"arr7\":[{\"count\":\"0\",\"date\":\"07-10\"},{\"count\":\"0\",\"date\":\"07-11\"},{\"count\":\"0\",\"date\":\"07-12\"},{\"count\":\"0\",\"date\":\"07-13\"},{\"count\":\"0\",\"date\":\"07-14\"},{\"count\":\"0\",\"date\":\"07-15\"},{\"count\":\"0\",\"date\":\"07-16\"}]}}";
}
//6车间刻字包装看板
if ("6".equals(web_flag)) {
str = "{\"code\":\"1\",\"desc\":\"查询成功\",\"result\":{\"screenname\":\"车间刻字包装看板\",\"arr1\":[{\"workprocedure_name\":\"刻字\",\"device_runningnum\":\"0\",\"device_errornum\":\"0\",\"device_waitingnum\":\"0\",\"shutdownnum\":\"13\",\"device_num\":\"13\"},{\"workprocedure_name\":\"包装\",\"device_runningnum\":\"2\",\"device_errornum\":\"0\",\"device_waitingnum\":\"0\",\"shutdownnum\":\"0\",\"device_num\":\"2\"},{\"workprocedure_name\":\"码盘\",\"device_runningnum\":\"0\",\"device_errornum\":\"0\",\"device_waitingnum\":\"1\",\"shutdownnum\":\"0\",\"device_num\":\"1\"}],\"arr2\":[{\"produceschedule_date\":\"2021-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"推弯一体机加工\",\"sysdic_name\":\"弯头工段\",\"worksection_type_scode\":\"01\",\"finishproduce_qty\":\"0\",\"produce_qty\":\"4200\",\"waiting_qty\":\"4200\",\"progress_qty\":\"0\"},{\"produceschedule_date\":\"2020-09-16\",\"produceorder_code\":\"0916014\",\"workprocedure_name\":\"盘管无屑下料\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"3500\",\"produce_qty\":\"3500\",\"waiting_qty\":\"0\",\"progress_qty\":\"100\"},{\"produceschedule_date\":\"2020-12-31\",\"produceorder_code\":\"1231013\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"790\",\"produce_qty\":\"3500\",\"waiting_qty\":\"2710\",\"progress_qty\":\"23\"},{\"produceschedule_date\":\"2020-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"4225\",\"produce_qty\":\"6000\",\"waiting_qty\":\"1775\",\"progress_qty\":\"70\"}],\"jo3\":{\"sumproduce_qty\":\"0\",\"sumfinishproduce_qty\":\"0\",\"sumproducing_qty\":\"0\",\"sumweek_qty\":\"0\"},\"arr4\":[{\"device_name\":\"激光打标机06\",\"devicestatus_name\":\"急停报警\",\"update_date\":\" 00:00:35\"}],\"arr5\":[[\"product\",\"昨日\",\"今日\"],[\"刻字\",\"1\",\"1\"],[\"包装\",\"1\",\"0\"],[\"码盘\",\"0\",\"0\"]],\"jo6\":{\"sumproduce_orderqty\":\"\",\"sumfinishproduce_orderqty\":\"\",\"sumproducing_orderqty\":\"\"},\"arr7\":[{\"count\":\"0\",\"date\":\"07-10\"},{\"count\":\"0\",\"date\":\"07-11\"},{\"count\":\"0\",\"date\":\"07-12\"},{\"count\":\"0\",\"date\":\"07-13\"},{\"count\":\"0\",\"date\":\"07-14\"},{\"count\":\"0\",\"date\":\"07-15\"},{\"count\":\"0\",\"date\":\"07-16\"}]}}";
}
return JSONObject.parseObject(str);
//str = "{\"code\":\"1\",\"desc\":\"查询成功\",\"result\":{\"screenname\":\"车间推弯看板\",\"arr1\":[{\"workprocedure_name\":\"推弯一体机加工\",\"device_runningnum\":\"3\",\"device_errornum\":\"9\",\"device_waitingnum\":\"3\",\"shutdownnum\":\"16\",\"device_num\":\"31\"}],\"arr2\":[{\"produceschedule_date\":\"2021-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"推弯一体机加工\",\"sysdic_name\":\"弯头工段\",\"worksection_type_scode\":\"01\",\"finishproduce_qty\":\"0\",\"produce_qty\":\"4200\",\"waiting_qty\":\"4200\",\"progress_qty\":\"0\"},{\"produceschedule_date\":\"2020-09-16\",\"produceorder_code\":\"0916014\",\"workprocedure_name\":\"盘管无屑下料\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"3500\",\"produce_qty\":\"3500\",\"waiting_qty\":\"0\",\"progress_qty\":\"100\"},{\"produceschedule_date\":\"2020-12-31\",\"produceorder_code\":\"1231013\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"790\",\"produce_qty\":\"3500\",\"waiting_qty\":\"2710\",\"progress_qty\":\"23\"},{\"produceschedule_date\":\"2020-05-06\",\"produceorder_code\":\"0506009\",\"workprocedure_name\":\"三通拉伸\",\"sysdic_name\":\"综合工段\",\"worksection_type_scode\":\"02\",\"finishproduce_qty\":\"4225\",\"produce_qty\":\"6000\",\"waiting_qty\":\"1775\",\"progress_qty\":\"70\"}],\"jo3\":{\"sumproduce_qty\":\"31952\",\"sumfinishproduce_qty\":\"108048\",\"sumproducing_qty\":\"0\",\"sumweek_qty\":\"140000\"},\"arr4\":[],\"arr5\":[[\"product\",\"昨日\",\"今日\"],[\"推弯一体机加工\",\"0\",\"0\"]],\"jo6\":{\"sumproduce_orderqty\":\"\",\"sumfinishproduce_orderqty\":\"\",\"sumproducing_orderqty\":\"\"},\"arr7\":[{\"count\":\"0\",\"date\":\"07-10\"},{\"count\":\"0\",\"date\":\"07-11\"},{\"count\":\"0\",\"date\":\"07-12\"},{\"count\":\"0\",\"date\":\"07-13\"},{\"count\":\"0\",\"date\":\"07-14\"},{\"count\":\"0\",\"date\":\"07-15\"},{\"count\":\"0\",\"date\":\"07-16\"}]}}";
}
return result;
}
@Override

View File

@@ -84,13 +84,13 @@
IF 输入.flag = "3"
QUERY
SELECT
device.device_id,
device.device_code,
run.start_time,
run.end_time
FROM
pdm_bi_device device
LEFT JOIN pdm_bi_workprocedure pro ON pro.workprocedure_id = device.workprocedure_id
INNER JOIN pdm_bi_devicerunstatusrecord run ON run.device_id = device.device_id
INNER JOIN pdm_bi_devicerunstatusrecord run ON run.device_code = device.device_code
WHERE
pro.worksection_type_scode = 输入.worksection_type_scode
AND (

View File

@@ -37,10 +37,17 @@ public interface IPdmBiDeviceService extends IService<PdmBiDevice> {
/**
* 查询维修中的设备
* @param param设备列表device_code
* @param workprocedure_id 设备列表device_code
* @return
*/
List<Map> repairList(Map param);
JSONObject deviceSreenCount(String workprocedure_id);
/**
* 设备故障记录
* @param ids
* @return
*/
List<Map> repairList(List<String> ids);
}

View File

@@ -1,6 +1,7 @@
package org.nl.wms.product_manage.service.device.dao.mapper;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param;
import org.nl.wms.product_manage.service.device.dao.PdmBiDevice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -23,7 +24,9 @@ public interface PdmBiDeviceMapper extends BaseMapper<PdmBiDevice> {
List<Map> workproceduceDevicesWeight(Map<String,Object> query);
List<Map> repairList(Map query);
List<Map> repairList(@Param("ids") List<String> ids);
Map deviceSreenCount(String workprocedure_id);
PdmBiDevice getDeviceByPoint(String pointCode);
}

View File

@@ -72,11 +72,34 @@
where sch_base_point.point_code = #{pointCode}
</select>
<select id="repairList" resultType="java.util.Map">
select ef.device_code from EM_BI_DeviceRepairMst rp
left join em_bi_equipmentfile ef on rp.devicerecord_id=ef.devicerecord_id
where 99 > rp.invstatus
<if test="device_code != null and device_code != ''">
and ef.device_code in #{device_code}
</if>
select dev.device_code,
dev.workprocedure_id,
wd.workprocedure_name,
rp.input_time,
rp.fault_desc,
product_person_name as input_name,
DATE_FORMAT(input_time,'%Y-%m-%d') date_time
from EM_BI_DeviceRepairMst rp
left join em_bi_equipmentfile ef on rp.devicerecord_id=ef.devicerecord_id
left join pdm_bi_device dev on ef.device_code=dev.device_code
left join pdm_bi_workprocedure wd on wd.workprocedure_id = dev.workprocedure_id
where 99 > rp.invstatus and dev.workprocedure_id in
<foreach open="(" close=")" collection="ids" separator="," item="id">
#{id}
</foreach>
-- and DATE_FORMAT(input_time,'%Y-%m-%d') in (DATE_SUB(CURRENT_DATE(),INTERVAL 1 day),CURDATE());
</select>
<select id="deviceSreenCount" resultType="java.util.Map">
select
(select count(DISTINCT(device_code)) from pdm_produce_workorder
where workorder_status in ('2','3','4') and workprocedure_id = #{workprocedure_id}) as device_runningnum,
(select count(1)
from pdm_bi_device
where pdm_bi_device.workprocedure_id = #{workprocedure_id}) as device_num ,
(select COUNT(1)
from em_bi_equipmentfile ef
left join pdm_bi_device dev on ef.device_code = dev.device_code
left join EM_BI_DeviceRepairMst rp on ef.devicerecord_id = rp.devicerecord_id
where 99>rp.invstatus and dev.workprocedure_id = #{workprocedure_id}) as device_errornum
</select>
</mapper>

View File

@@ -8,11 +8,12 @@ import org.nl.wms.product_manage.service.device.dao.PdmBiDevice;
import org.nl.wms.product_manage.service.device.dao.mapper.PdmBiDeviceMapper;
import org.nl.wms.product_manage.service.device.IPdmBiDeviceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nl.wms.scheduler_manage.service.task.ISchBaseTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -54,7 +55,15 @@ public class PdmBiDeviceServiceImpl extends ServiceImpl<PdmBiDeviceMapper, PdmBi
}
@Override
public List<Map> repairList(Map param) {
return this.baseMapper.repairList(param);
public JSONObject deviceSreenCount(String workprocedure_id) {
return new JSONObject(this.baseMapper.deviceSreenCount(workprocedure_id));
}
@Override
public List<Map> repairList(List<String> ids) {
if (!CollectionUtils.isEmpty(ids)){
return this.baseMapper.repairList(ids);
}
return new ArrayList<>();
}
}

View File

@@ -36,7 +36,7 @@
LEFT JOIN pdm_bi_workprocedure workprocedure ON shiftorder.workprocedure_id = workprocedure.workprocedure_id
LEFT JOIN sys_dict_detail sys ON sys.VALUE= workprocedure.worksection_type_scode AND sys.dict_id = '87'
<where>
shiftorder.is_delete='0' AND ShiftOrder.aps_work_type != 'S'
shiftorder.is_delete='0'
<if test="worksection_type_scode != null and worksection_type_scode != ''">
and workprocedure.worksection_type_scode = #{worksection_type_scode}

View File

@@ -208,11 +208,15 @@ public interface IPdmProduceWorkorderService extends IService<PdmProduceWorkorde
List<Map> specOptionsSelect();
List<Map<String, Object>> queryMouldsSpec(WorkorderQuery param);
BigDecimal getWorkOrderplanQty(JSONObject param);
/**
* 统计工单看板工单信息
* @param ids:工序
* @return
*/
List<Map> sreenDailyOrder(List<String> ids);
}

View File

@@ -127,4 +127,11 @@ public interface PdmProduceWorkorderMapper extends BaseMapper<PdmProduceWorkorde
List<Map> qualityAnalysis(QualityQuery query);
List<Map> qualityAnalysisByDevice(QualityQuery query);
/**
* 统计日工单
* @param ids
* @return
*/
List<Map> sreenDailyOrder(@Param("ids") List<String> ids);
}

View File

@@ -608,8 +608,10 @@
SELECT
pdm_produce_workorder.product_area,
pdm_produce_workorder.device_code,
sum( real_qty ) real_qty,
sum( nok_qty ) nok_qty,
IFNULL(sum( plan_qty ) ,0) plan_qty,
IFNULL(sum( real_qty ) ,0) real_qty,
IFNULL(sum( nok_qty ) ,0) nok_qty,
IFNULL((sum( plan_qty )-sum( real_qty )),0) undo_qty,
pdm_bi_device.device_name,
pdm_bi_workprocedure.workprocedure_name,
IF
@@ -619,7 +621,7 @@
LEFT JOIN pdm_bi_device ON pdm_bi_device.device_code = pdm_produce_workorder.device_code
LEFT JOIN pdm_bi_workprocedure ON pdm_bi_workprocedure.workprocedure_id = pdm_produce_workorder.workprocedure_id
WHERE
workorder_status IN ( '6', '7' )
1=1
<if test="device_code != null and device_code != ''">
and pdm_produce_workorder.device_code = #{device_code}
</if>
@@ -627,7 +629,7 @@
and pdm_produce_workorder.workprocedure_id = #{workprocedure_id}
</if>
<if test="start_time != null and start_time != ''">
and pdm_produce_workorder.create_time >= #{start_time}
and pdm_produce_workorder.planproducestart_date >= #{start_time}
</if>
<if test="product_area != null and product_area != ''">
and pdm_produce_workorder.product_area >= #{product_area}
@@ -635,8 +637,15 @@
<if test="end_time != null and end_time != ''">
and #{end_time} >= create_time
</if>
GROUP BY pdm_produce_workorder.device_code
<if test="workprocedure_ids != null and workprocedure_ids != ''">
and pdm_produce_workorder.workprocedure_id in
<foreach collection="workprocedure_ids" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="group != null and group != ''">
GROUP BY pdm_produce_workorder.#{group}
</if>
</select>
<select id="productCap" resultType="java.util.Map">
SELECT GROUP_CONCAT(pdm_produce_workorder.workorder_code) orders,
@@ -714,5 +723,21 @@
</otherwise>
</choose>
</select>
<select id="sreenDailyOrder" resultType="java.util.Map">
select pdm_produce_workorder.workorder_code produceorder_code,
pdm_bi_workprocedure.workprocedure_name,
pdm_bi_workprocedure.workprocedure_name as sysdic_name,
plan_qty produce_qty,
ROUND(real_qty/plan_qty*100, 2) as progress_qty,
real_qty finishproduce_qty,
plan_qty-real_qty as waiting_qty
from pdm_produce_workorder
LEFT JOIN pdm_bi_workprocedure ON pdm_bi_workprocedure.workprocedure_id = pdm_produce_workorder.workprocedure_id
where pdm_produce_workorder.workprocedure_id in (
<foreach collection="ids" separator="," item="id">
#{id}
</foreach>)
and DATE_FORMAT(pdm_produce_workorder.planproducestart_date,'%Y-%m-%d') = CURDATE();
</select>
</mapper>

View File

@@ -1317,4 +1317,12 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
}
return BigDecimal.ZERO;
}
@Override
public List<Map> sreenDailyOrder(List<String> ids) {
if (!CollectionUtils.isEmpty(ids)){
return this.baseMapper.sreenDailyOrder(ids);
}
return new ArrayList<>();
}
}