qc bug修改1

master
zhaoxiaolin 10 months ago
parent ca51dbda0c
commit fb85f305b9

@ -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<BoardDTO> 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));
}
}

@ -19,6 +19,24 @@ public class MesBoard {
private List<BaseFileData> 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;

@ -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<Map<String, String>> daySenvenProduction();
List<Map<String, String>> ProductionInProgress();
List<BoardDTO> getLineList(BoardDTO boardDTO);
@MapKey("dayStr")
Map<String, MesReportWork> getProduction15Days(BoardDTO boardDTO);
}

@ -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<BoardDTO> getLineList(BoardDTO boardDTO);
public BoardDTO getProduction15Days(BoardDTO mesBoard);
}

@ -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<BoardDTO> getLineList(BoardDTO boardDTO) {
DynamicDataSourceContextHolder.push(boardDTO.getFactoryCode());
boardDTO.setEquipmentTypeCode("equ_type_bzx");
List<BoardDTO> 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<String> days = this.getDays(15);
//days
dto.setDays(days);
boardDTO.setStartTime(days.get(0));
boardDTO.setEndTime(days.get(days.size()-1));
Map<String,MesReportWork> 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<String> plans = new ArrayList<>();
List<String> 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<String> getDays(int dayNum){
List<String> days = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar cal = Calendar.getInstance();
//获取前面的时间用-负号
Date date = new Date();
for(int num=0;num<dayNum;num++){
cal.setTime(date);
cal.add(Calendar.DAY_OF_MONTH, -num);
days.add(sdf.format(cal.getTime()));
}
Collections.reverse(days);
return days;
}
public static void main(String[] args){
List<String> 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));
}
}

@ -286,4 +286,23 @@
A.unit,
C.equipment_name;
</select>
<select id="getLineList" resultType="com.op.system.api.domain.dto.BoardDTO">
select equipment_code equCode,
equipment_name equName
from base_equipment
where equipment_type_code = #{equipmentTypeCode}
and status = '1' and del_flag='0'
</select>
<select id="getProduction15Days" resultType="com.op.mes.domain.MesReportWork">
select sum(mrw.quantity_feedback) quantityFeedback,
pow.product_date productDate,
pow.quantity_split quantity
from mes_report_work mrw
left join pro_order_workorder pow on pow.workorder_code = mrw.workorder_code
where mrw.del_flag='0' and pow.del_flag='0' and mrw.parent_order = '0'
and pow.workorder_name = #{equCode}
and CONVERT(DATE, pow.product_date) BETWEEN DATEADD(DAY, -15, CONVERT(DATE, GETDATE())) AND CONVERT(DATE, GETDATE())
group by pow.product_date,pow.quantity_split
</select>
</mapper>

@ -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;

@ -52,6 +52,15 @@ public class QcInterface extends BaseEntity {
private String nameDate;
private List<String> dataBarArrays;
private List<String> dataLineArrays;
private String equipmentTypeCode;
public String getEquipmentTypeCode() {
return equipmentTypeCode;
}
public void setEquipmentTypeCode(String equipmentTypeCode) {
this.equipmentTypeCode = equipmentTypeCode;
}
public List<String> getDataBarArrays() {
return dataBarArrays;

@ -37,4 +37,5 @@ public interface IQcInterfaceService {
List<QcInterface> getMonthOfYearContrast(QcInterface qcInterface);
QcLineChartDto getLineQcData(QcInterface qcInterface);
}

@ -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");

Loading…
Cancel
Save