mes看板

highway
zhaoxiaolin 1 year ago
parent 59ed4122cb
commit 2d905987ba

@ -0,0 +1,69 @@
package com.op.system.api.domain.dto;
import java.util.List;
public class BoardDTO {
private String factory;
private String ymd;
private String equCode;
private String equName;
private Integer totalNum;
private String equTypeCode;
private String equTypeName;
public String getEquName() {
return equName;
}
public void setEquName(String equName) {
this.equName = equName;
}
public String getEquTypeName() {
return equTypeName;
}
public void setEquTypeName(String equTypeName) {
this.equTypeName = equTypeName;
}
public String getEquTypeCode() {
return equTypeCode;
}
public void setEquTypeCode(String equTypeCode) {
this.equTypeCode = equTypeCode;
}
public String getEquCode() {
return equCode;
}
public void setEquCode(String equCode) {
this.equCode = equCode;
}
public Integer getTotalNum() {
return totalNum;
}
public void setTotalNum(Integer totalNum) {
this.totalNum = totalNum;
}
public String getYmd() {
return ymd;
}
public void setYmd(String ymd) {
this.ymd = ymd;
}
public String getFactory() {
return factory;
}
public void setFactory(String factory) {
this.factory = factory;
}
}

@ -1,11 +1,13 @@
package com.op.mes.controller;
import com.op.common.core.utils.DateUtils;
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.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.mes.domain.dto.BaseEquipmentDto;
import com.op.system.api.domain.dto.BoardDTO;
import com.op.system.api.domain.dto.WCSDTO;
import com.op.mes.service.IWCSInterfaceService;
@ -15,7 +17,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Controller
* WCS
*
* @author sf
* @date 2023-05-18
@ -52,4 +54,24 @@ public class WCSInterfaceController extends BaseController {
}
return success(WCInterfaceService.requestDestinationStations(wcsdto));
}
/**
* MES
*/
@Log(title = "MES看板-获取工厂列表", businessType = BusinessType.GRANT)
@PostMapping("/getBoardFactory")
public AjaxResult getBoardFactory(@RequestBody BoardDTO boardDTO) {
return success(WCInterfaceService.getBoardFactory(boardDTO));
}
@Log(title = "MES看板", businessType = BusinessType.GRANT)
@PostMapping("/getMesBoardEquProductionToday")
public AjaxResult getMesBoardEquProductionToday(@RequestBody BoardDTO boardDTO) {
if(StringUtils.isBlank(boardDTO.getFactory())){
return error("[factory] is not null");
}
if(StringUtils.isEmpty(boardDTO.getYmd())){
boardDTO.setYmd(DateUtils.getDate());
}
return success(WCInterfaceService.getMesBoardEquProductionToday(boardDTO));
}
}

@ -1,6 +1,8 @@
package com.op.mes.mapper;
import com.op.mes.domain.dto.BaseEquipmentDto;
import com.op.system.api.domain.SysDept;
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.Mapper;
@ -22,4 +24,10 @@ public interface MesMapper {
List<BaseEquipmentDto> getAllEquipments(BaseEquipmentDto baseEquipmentDto);
int saveRfidWithEquip(BaseEquipmentDto baseEquipmentDto);
List<BoardDTO> getTotalNum(BoardDTO boardDTO);
List<BoardDTO> getEveryNum(BoardDTO boardDTO);
List<SysDept> getBoardFactory(BoardDTO boardDTO);
}

