diff --git a/op-modules/op-mes/src/main/java/com/op/mes/controller/MesBoardController.java b/op-modules/op-mes/src/main/java/com/op/mes/controller/MesBoardController.java index e3cb8f10..51311973 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/controller/MesBoardController.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/controller/MesBoardController.java @@ -1,19 +1,21 @@ package com.op.mes.controller; +import com.op.common.core.utils.StringUtils; +import com.op.common.core.web.controller.BaseController; import com.op.common.core.web.domain.AjaxResult; +import com.op.mes.domain.MesBoard; import com.op.mes.service.IMesBoradService; import com.op.system.api.domain.dto.BoardDTO; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + +import java.util.List; @RestController @RequestMapping("/mesborad") -public class MesBoardController { +public class MesBoardController extends BaseController { @Autowired private IMesBoradService iMesBoradService; @@ -25,5 +27,21 @@ public class MesBoardController { public AjaxResult finishProductBoard(@RequestBody BoardDTO boardDTO) { return iMesBoradService.finishProductBoard(boardDTO); } + /******************************自动化产线方案看板****************************************/ + /**根据工厂获取产线**/ + @GetMapping("/getLineList") + public List getLineList(BoardDTO mesBoard) { + return iMesBoradService.getLineList(mesBoard); + } + @PostMapping("/getProduction15Days") + public AjaxResult getProduction15Days(BoardDTO mesBoard) { + if (StringUtils.isBlank(mesBoard.getFactoryCode())) { + return error("[facotryCode] 不能为空"); + } + if (StringUtils.isBlank(mesBoard.getEquCode())) { + return error("[equCode] 不能为空"); + } + return success(iMesBoradService.getProduction15Days(mesBoard)); + } } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/MesBoard.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/MesBoard.java index 39748bb2..135ad8c6 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/domain/MesBoard.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/MesBoard.java @@ -19,6 +19,24 @@ public class MesBoard { private List files; private String workshopCode; private String workshopName; + private String lineCode; + private String lineName; + + public String getLineCode() { + return lineCode; + } + + public void setLineCode(String lineCode) { + this.lineCode = lineCode; + } + + public String getLineName() { + return lineName; + } + + public void setLineName(String lineName) { + this.lineName = lineName; + } public String getWorkshopCode() { return workshopCode; diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesMapper.java index d3a0049e..3377fceb 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesMapper.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesMapper.java @@ -2,6 +2,7 @@ package com.op.mes.mapper; import com.op.common.core.domain.BaseFileData; import com.op.mes.domain.MesBoard; +import com.op.mes.domain.MesReportWork; import com.op.mes.domain.dto.BaseEquipmentDto; import com.op.mes.domain.dto.LGInfoDto; import com.op.system.api.domain.SysDept; @@ -9,6 +10,7 @@ import com.op.system.api.domain.SysSapLog; import com.op.system.api.domain.dto.BoardDTO; import com.op.system.api.domain.dto.WCSDTO; import com.op.system.api.domain.dto.WCSDataItemsDTO; +import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -72,4 +74,9 @@ public interface MesMapper { List> daySenvenProduction(); List> ProductionInProgress(); + + List getLineList(BoardDTO boardDTO); + + @MapKey("dayStr") + Map getProduction15Days(BoardDTO boardDTO); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/IMesBoradService.java b/op-modules/op-mes/src/main/java/com/op/mes/service/IMesBoradService.java index dc5ea48c..175b7cc2 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/IMesBoradService.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/IMesBoradService.java @@ -3,6 +3,12 @@ package com.op.mes.service; import com.op.common.core.web.domain.AjaxResult; import com.op.system.api.domain.dto.BoardDTO; +import java.util.List; + public interface IMesBoradService { public AjaxResult finishProductBoard(BoardDTO boardDTO); + + public List getLineList(BoardDTO boardDTO); + + public BoardDTO getProduction15Days(BoardDTO mesBoard); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesBoradServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesBoradServiceImpl.java index 1be43cb6..e09a7e99 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesBoradServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesBoradServiceImpl.java @@ -1,17 +1,19 @@ package com.op.mes.service.impl; +import com.alibaba.fastjson2.JSONObject; import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; +import com.op.common.core.utils.DateUtils; import com.op.common.core.web.domain.AjaxResult; +import com.op.mes.domain.MesReportWork; import com.op.mes.mapper.MesMapper; import com.op.mes.service.IMesBoradService; import com.op.system.api.domain.dto.BoardDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.text.SimpleDateFormat; +import java.util.*; @Service public class MesBoradServiceImpl implements IMesBoradService { @@ -34,4 +36,86 @@ public class MesBoradServiceImpl implements IMesBoradService { map.put("ProductionInProgress", ProductionInProgress); return AjaxResult.success(map); } + + @Override + public List getLineList(BoardDTO boardDTO) { + DynamicDataSourceContextHolder.push(boardDTO.getFactoryCode()); + boardDTO.setEquipmentTypeCode("equ_type_bzx"); + List lineList = mesMapper.getLineList(boardDTO); + return lineList; + } + + @Override + public BoardDTO getProduction15Days(BoardDTO boardDTO) { + DynamicDataSourceContextHolder.push(boardDTO.getFactoryCode()); + BoardDTO dto = new BoardDTO(); + + String nowDate = DateUtils.getDate(); + + List days = this.getDays(15); + //days + dto.setDays(days); + boardDTO.setStartTime(days.get(0)); + boardDTO.setEndTime(days.get(days.size()-1)); + Map pros15 = mesMapper.getProduction15Days(boardDTO); + MesReportWork todaydto = pros15.get(nowDate); + if(todaydto != null){ + dto.setPlanProduction(todaydto.getQuantity().toString().replace(".00","")); + dto.setActProduction(todaydto.getQuantityFeedback().toString()); + }else{ + dto.setPlanProduction("0"); + dto.setActProduction("0"); + } + //plans; + List plans = new ArrayList<>(); + List acts = new ArrayList<>(); + //acts; + for(String dayStr:days){ + MesReportWork workR = pros15.get(dayStr); + if(workR != null){ + plans.add(workR.getQuantity().toString()); + acts.add(workR.getQuantityFeedback().toString()); + }else{ + plans.add("0"); + acts.add("0"); + } + } + dto.setPlans(plans); + dto.setActs(acts); + return dto; + } + + //获取当前日期前几天 + private List getDays(int dayNum){ + List days = new ArrayList<>(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + Calendar cal = Calendar.getInstance(); + //获取前面的时间用-负号 + Date date = new Date(); + for(int num=0;num days = new ArrayList<>(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + Calendar cal = Calendar.getInstance(); + //获取前面的时间用-负号 + Date date = new Date(); + for(int num=0;num<15;num++){ + cal.setTime(date); + cal.add(Calendar.DAY_OF_MONTH, -num); + days.add(sdf.format(cal.getTime())); + } + Collections.reverse(days); + + System.out.println(JSONObject.toJSONString(days)); + } } diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/MesMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/MesMapper.xml index f5124317..56844260 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/MesMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/MesMapper.xml @@ -286,4 +286,23 @@ A.unit, C.equipment_name; + + + diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcInterfaceController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcInterfaceController.java index cc974f12..0a7b00e2 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcInterfaceController.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcInterfaceController.java @@ -1,5 +1,6 @@ package com.op.quality.controller; +import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; import com.op.common.core.utils.StringUtils; import com.op.quality.domain.QcCheckType; import com.op.quality.domain.QcInterface; diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcInterface.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcInterface.java index e838e645..908cfe8f 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcInterface.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcInterface.java @@ -52,6 +52,15 @@ public class QcInterface extends BaseEntity { private String nameDate; private List dataBarArrays; private List dataLineArrays; + private String equipmentTypeCode; + + public String getEquipmentTypeCode() { + return equipmentTypeCode; + } + + public void setEquipmentTypeCode(String equipmentTypeCode) { + this.equipmentTypeCode = equipmentTypeCode; + } public List getDataBarArrays() { return dataBarArrays; diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/IQcInterfaceService.java b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcInterfaceService.java index 72b53a3e..ddf9d41c 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/IQcInterfaceService.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcInterfaceService.java @@ -37,4 +37,5 @@ public interface IQcInterfaceService { List getMonthOfYearContrast(QcInterface qcInterface); QcLineChartDto getLineQcData(QcInterface qcInterface); + } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java index e88e9018..008c4aa4 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java @@ -667,8 +667,10 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService { } } } - n= qcCheckTaskIncomeMapper.addQcCheckTaskDefects(defects); - logger.info("qc_check_task_defect:"+n); + if(!CollectionUtils.isEmpty(defects)){ + n= qcCheckTaskIncomeMapper.addQcCheckTaskDefects(defects); + logger.info("qc_check_task_defect:"+n); + } if("material".equals(qcCheckTaskIncome.getTypeCode())){ qcCheckTaskIncome.setCheckResult(result.equals("Y")?"1":"2");