增加engineering公共模块,增加上片json文件
9个文件已修改
4 文件已重命名
4个文件已添加
2个文件已删除
File was renamed from hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/engineering/controller/EngineeringController.java |
| | |
| | | |
| | | |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.service.impl.EngineeringServiceImpl; |
| | | import com.mes.utils.Result; |
| | | import com.mes.workstation.service.UpWorkstationService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
File was renamed from hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/engineering/entity/Engineering.java |
| | |
| | | /** |
| | | * 膜系id |
| | | */ |
| | | private Integer filmsId; |
| | | private String filmsId; |
| | | |
| | | /** |
| | | * 备注 |
New file |
| | |
| | | package com.mes.engineering.entity; |
| | | |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * @author SNG-010 |
| | | */ |
| | | @Setter |
| | | @Getter |
| | | public class OptimizeEngineering { |
| | | |
| | | // Getter methods |
| | | // Setter methods |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | private String projectNo; |
| | | |
| | | /** |
| | | * 工程名 |
| | | */ |
| | | private String projectName; |
| | | |
| | | /** |
| | | * 平均利用率 |
| | | */ |
| | | private Double avgCutPct; |
| | | |
| | | /** |
| | | * 有效利用率 |
| | | */ |
| | | private Double validCutPct; |
| | | |
| | | /** |
| | | * 尾片利用率 |
| | | */ |
| | | private Double lastCutPct; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | /** |
| | | * 小片总数 |
| | | */ |
| | | private Integer glassTotal; |
| | | /** |
| | | * 小片总面积 |
| | | */ |
| | | private Double glassTotalArea; |
| | | /** |
| | | * 计划原片总数 |
| | | */ |
| | | private Integer rawStockQty; |
| | | /** |
| | | * 计划原片总面积 |
| | | */ |
| | | private Double rawStockArea; |
| | | /** |
| | | * 实际原片总数 |
| | | */ |
| | | private Integer actualStockQty; |
| | | /** |
| | | * 实际原片总面积 |
| | | */ |
| | | private Double actualStockArea; |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private String glassType; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.engineering.service; |
| | | |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-04-22 |
| | | */ |
| | | public interface EngineeringService extends IService<Engineering> { |
| | | |
| | | |
| | | |
| | | boolean changeTask(String projectId, Integer state); |
| | | |
| | | |
| | | List<Engineering> selectEngineering(String engineeringId); |
| | | |
| | | void saveEngineering(List<Engineering> engineerings); |
| | | } |
New file |
| | |
| | | package com.mes.engineering.service.impl; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.mapper.EngineeringMapper; |
| | | import com.mes.engineering.service.EngineeringService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.mapper.OptimizeProjectMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-04-22 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class EngineeringServiceImpl extends ServiceImpl<EngineeringMapper, Engineering> implements EngineeringService { |
| | | |
| | | @Autowired |
| | | OptimizeProjectMapper optimizeProjectMapper; |
| | | //开始/暂停任务 |
| | | @Override |
| | | public boolean changeTask(String projectId, Integer state) { |
| | | //使用projectId作为条件修改state字段 |
| | | LambdaUpdateChainWrapper<Engineering> wrapper = new LambdaUpdateChainWrapper<>(this.getBaseMapper()); |
| | | wrapper.set(Engineering::getState,state); |
| | | wrapper.eq(Engineering::getEngineerId,projectId); |
| | | return wrapper.update(); |
| | | } |
| | | |
| | | @Override |
| | | @DS("pp") |
| | | public List<Engineering> selectEngineering(String engineeringId) { |
| | | //查询钢化工程信息 |
| | | List<OptimizeProject> optimizeEngineerings = null; |
| | | if (engineeringId != null) { |
| | | QueryWrapper<OptimizeProject> wrapper = new QueryWrapper<>(); |
| | | wrapper.select("project_no,project_name,avg_cut_pct,valid_cut_pct,last_cut_pct,glass_total,glass_total_area,raw_stock_qty,raw_stock_area,glass_type,remark ") |
| | | .eq("project_no", engineeringId); |
| | | optimizeEngineerings = optimizeProjectMapper.selectList(wrapper); |
| | | |
| | | } |
| | | List<Engineering> resultList=new ArrayList<>(); |
| | | // 遍历查询结果赋值 |
| | | if (optimizeEngineerings != null) { |
| | | for (OptimizeProject map : optimizeEngineerings) { |
| | | // 创建一个新的 OptimizeProject 对象 |
| | | Engineering engineering = new Engineering(); |
| | | // 将 Map 中的每个键值对映射到 OptimizeProject 对象的相应字段上 |
| | | engineering.setEngineerId( map.getProjectNo());//工程id |
| | | engineering.setEngineerName( map.getProjectName());//工程名称 |
| | | engineering.setAvgAvailability( map.getAvgCutPct());//平均优化率 |
| | | engineering.setValidAvailability( map.getValidCutPct());//有效优化率 |
| | | engineering.setLastAvailability( map.getLastCutPct());//尾片优化率 |
| | | engineering.setState(0);//状态 |
| | | engineering.setGlassTotal( map.getGlassTotal());//小片玻璃总数 |
| | | engineering.setGlassTotalArea( map.getGlassTotalArea());//小片总面积 |
| | | engineering.setPlanPatternTotal( map.getRawStockQty());//计划原片总数 |
| | | engineering.setPlanPatternTotalArea( map.getRawStockArea());//计划原片总面积 |
| | | engineering.setFilmsId( map.getGlassType());//膜系 |
| | | engineering.setNotes( map.getRemark());//备注 |
| | | // 将映射后的对象添加到结果列表中 |
| | | resultList.add(engineering); |
| | | } |
| | | } |
| | | log.info("查询出钢化工程集合保存到实体类{}",resultList); |
| | | return resultList; |
| | | } |
| | | |
| | | @Override |
| | | public void saveEngineering(List<Engineering> engineerings) { |
| | | this.saveBatch(engineerings); |
| | | } |
| | | |
| | | } |
| | |
| | | /** |
| | | * 流程卡玻璃类型 |
| | | */ |
| | | private Integer glassType; |
| | | private String glassType; |
| | | |
| | | /** |
| | | * 宽 |
| | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String projectId; |
| | | private String processId; |
| | | |
| | | /** |
| | | * 工程种类 |
| | |
| | | package com.mes.glassinfo.service; |
| | | |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.github.yulichang.base.MPJBaseService; |
| | | import java.util.List; |
| | | |
| | |
| | | public interface GlassInfoService extends MPJBaseService<GlassInfo> { |
| | | |
| | | List<GlassInfo> selectGlassInfo(String engineeringId); |
| | | |
| | | void saveGlassInfo(List<GlassInfo> glassinfo); |
| | | } |
| | | |
| | |
| | | import com.mes.glassinfo.entity.OptimizeGlassinfo; |
| | | import com.mes.glassinfo.mapper.GlassInfoMapper; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.mapper.OptimizeProjectMapper; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | OptimizeProjectMapper optimizeProjectMapper; |
| | | @Override |
| | | @DS("pp") |
| | | |
| | | public List<GlassInfo> selectGlassInfo(String engineeringId) { |
| | | List<OptimizeGlassinfo> optimizeGlassinfos=null; |
| | | if (engineeringId != null) { |
| | | optimizeGlassinfos = optimizeProjectMapper.selectJoinList(OptimizeGlassinfo.class, new MPJQueryWrapper<OptimizeProject>() |
| | | .select("b.process_id,t.type,b.width,b.height,t.glass_thickness,t.glass_type,b.p_width,b.p_height,b.stock_id,b.heat_layout_id,b.heat_layout_sort,b.x_axis,b.y_axis,b.project_no,b.glass_id") |
| | | .leftJoin("optimize_detail b on t.project_no=b.project_no") |
| | | .eq("t.state",200) |
| | | .eq("t.state",100) |
| | | .eq("t.project_no", engineeringId)); |
| | | } |
| | | |
| | |
| | | GlassInfo glassInfo = new GlassInfo(); |
| | | // 将 Map 中的每个键值对映射到 OptimizeGlassinfo 对象的相应字段上 |
| | | glassInfo.setEngineerId(map.getProjectNo()); |
| | | glassInfo.setFlowCardId(map.getProjectId()); |
| | | glassInfo.setFlowCardId(map.getProcessId()); |
| | | glassInfo.setFilmsid(map.getGlassType()); |
| | | glassInfo.setGlassType(map.getType()); |
| | | glassInfo.setWidth(map.getWidth()); |
| | | glassInfo.setHeight(map.getHeight()); |
| | | glassInfo.setEdgWidth(map.getPWidth()); |
| | | glassInfo.setEdgHeight(map.getPHeight()); |
| | | glassInfo.setThickness(map.getGlassThickness()); |
| | | glassInfo.setPatternSequence(map.getStockId());// |
| | | glassInfo.setTemperingLayoutId(map.getHeatLayoutId());//钢化版图id |
| | |
| | | log.info("查询出glassinfopro的数据{}:",optimizeGlassinfos); |
| | | return resultList; |
| | | } |
| | | |
| | | @Override |
| | | public void saveGlassInfo(List<GlassInfo> glassinfo) { |
| | | this.saveBatch(glassinfo); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 第一次平均切裁率 |
| | | */ |
| | | private String fristCutPct; |
| | | private Double fristCutPct; |
| | | |
| | | /** |
| | | * 使用的原料数 |
| | |
| | | /** |
| | | * 使用的原料面积 |
| | | */ |
| | | private String rawStockArea; |
| | | private Double rawStockArea; |
| | | |
| | | /** |
| | | * 平均切裁率 |
| | | */ |
| | | private String avgCutPct; |
| | | private Double avgCutPct; |
| | | |
| | | /** |
| | | * 有效切裁率 |
| | | */ |
| | | private String validCutPct; |
| | | private Double validCutPct; |
| | | |
| | | /** |
| | | * 尾片切裁率 |
| | | */ |
| | | private String lastCutPct; |
| | | private Double lastCutPct; |
| | | |
| | | /** |
| | | * g混排程度 |
| | |
| | | /** |
| | | * g上片宽 |
| | | */ |
| | | private Float loadWidth; |
| | | private Double loadWidth; |
| | | |
| | | /** |
| | | * g上片长 |
| | | */ |
| | | private Float loadLength; |
| | | private Double loadLength; |
| | | |
| | | /** |
| | | * x间隔 |
| | | */ |
| | | private Float xSpace; |
| | | private Double xSpace; |
| | | |
| | | /** |
| | | * y间隔 |
| | | */ |
| | | private Float ySpace; |
| | | private Double ySpace; |
| | | |
| | | /** |
| | | * g平均装载率 |
| | | */ |
| | | private Float loadRate; |
| | | private Double loadRate; |
| | | |
| | | /** |
| | | * 流程卡集合 |
| | |
| | | package com.mes.uppattenusage.controller; |
| | | |
| | | |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.service.EngineeringService; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.uppattenusage.entity.OptimizeUpPattenUsage; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.uppattenusage.service.UpPattenUsageService; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | |
| | | private UpPattenUsageService upPattenUsageService; |
| | | @Autowired |
| | | private GlassInfoService glassInfoService; |
| | | @Autowired |
| | | private EngineeringService engineeringService; |
| | | @ApiOperation("显示正在出片的工程信息") |
| | | @GetMapping("/prioritylist") //查询现在上片机的玻璃信息 |
| | | public Result<List<UpPattenUsage>> prioritylist() { |
| | |
| | | upPattenUsageService.saveUpPattenUsage(upPattenUsages); |
| | | log.info("从PP表查询glassinfo的数据并保存到表里"); |
| | | List<GlassInfo> glassinfo=glassInfoService.selectGlassInfo(engineeringId); |
| | | glassInfoService.saveGlassInfo(glassinfo); |
| | | log.info("从PP表查询engineering的数据并保存到表里"); |
| | | List<Engineering> engineerings= engineeringService.selectEngineering(engineeringId); |
| | | engineeringService.saveEngineering(engineerings); |
| | | return Result.build(200, "", 200); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 原片版图片序 |
| | | */ |
| | | private Integer heatLayoutSort; |
| | | private Integer stockId; |
| | | |
| | | /** |
| | | * 状态 |
| | |
| | | List<OptimizeUpPattenUsage> upPattenUsageList = null; |
| | | if (engineeringId != null) { |
| | | upPattenUsageList = optimizeProjectMapper.selectJoinList(OptimizeUpPattenUsage.class, new MPJQueryWrapper<OptimizeProject>() |
| | | .select("t.project_no,t.glass_type,b.width,b.height,REGEXP_REPLACE(t.glass_thickness,'\\D','')as glass_thickness,b.heat_layout_sort") |
| | | .select("t.project_no,t.glass_type,b.width,b.height,REGEXP_REPLACE(t.glass_thickness,'\\D','')as glass_thickness,b.stock_id") |
| | | .leftJoin("optimize_layout b on t.project_no=b.project_no") |
| | | .eq("b.project_no", engineeringId)); |
| | | } |
| | |
| | | // 创建一个新的 OptimizeProject 对象 |
| | | UpPattenUsage optimizeProject = new UpPattenUsage(); |
| | | // 将 Map 中的每个键值对映射到 OptimizeProject 对象的相应字段上 |
| | | optimizeProject.setEngineeringId((String) map.getProjectNo()); |
| | | optimizeProject.setFilmsId((String) map.getGlassType()); |
| | | optimizeProject.setWidth((Double) map.getWidth()); |
| | | optimizeProject.setHeight((Double) map.getHeight()); |
| | | optimizeProject.setThickness((Double)map.getHeight()); |
| | | optimizeProject.setLayoutSequence((Integer) map.getHeatLayoutSort()); |
| | | optimizeProject.setEngineeringId(map.getProjectNo()); |
| | | optimizeProject.setFilmsId( map.getGlassType()); |
| | | optimizeProject.setWidth(map.getWidth()); |
| | | optimizeProject.setHeight( map.getHeight()); |
| | | optimizeProject.setThickness(map.getHeight()); |
| | | optimizeProject.setLayoutSequence( map.getStockId()); |
| | | optimizeProject.setState(0); |
| | | // 将映射后的对象添加到结果列表中 |
| | | resultList.add(optimizeProject); |
| | |
| | | //保存原片使用详情表 |
| | | } |
| | | |
| | | //@Override |
| | | public void selectSaveGlassinfo(String engineeringId) { |
| | | //保存玻璃信息表 |
| | | //optimizeProjectMapper.selectJoinList(); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin":"DB14.0", |
| | | "plcAddressLenght":"98", |
| | | "dataType":"word", |
| | | "parameteInfor":[ |
| | | { |
| | | "codeId": "PlcToMes", |
| | | "addressIndex":"0", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "PlcStatus", |
| | | "addressIndex":"10", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "MesToPlc", |
| | | "addressIndex":"20", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "WorkId", |
| | | "addressIndex":"24", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "GlassWidth", |
| | | "addressIndex":"26", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "GlassHeight", |
| | | "addressIndex":"28", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "MesToPlcStatus", |
| | | "addressIndex":"40", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "MesToPlcStatusId", |
| | | "addressIndex":"42", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "MesTaskStatus", |
| | | "addressIndex":"56", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | } |
| | | ] |
| | | } |
| | |
| | | package com.mes; |
| | | |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.service.EngineeringService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.pp.mapper.OptimizeProjectMapper; |
| | | import com.mes.uppattenusage.entity.OptimizeUpPattenUsage; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.service.impl.UpPattenUsageServiceImpl; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/3/27 16:37 |
| | | * @Description: |
| | | |
| | | */ |
| | | @Slf4j |
| | | @RunWith(SpringRunner.class) |
| | | @SpringBootTest(classes = LoadGlassModuleApplication.class) |
| | | public class LoadGlassModuleApplicationTest { |
| | | |
| | | @Resource |
| | | private OptimizeProjectMapper optimizeProjectMapper; |
| | | // @Resource |
| | | // private OptimizeProjectMapper optimizeProjectMapper; |
| | | @Autowired |
| | | private UpPattenUsageServiceImpl upPattenUsageService; |
| | | @Autowired |
| | | private GlassInfoService glassInfoService; |
| | | @Autowired |
| | | private EngineeringService engineeringService; |
| | | @Test |
| | | public void test() { |
| | | // List<OptimizeProject> list = optimizeProjectMapper.saveProject("P24032204"); |
| | |
| | | public void textglassinfo(){ |
| | | List<GlassInfo> glass= glassInfoService.selectGlassInfo("P24032204"); |
| | | log.info("glassinfo:{}", Arrays.asList(glass)); |
| | | glassInfoService.saveGlassInfo(glass); |
| | | } |
| | | @Test |
| | | public void textengineering(){ |
| | | List<Engineering> glass= engineeringService.selectEngineering("P24032204"); |
| | | engineeringService.saveEngineering(glass); |
| | | log.info("glassinfo:{}", Arrays.asList(glass)); |
| | | } |
| | | } |