@ -2,9 +2,12 @@ package com.op.mes.service;
import com.op.common.core.web.domain.AjaxResult;
import com.op.mes.domain.dto.BaseEquipmentDto;
import com.op.system.api.domain.SysDept;
import com.op.system.api.domain.dto.BoardDTO;
import com.op.system.api.domain.dto.WCSDTO;
import java.util.List;
import java.util.Map;
/**
* Service
@ -16,4 +19,7 @@ public interface IWCSInterfaceService {
WCSDTO requestDestinationStations(WCSDTO wcsdto);
Map getMesBoardEquProductionToday(BoardDTO boardDTO);
List<SysDept> getBoardFactory(BoardDTO boardDTO);
}

@ -12,6 +12,8 @@ import com.op.mes.mapper.MesMapper;
import com.op.mes.mapper.MesStationArriveMapper;
import com.op.mes.mapper.ProRfidProcessDetailMapper;
import com.op.mes.service.IWCSInterfaceService;
import com.op.system.api.domain.SysDept;
import com.op.system.api.domain.dto.BoardDTO;
import com.op.system.api.domain.dto.WCSDTO;
import com.op.system.api.domain.dto.WCSDataDTO;
import com.op.system.api.domain.dto.WCSDataItemsDTO;
@ -21,9 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -142,19 +142,28 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
return dto;
}
@Override
public Map getMesBoardEquProductionToday(BoardDTO boardDTO) {
DynamicDataSourceContextHolder.push("ds_"+boardDTO.getFactory());// 这是数据源的key
Map boardMap = new HashMap();
List<BoardDTO> totals = mesMapper.getTotalNum(boardDTO);//
List<BoardDTO> everys = mesMapper.getEveryNum(boardDTO);//
boardMap.put("totalNum", totals);
boardMap.put("everyNum", everys);
return boardMap;
}
@Override
public List<SysDept> getBoardFactory(BoardDTO boardDTO) {
//DynamicDataSourceContextHolder.push("master");// 这是数据源的key
return mesMapper.getBoardFactory(boardDTO);
}
public static void main(String args[]){
String machinecode1 = "[[\"GX01\",\"LG2\"],[\"GX01\",\"LG3\"],[\"GX02\",\"S1\"],[\"GX02\",\"S2\"],[\"GX03\",\"HF01\"],[\"GX04\",\"SPJ01\"]]";
JSONArray codeArray1 = JSONArray.parseArray(machinecode1);
String[] machineCodes1 = new String[codeArray1.size()];
for(int c1=0;c1<codeArray1.size();c1++){
machineCodes1[c1] = codeArray1.getJSONArray(c1).getString(1);
}
String[] machinecode0 = "LG1,LG2,LG3".split(",");
List<String> list1 = Arrays.asList(machinecode0);
List<String> list2 = Arrays.asList(machineCodes1);
List<String> machineArray = list2.stream()
.filter(u1-> list1.contains(u1))
.collect(Collectors.toList());
System.out.println(machineArray.toString());
System.out.println(DateUtils.getDate());
}
}

@ -111,58 +111,6 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService {
public List<MesProcessReport> getProcessFinishList(MesProcessReport mesReportWork) {
List<MesProcessReport> dtos = new ArrayList<>();
dtos = mesReportWorkMapper.getProcessFinishList(mesReportWork);
// MesProcessReport dto = null;
// if(CollectionUtils.isEmpty(dtos)){
// dto = new MesProcessReport();
// dto.setProductDate("2023-08-31");
// dto.setOrderCode("000100220788");
// dto.setWorkorderCode("000100220788-1");
// dto.setProductCode("000000020000004232");
// dto.setProductName("榄菊小盘艾草型蚊香3+1家庭特惠装(1901)");
// dto.setProductSpc("23mm");
// dto.setProcessCode("ProdGX01");
// dto.setProcessName("包装线工序01");
// dto.setQuantityFeedback(new BigDecimal("500"));
// dto.setQuantity(new BigDecimal("1000"));
// dto.setUnit("KAR");
// dtos.add(dto);
// dto = new MesProcessReport();
// dto.setProductDate("2023-08-31");
// dto.setOrderCode("000100220789");
// dto.setWorkorderCode("000100220789-1");
// dto.setProductCode("000000020000004234");
// dto.setProductName("白坯");
// dto.setProductSpc("23mm");
// dto.setProcessCode("BPGX01");
// dto.setProcessName("收胚机工序");
// dto.setQuantityFeedback(new BigDecimal("80"));
// dto.setUnit("车");
// dtos.add(dto);
// dto = new MesProcessReport();
// dto.setProductDate("2023-08-31");
// dto.setOrderCode("000100220789");
// dto.setWorkorderCode("000100220789-1");
// dto.setProductCode("000000020000004234");
// dto.setProductName("白坯");
// dto.setProductSpc("23mm");
// dto.setProcessCode("BPGX02");
// dto.setProcessName("烘房工序");
// dto.setQuantityFeedback(new BigDecimal("70"));
// dto.setUnit("车");
// dtos.add(dto);
// dto = new MesProcessReport();
// dto.setProductDate("2023-08-31");
// dto.setOrderCode("000100220789");
// dto.setWorkorderCode("000100220789-1");
// dto.setProductCode("000000020000004234");
// dto.setProductName("白坯");
// dto.setProductSpc("23mm");
// dto.setProcessCode("BPGX02");
// dto.setProcessName("收坯工序");
// dto.setQuantityFeedback(new BigDecimal("100"));
// dto.setUnit("车");
// dtos.add(dto);
// }
return dtos;
}

@ -67,5 +67,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and equipment_name like concat('%', #{equipmentName}, '%')
</if>
</select>
<select id="getTotalNum" resultType="com.op.system.api.domain.dto.BoardDTO">
select count(0) totalNum,
equ.equipment_type_code equTypeCode,
equ.equipment_type_name equTypeName
from pro_rfid_process_detail prpd
left join base_equipment equ on prpd.machine_code = equ.equipment_code
where CONVERT(varchar(10),prpd.create_time, 120) = #{ymd}
group by equ.equipment_type_code,
equ.equipment_type_name
</select>
<select id="getEveryNum" resultType="com.op.system.api.domain.dto.BoardDTO">
select count(0) totalNum,
prpd.machine_code equCode,
equ.equipment_name equName,
equ.equipment_type_code equTypeCode
from pro_rfid_process_detail prpd
left join base_equipment equ on prpd.machine_code = equ.equipment_code
where CONVERT(varchar(10),prpd.create_time, 120) = #{ymd}
group by prpd.machine_code,
equ.equipment_name,
equ.equipment_type_code
</select>
<select id="getBoardFactory" resultType="com.op.system.api.domain.SysDept">
select dept_id parentName,
dept_name deptName
from sys_dept where parent_id = '1' and del_flag = '0'
</select>
</mapper>

@ -101,7 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from pro_rfid_process_detail prpd
left join pro_order_workorder pow on pow.workorder_code = prpd.workorder_code
left join pro_process ps on ps.process_id = prpd.now_process_id
where prpd.bind_status = 0
where pow.order_code is not null
<if test="orderCode != null and orderCode != ''">
and pow.order_code like concat('%', #{orderCode}, '%')
</if>

Loading…
Cancel
Save