Merge branch 'master' of http://10.153.19.25:10105/r/YiWuProject
| | |
| | | }, |
| | | ] |
| | | }, |
| | | |
| | | /*----------- 工程排产 ----------------*/ |
| | | { |
| | | path: 'engineerScheduling', |
| | | name: 'engineerScheduling', |
| | | component: () => import('../views/EngineerScheduling/engineerScheduling.vue'), |
| | | children: [ |
| | | { |
| | | path: '/EngineerScheduling/engineerScheduling', |
| | | name: 'engineerScheduling', |
| | | component: () => import('../views/EngineerScheduling/engineerScheduling.vue') |
| | | }, |
| | | ] |
| | | }, |
| | | /*----------- 中空 ----------------*/ |
| | | { |
| | | path: 'hollow', |
| New file |
| | |
| | | <script lang="ts" setup> |
| | | import { ref, computed, watch, onMounted } from 'vue' |
| | | import { useI18n } from 'vue-i18n' |
| | | import { ElMessage, ElTransfer, ElTabs, ElTabPane, ElButton } from 'element-plus' |
| | | import request from '@/utils/request' |
| | | |
| | | const { t } = useI18n() |
| | | |
| | | const activeTab = ref('cutting1') |
| | | |
| | | // Transfer组件所需的数据格式 |
| | | interface TransferDataItem { |
| | | key: string |
| | | label: string |
| | | projectNo: string |
| | | projectName: string |
| | | } |
| | | |
| | | // 所有可选数据(左侧) |
| | | const dataSource = ref<TransferDataItem[]>([]) |
| | | // 已选数据的keys(右侧) |
| | | const targetKeys = ref<string[]>([]) |
| | | |
| | | // 根据当前标签页获取右侧列表标题 |
| | | const getRightListTitle = computed(() => { |
| | | switch (activeTab.value) { |
| | | case 'cutting1': |
| | | return t('large.countOutOne') |
| | | case 'cutting2': |
| | | return t('large.countOutTwo') |
| | | case 'tempered': |
| | | return t('large.temp') |
| | | default: |
| | | return '已排产' |
| | | } |
| | | }) |
| | | |
| | | // 获取左侧数据源 |
| | | const fetchDataSource = async () => { |
| | | try { |
| | | // 根据当前标签页选择不同的接口 |
| | | const apiUrl = activeTab.value === 'tempered' |
| | | ? '/cacheVerticalGlass/bigStorageCageDetails/queryEngineer' |
| | | : '/loadGlass/optimizeProject/queryEngineer'; |
| | | |
| | | const response = await request.post(apiUrl) |
| | | |
| | | if (response.code === 200) { |
| | | dataSource.value = response.data.map((item: any) => { |
| | | const projectNo = activeTab.value === 'tempered' ? item.engineerId : item.projectNo |
| | | const name = activeTab.value === 'tempered' ? item.engineerId : (item.projectNo + "-" + item.projectName) |
| | | |
| | | return { |
| | | key: projectNo, |
| | | label: name, |
| | | projectNo: projectNo, |
| | | projectName: activeTab.value === 'tempered' ? '' : item.projectName |
| | | } |
| | | }) |
| | | } else { |
| | | ElMessage.error(`获取数据失败: ${response.message || '未知错误'}`) |
| | | } |
| | | } catch (error) { |
| | | console.error('获取左侧数据失败:', error) |
| | | ElMessage.error('请稍后重试') |
| | | } |
| | | } |
| | | |
| | | // 获取右侧已选数据 |
| | | const fetchTargetKeys = async () => { |
| | | try { |
| | | // 根据当前标签页确定type参数 |
| | | let type = 1; // 默认切割一线 |
| | | if (activeTab.value === 'cutting2') { |
| | | type = 2; // 切割二线 |
| | | } else if (activeTab.value === 'tempered') { |
| | | type = 3; // 钢化 |
| | | } |
| | | |
| | | const response = await request.post('/loadGlass/optimizeProject/engineerScheduling', { |
| | | type: type |
| | | }) |
| | | |
| | | if (response.code === 200) { |
| | | // 对于所有标签页,使用projectNo作为key |
| | | targetKeys.value = response.data.map((item: any) => item.projectNo) |
| | | |
| | | // 将右侧数据添加到dataSource中,确保Transfer组件能找到对应的项 |
| | | response.data.forEach((item: any) => { |
| | | // 检查dataSource中是否已存在该项 |
| | | const exists = dataSource.value.some(dataItem => dataItem.key === item.projectNo) |
| | | if (!exists) { |
| | | // 如果不存在,添加到dataSource中 |
| | | const newItem: TransferDataItem = { |
| | | key: item.projectNo, |
| | | label: `${item.projectNo}-${item.projectName || 'null'}`, |
| | | projectNo: item.projectNo, |
| | | projectName: item.projectName || '' |
| | | } |
| | | dataSource.value.push(newItem) |
| | | } |
| | | }) |
| | | } else { |
| | | ElMessage.error(`获取数据失败: ${response.message || '未知错误'}`) |
| | | } |
| | | } catch (error) { |
| | | console.error('获取右侧数据失败:', error) |
| | | ElMessage.error('请稍后重试') |
| | | } |
| | | } |
| | | |
| | | // 保存排产信息 |
| | | const saveScheduling = async () => { |
| | | try { |
| | | // 根据当前标签页确定type参数 |
| | | let type = 1; // 默认切割一线 |
| | | if (activeTab.value === 'cutting2') { |
| | | type = 2; // 切割二线 |
| | | } else if (activeTab.value === 'tempered') { |
| | | type = 3; // 钢化 |
| | | } |
| | | |
| | | const engineerList = targetKeys.value.map(projectNo => { |
| | | const dataItem = dataSource.value.find(item => item.key === projectNo) |
| | | return { |
| | | projectNo: projectNo, |
| | | projectName: dataItem ? dataItem.projectName : '' |
| | | } |
| | | }) |
| | | |
| | | const response = await request.post(`/loadGlass/optimizeProject/updateEngineerScheduling?type=${type}`, engineerList) |
| | | |
| | | if (response.code === 200) { |
| | | ElMessage.success('保存成功') |
| | | // 重新加载数据 |
| | | await fetchDataSource() |
| | | await fetchTargetKeys() |
| | | } else { |
| | | ElMessage.error(`保存失败: ${response.message || '未知错误'}`) |
| | | } |
| | | } catch (error) { |
| | | console.error('保存排产信息失败:', error) |
| | | ElMessage.error('请稍后重试') |
| | | } |
| | | } |
| | | |
| | | // 重置排产信息 |
| | | const resetScheduling = async () => { |
| | | await fetchDataSource() |
| | | await fetchTargetKeys() |
| | | ElMessage.info(t('已取消')) |
| | | } |
| | | |
| | | // 监听标签页切换,根据不同标签页加载对应的数据 |
| | | watch(activeTab, async (newTab) => { |
| | | // 重新获取数据 |
| | | await fetchDataSource() |
| | | await fetchTargetKeys() |
| | | }) |
| | | |
| | | |
| | | // 移除formatFunc,使用默认配置,Element Plus Transfer组件默认就会显示数量统计 |
| | | // 如果需要自定义标题显示,可以通过titles属性处理 |
| | | |
| | | // 组件挂载时获取数据 |
| | | onMounted(async () => { |
| | | await fetchDataSource() |
| | | await fetchTargetKeys() |
| | | }) |
| | | </script> |
| | | |
| | | <template> |
| | | <div class="engineer-scheduling-container"> |
| | | <el-tabs v-model="activeTab" class="custom-tabs"> |
| | | <el-tab-pane :label="t('large.countOutOne')" name="cutting1" /> |
| | | <el-tab-pane :label="t('large.countOutTwo')" name="cutting2" /> |
| | | <el-tab-pane :label="t('large.temp')" name="tempered" /> |
| | | </el-tabs> |
| | | |
| | | <div class="transfer-wrapper"> |
| | | <el-transfer v-model="targetKeys" class="custom-transfer" filterable :data="dataSource" |
| | | :titles="['待排产', getRightListTitle]" :button-texts="['', '']"> |
| | | <template #right-empty> |
| | | <el-empty :image-size="80" description="No data" /> |
| | | </template> |
| | | </el-transfer> |
| | | |
| | | |
| | | <div class="transfer-save"> |
| | | <el-button type="primary" @click="saveScheduling"> |
| | | {{ t('searchOrder.makesure') }} |
| | | </el-button> |
| | | <el-button type="primary" @click="resetScheduling"> |
| | | {{ t('delivery.cancel') }} |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | .engineer-scheduling-container { |
| | | padding: 20px; |
| | | border: 1px solid #dcdfe6; |
| | | border-radius: 4px; |
| | | background-color: #fff; |
| | | } |
| | | |
| | | .custom-tabs { |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | ::v-deep(.custom-tabs .el-tabs__item) { |
| | | font-size: 20px; |
| | | } |
| | | |
| | | .transfer-wrapper { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | gap: 20px; |
| | | } |
| | | |
| | | .transfer-save { |
| | | display: flex; |
| | | gap: 10px; |
| | | } |
| | | |
| | | /* 自定义Transfer组件的样式 */ |
| | | ::v-deep(.el-transfer-panel) { |
| | | font-size: 16px; |
| | | width: 350px; |
| | | height: 440px; |
| | | } |
| | | |
| | | .custom-transfer { |
| | | --el-transfer-panel-body-height: 400px; |
| | | } |
| | | |
| | | ::v-deep(.el-transfer-panel__header) { |
| | | font-weight: bold; |
| | | font-size: 18px; |
| | | } |
| | | |
| | | ::v-deep(.el-checkbox__label) { |
| | | font-size: 16px; |
| | | } |
| | | </style> |
| | |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.engineering.entity.Engineering; |
| | |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | |
| | | |
| | | //开始/暂停任务 |
| | | @Override |
| | | public boolean changeTask(String projectId, Integer state) { |
| | | public boolean changeTask(String projectId, Integer state) { |
| | | //暂停正在进行工程 |
| | | // LambdaUpdateChainWrapper<Engineering> pauseWrapper = new LambdaUpdateChainWrapper<>(this.getBaseMapper()); |
| | | // pauseWrapper.set(Engineering::getState,0); |
| | |
| | | // boolean pause = pauseWrapper.update(); |
| | | //使用projectId作为条件开始工程 |
| | | LambdaUpdateChainWrapper<Engineering> wrapper = new LambdaUpdateChainWrapper<>(this.getBaseMapper()); |
| | | wrapper.set(Engineering::getState,state); |
| | | wrapper.eq(Engineering::getEngineerId,projectId); |
| | | wrapper.set(Engineering::getState, state); |
| | | wrapper.eq(Engineering::getEngineerId, projectId); |
| | | boolean pause = wrapper.update(); |
| | | return pause; |
| | | } |
| | |
| | | optimizeEngineerings = optimizeProjectMapper.selectList(wrapper); |
| | | |
| | | } |
| | | List<Engineering> resultList=new ArrayList<>(); |
| | | 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.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());//备注 |
| | | 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); |
| | | log.info("查询出钢化工程集合保存到实体类{}", resultList); |
| | | return resultList; |
| | | } |
| | | |
| | |
| | | .last("limit 1"); |
| | | return engineeringMapper.selectOne(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public Engineering selectInitiates(Integer state,Integer cell) { |
| | | public Engineering selectInitiates(Integer state, Integer cell) { |
| | | //查询是否有开始上片的工程任务 |
| | | QueryWrapper<Engineering> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("state", state) |
| | |
| | | @Override |
| | | public boolean deleteTask(String engineerId) { |
| | | //删除工程表 |
| | | QueryWrapper<Engineering> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("engineer_id", engineerId); |
| | | return this.remove(wrapper); |
| | | // QueryWrapper<Engineering> wrapper = new QueryWrapper<>(); |
| | | // wrapper.eq("engineer_id", engineerId); |
| | | // return this.remove(wrapper); |
| | | //修改工程表状态 |
| | | return this.update( |
| | | new LambdaUpdateWrapper<Engineering>() |
| | | .eq(Engineering::getEngineerId, engineerId) |
| | | .set(Engineering::getState, 6) |
| | | ); |
| | | } |
| | | |
| | | @Override |
| | | public boolean changeTasks(Engineering engineering) { |
| | | //暂停正在进行工程 |
| | | LambdaUpdateChainWrapper<Engineering> pauseWrapper = new LambdaUpdateChainWrapper<>(this.getBaseMapper()); |
| | | pauseWrapper.set(Engineering::getState,0); |
| | | pauseWrapper.eq(Engineering::getState,1); |
| | | pauseWrapper.eq(Engineering::getStationCell,engineering.getStationCell()); |
| | | pauseWrapper.set(Engineering::getState, 0); |
| | | pauseWrapper.eq(Engineering::getState, 1); |
| | | pauseWrapper.eq(Engineering::getStationCell, engineering.getStationCell()); |
| | | pauseWrapper.update(); |
| | | |
| | | LambdaUpdateChainWrapper<Engineering> wrapper = new LambdaUpdateChainWrapper<>(this.getBaseMapper()); |
| | | wrapper.set(Engineering::getState,engineering.getState()); |
| | | wrapper.set(Engineering::getStationCell,engineering.getStationCell()); |
| | | wrapper.eq(Engineering::getEngineerId,engineering.getEngineerId()); |
| | | wrapper.set(Engineering::getState, engineering.getState()); |
| | | wrapper.set(Engineering::getStationCell, engineering.getStationCell()); |
| | | wrapper.eq(Engineering::getEngineerId, engineering.getEngineerId()); |
| | | return wrapper.update(); |
| | | } |
| | | |
| | |
| | | package com.mes.pp.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.api.R; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.entity.request.OptimizeRequest; |
| | | import com.mes.pp.service.OptimizeProjectService; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import liquibase.pro.packaged.O; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | return Result.build(200, "", glass); |
| | | } |
| | | |
| | | @ApiOperation("查询工程信息") |
| | | @PostMapping("/queryEngineer") //显示工程信息 pp表 |
| | | @ResponseBody |
| | | public Result<List<OptimizeProject>> queryEngineer() { |
| | | List<OptimizeProject> resultList = optimizeProjectService.queryEngineer(); |
| | | return Result.build(200, "", resultList); |
| | | } |
| | | |
| | | @ApiOperation("查询工程排产信息") |
| | | @PostMapping("/engineerScheduling") //显示工程排产信息 engineerScheduling表 |
| | | @ResponseBody |
| | | public Result<List<OptimizeProject>> engineerScheduling(@RequestBody OptimizeProject optimizeProject) { |
| | | List<OptimizeProject> engineerScheduling = optimizeProjectService.engineerScheduling(optimizeProject); |
| | | return Result.build(200, "", engineerScheduling); |
| | | } |
| | | |
| | | @ApiOperation("更新工程信息") |
| | | @PostMapping("/updateEngineerScheduling") //更新工程排产信息 engineerScheduling表 |
| | | @ResponseBody |
| | | public Result<List<OptimizeProject>> updateEngineerScheduling(@RequestParam Integer type, @RequestBody List<OptimizeProject> engineerList) { |
| | | List<OptimizeProject> resultList = optimizeProjectService.updateEngineerScheduling(type, engineerList); |
| | | return Result.build(200, "更新成功", resultList); |
| | | } |
| | | |
| | | // @ApiOperation("保存工程信息") |
| | | // @PostMapping("/saveProject") //显示工程选择信息 |
| | | // public Result<List<OptimizeProject>> saveProject(@RequestBody OptimizeRequest optimizeRequest) { |
| | |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.entity.request.OptimizeRequest; |
| | | import liquibase.pro.packaged.L; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | @DS("pp") |
| | | public interface OptimizeProjectMapper extends MPJBaseMapper<OptimizeProject> { |
| | | List<OptimizeProject> saveProject(OptimizeRequest optimizeRequest); |
| | | |
| | | /** |
| | | * 查询工程信息 |
| | | * |
| | | * @return |
| | | */ |
| | | List<OptimizeProject> queryEngineer(); |
| | | |
| | | /** |
| | | * 查询工程排产信息 |
| | | * |
| | | * @param optimizeProject |
| | | * @return |
| | | */ |
| | | List<OptimizeProject> engineerScheduling(OptimizeProject optimizeProject); |
| | | |
| | | /** |
| | | * 删除工程信息 |
| | | * |
| | | * @param type |
| | | */ |
| | | void deleteByType(@Param("type") Integer type); |
| | | |
| | | /** |
| | | * 更新工程信息 |
| | | * |
| | | * @param projectList |
| | | */ |
| | | void batchInsert(@Param("list") List<OptimizeProject> projectList); |
| | | |
| | | } |
| | |
| | | */ |
| | | List<OptimizeProject> getDoingTask(); |
| | | |
| | | /** |
| | | * 查询工程信息 |
| | | * @return |
| | | */ |
| | | List<OptimizeProject> queryEngineer(); |
| | | |
| | | /** |
| | | * 查询工程排序信息 |
| | | * @return |
| | | */ |
| | | List<OptimizeProject> engineerScheduling(OptimizeProject optimizeProject); |
| | | |
| | | /** |
| | | * 更新工程排产信息 |
| | | * @return |
| | | */ |
| | | List<OptimizeProject> updateEngineerScheduling(Integer type , List<OptimizeProject> engineerList); |
| | | |
| | | } |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | return this.list(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<OptimizeProject> queryEngineer() { |
| | | return this.baseMapper.queryEngineer(); |
| | | } |
| | | |
| | | @Override |
| | | public List<OptimizeProject> engineerScheduling(OptimizeProject optimizeProject) { |
| | | return this.baseMapper.engineerScheduling(optimizeProject); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public List<OptimizeProject> updateEngineerScheduling(Integer type , List<OptimizeProject> projectList) { |
| | | // 1. 删除对应类型的数据 |
| | | baseMapper.deleteByType(type); |
| | | |
| | | // 2. 设置值 |
| | | projectList.forEach(project -> { |
| | | project.setType(type); |
| | | project.setState(100); |
| | | project.setId(null); // 清除ID |
| | | }); |
| | | |
| | | // 3. 批量插入新数据 |
| | | baseMapper.batchInsert(projectList); |
| | | |
| | | return projectList; |
| | | } |
| | | } |
| | |
| | | |
| | | </resultMap> |
| | | |
| | | <resultMap id="resultMap" type="com.mes.pp.entity.OptimizeProject"> |
| | | <result property="id" column="id"/> |
| | | <result property="projectNo" column="project_no"/> |
| | | <result property="projectName" column="project_name"/> |
| | | <result property="state" column="state"/> |
| | | <result property="type" column="type"/> |
| | | </resultMap> |
| | | |
| | | <select id="saveProject" parameterType="com.mes.pp.entity.request.OptimizeRequest" resultMap="sequenceMap"> |
| | | select a.project_no, 1 as glass_type, a.width, a.height, REGEXP_REPLACE(b.glass_thickness, '\\D', '')as glass_thickness, a.heat_layout_sort, 0 as state |
| | | from optimize_detail a |
| | |
| | | where a.project_no = #{projectNo} |
| | | </select> |
| | | |
| | | <select id="queryEngineer" parameterType="com.mes.pp.entity.OptimizeProject" resultMap="resultMap"> |
| | | select p.project_no, |
| | | p.project_name |
| | | from pp.optimize_project p |
| | | where p.state = 100 |
| | | and p.project_no not in ( |
| | | select es.project_no |
| | | from north_glass_mes.engineer_scheduling es |
| | | where es.project_no is not null |
| | | ) |
| | | order by p.id |
| | | </select> |
| | | |
| | | <select id="engineerScheduling" parameterType="com.mes.pp.entity.request.OptimizeRequest" resultMap="resultMap"> |
| | | select es.project_no, |
| | | es.project_name, |
| | | es.type |
| | | from north_glass_mes.engineer_scheduling es |
| | | where es.state = 100 |
| | | <if test="type != null and type != ''"> |
| | | and es.type = #{type} |
| | | </if> |
| | | order by es.id |
| | | </select> |
| | | |
| | | <!-- 根据类型删除engineer_scheduling表中的数据 --> |
| | | <delete id="deleteByType"> |
| | | DELETE FROM north_glass_mes.engineer_scheduling |
| | | WHERE type = #{type} |
| | | </delete> |
| | | |
| | | <!-- 批量插入数据到engineer_scheduling表 --> |
| | | <insert id="batchInsert"> |
| | | INSERT INTO north_glass_mes.engineer_scheduling ( |
| | | project_no, |
| | | project_name, |
| | | state, |
| | | type |
| | | ) VALUES |
| | | <foreach collection="list" item="item" separator=","> |
| | | ( |
| | | #{item.projectNo}, |
| | | #{item.projectName}, |
| | | #{item.state}, |
| | | #{item.type} |
| | | ) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | </mapper> |
| | |
| | | log.info("二线卧理: {}", s7DataWLTwo); |
| | | Boolean oneInkageEntity = s7DataWLOne.getDeviceState(); |
| | | int cellFlag = 1; |
| | | if (!oneInkageEntity && !Const.OUT_DISABLE.equals(s7DataWLExtraTwo.getD06SlotState())) { |
| | | if (!oneInkageEntity && !Const.OUT_DISABLE.equals(s7DataWLExtraTwo.getD06SlotState())) { |
| | | cellFlag = 2; |
| | | } |
| | | startOneOpcTaskChild(s7DataWLTwo, 2, cellFlag); |
| | | |
| | | } |
| | | |
| | | private void startOneOpcTaskChild(S7DataWL task, int device, int cellFlag) throws Exception { |
| | |
| | | //状态有3中情况:0空闲 1忙碌 2禁用 |
| | | //两条线都为禁用则不出玻璃 |
| | | if (Const.OUT_DISABLE.equals(oneOutState) && Const.OUT_DISABLE.equals(twoOutState)) { |
| | | log.info("A09、A10为{},{}非自动状态,无法出片", oneOutState, oneOutState); |
| | | log.info("设备{}:A09、A10为{},{}非自动状态,无法出片", deviceId, oneOutState, oneOutState); |
| | | return Boolean.FALSE; |
| | | } |
| | | //获取d06片台状态 |
| | |
| | | cell = Const.TWO_OUT_TARGET_POSITION; |
| | | } |
| | | } |
| | | log.info("{}线路计算完成:{}", deviceId, cell); |
| | | if (cellFlag == 2) { |
| | | if (!outChildTask(task, deviceId, cell, startDate)) { |
| | | cell = cell == Const.ONE_OUT_TARGET_POSITION ? Const.TWO_OUT_TARGET_POSITION : Const.ONE_OUT_TARGET_POSITION; |
| | |
| | | |
| | | //笼内是版图相差是否超过阈值 |
| | | boolean flag = queryMaxMinDiffByDevice(threshold, deviceId); |
| | | log.info("{}阈值计算完成:{}", deviceId, flag); |
| | | if (flag) { |
| | | //先找最小版图版序的玻璃小片 |
| | | EdgStorageCageDetails minEdgDetails = edgStorageCageDetailsService.getOne(new LambdaQueryWrapper<EdgStorageCageDetails>() |
| | |
| | | ); |
| | | } |
| | | } |
| | | log.info("{}按照阈值查找结果:{}", deviceId, edgStorageCageDetails); |
| | | if (null == edgStorageCageDetails) { |
| | | // 获取历史表中上次任务最后一片尺寸 |
| | | EdgStorageDeviceTaskHistory edgeData = edgStorageDeviceTaskHistoryService.getOne(new LambdaQueryWrapper<EdgStorageDeviceTaskHistory>() |
| | | .eq(EdgStorageDeviceTaskHistory::getDeviceId, cell) |
| | | .in(EdgStorageDeviceTaskHistory::getTaskType, Const.GLASS_CACHE_TYPE_OUT, Const.GLASS_CACHE_TYPE_THROUGH) |
| | | .orderByDesc(EdgStorageDeviceTaskHistory::getId).last("limit 1")); |
| | | log.info("{}获取上次任务信息:{}", deviceId, edgeData); |
| | | if (null != edgeData) { |
| | | GlassInfo glassOutInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, edgeData.getGlassIdOut())); |
| | | //笼内的玻璃的尺寸是否和上一次任务一致 |
| | | |
| | | edgStorageCageDetails = edgStorageCageDetailsService.queryEdgStorageDetailsBySize(deviceId, task.getCurrentCell(), glassOutInfo.getWidth(), glassOutInfo.getHeight(), cell, maxThickness); |
| | | if (null == edgStorageCageDetails && StringUtils.isNotBlank(task.getGlassIdIn())) { |
| | | GlassInfo glassInInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>() |
| | |
| | | } |
| | | } |
| | | } |
| | | log.info("{}获取历史表中上次任务最后一片尺寸:{}", deviceId, edgStorageCageDetails); |
| | | //前面已经尺寸问题处理完毕,开始计算无相同尺寸的新玻璃小片 |
| | | if (null == edgStorageCageDetails) { |
| | | edgStorageCageDetails = edgStorageCageDetailsService.queryEdgStorageDetailsByLimitSize(deviceId, Integer.parseInt(task.getCurrentCell().toString()), 0, 0, |
| | | cell, minOneFirstLength, minOneSecondLength, maxTwoFirstLength, maxTwoSecondLength, maxThickness); |
| | | } |
| | | log.info("{}开始计算无相同尺寸的新玻璃小片:{}", deviceId, edgStorageCageDetails); |
| | | if (edgStorageCageDetails == null && StringUtils.isNotBlank(task.getGlassIdIn())) { |
| | | //和上次任务不存在相同尺寸 |
| | | GlassInfo glassInInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, task.getGlassIdIn())); |
| | |
| | | log.info("直通任务目标线路为{},进片玻璃尺寸为{}*{},不符合出片条件", cell, maxLength, minLength); |
| | | } |
| | | } |
| | | log.info("{}直通任务:{}", deviceId, edgStorageCageDetails); |
| | | if (edgStorageCageDetails == null) { |
| | | //和上次任务不存在相同尺寸 |
| | | log.info("笼内没有玻璃了"); |
| | |
| | | if (3 != task.getTaskState()) { |
| | | return Boolean.FALSE; |
| | | } |
| | | log.info("5、直通任务,将玻璃信息插入卧式理片笼,当前玻璃信息:{}", edgStorageCageDetails); |
| | | log.info("5、{}直通任务,将玻璃信息插入卧式理片笼,当前玻璃信息:{}", edgStorageCageDetails); |
| | | if (glassInIdOne.equals(task.getGlassIdIn()) || glassInIdTwo.equals(task.getGlassIdIn())) { |
| | | log.info("玻璃id与上次相同,禁止进片"); |
| | | return Boolean.FALSE; |
| | |
| | | GlassInfo one = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId)); |
| | | BeanUtils.copyProperties(one, edgStorageCageDetails); |
| | | } |
| | | EdgStorageCage storageCage = edgStorageCageService.getOne(new LambdaQueryWrapper<EdgStorageCage>() |
| | | .eq(EdgStorageCage::getDeviceId, deviceId) |
| | | .eq(EdgStorageCage::getEnableState, Const.SLOT_ON) |
| | | .ge(EdgStorageCage::getRemainWidth, cellLength) |
| | | .last("order by abs(slot - " + task.getCurrentCell() + ") limit 1")); |
| | | EdgStorageCage storageCage = edgStorageCageService.selectNearestEmpty(Integer.parseInt(task.getCurrentCell().toString()), deviceId, Boolean.TRUE); |
| | | Assert.isTrue(null != storageCage, "格子已满,无法执行直通任务"); |
| | | log.info("3、查询卧式理片笼里面的空格:{}", storageCage); |
| | | edgStorageCageDetails.setSlot(storageCage.getSlot()); |
| | |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.utils.RedisUtil; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | 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 javax.annotation.Resource; |
| | | import java.util.List; |
| | |
| | | String glassId = map.get("glassId"); |
| | | return Result.build(200, "报破损成功", bigStorageCageDetailsService.bigStorageGlassDamageByGlassId(glassId)); |
| | | } |
| | | |
| | | @ApiOperation("查询工程待排产信息") |
| | | @PostMapping("/queryEngineer") //显示工程排产信息 |
| | | @ResponseBody |
| | | public Result<List<BigStorageCageDetails>> queryEngineer() { |
| | | List<BigStorageCageDetails> result = bigStorageCageDetailsService.queryEngineer(); |
| | | return Result.build(200, "", result); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.mes.bigstorage.entity.vo.BigStorageQueryVO; |
| | | import com.mes.bigstoragetask.entity.UpdateBigStorageCageDTO; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * @return |
| | | */ |
| | | boolean cancelTemperingTask(); |
| | | |
| | | |
| | | /** |
| | | * 查询工程待排序信息 |
| | | * @return |
| | | */ |
| | | List<BigStorageCageDetails> queryEngineer(); |
| | | } |
| | |
| | | |
| | | import cn.hutool.core.lang.Assert; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.github.yulichang.toolkit.JoinWrappers; |
| | |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.mapper.GlassInfoMapper; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.sysconfig.entity.SysConfig; |
| | | import com.mes.sysconfig.service.SysConfigService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | |
| | | public void updateDeviceIdBySlot(List<Integer> slotList) { |
| | | baseMapper.updateDeviceIdBySlot(slotList); |
| | | } |
| | | |
| | | @Override |
| | | public List<BigStorageCageDetails> queryEngineer() { |
| | | QueryWrapper<BigStorageCageDetails> wrapper = new QueryWrapper<>(); |
| | | wrapper.select("distinct engineer_id") |
| | | .eq("state", 100); |
| | | return this.list(wrapper); |
| | | } |
| | | } |
| | |
| | | public Result<List<RunTime>> queryRunTimes(String days) { |
| | | return Result.success(bigStorageCageHistoryTaskService.queryRunTimes(days)); |
| | | } |
| | | |
| | | @ApiOperation(value = "查询大理片界面所有信息", notes = "查询大理片界面所有信息") |
| | | @GetMapping("/queryAllMessage") |
| | | public Result<String> queryAllMessage() { |
| | | return Result.success(bigStorageCageHistoryTaskService.queryAllMessage()); |
| | | } |
| | | } |
| | |
| | | DailyProductionVO queryBigDailyProduction(BigStorageCageHistoryRequest request); |
| | | |
| | | List<RunTime> queryRunTimes(String days); |
| | | |
| | | String queryAllMessage(); |
| | | } |
| | | |
| | |
| | | import com.mes.bigstoragecagetask.entity.request.BigStorageCageHistoryRequest; |
| | | import com.mes.bigstoragecagetask.mapper.BigStorageCageHistoryTaskMapper; |
| | | import com.mes.bigstoragecagetask.service.BigStorageCageHistoryTaskService; |
| | | import com.mes.job.OPCPlcSlicecage; |
| | | import com.mes.largenscreen.entity.DailyProductionVO; |
| | | import com.mes.largenscreen.entity.RunTime; |
| | | import com.mes.tools.DateUtil; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | @Service |
| | | public class BigStorageCageHistoryTaskServiceImpl extends ServiceImpl<BigStorageCageHistoryTaskMapper, BigStorageCageHistoryTask> implements BigStorageCageHistoryTaskService { |
| | | |
| | | @Resource |
| | | OPCPlcSlicecage opcPlcSlicecage; |
| | | |
| | | @Override |
| | | public Page<BigStorageCageHistoryTask> queryBigStorageCageHistoryTask(BigStorageCageHistoryRequest request) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<RunTime> queryRunTimes(String days){ |
| | | public List<RunTime> queryRunTimes(String days) { |
| | | return baseMapper.queryRunTimes(days); |
| | | } |
| | | |
| | | @Override |
| | | public String queryAllMessage() { |
| | | try { |
| | | opcPlcSlicecage.plcStorageCageTask(); |
| | | return "success"; |
| | | } catch (Exception exception) { |
| | | exception.printStackTrace(); |
| | | } |
| | | return "fail"; |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.github.xingshuangs.iot.protocol.s7.serializer.S7Serializer; |
| | | import com.kangaroohy.milo.service.MiloService; |
| | | import com.mes.alarm.entity.ProductAlarmInfo; |
| | | import com.mes.alarm.service.ProductAlarmInfoService; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.entity.dto.BigStorageSummaryDTO; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | |
| | | @Resource |
| | | private WebSocketUtils webSocketUtils; |
| | | |
| | | private JSONObject jsonObject = new JSONObject(); |
| | | @Resource |
| | | private ProductAlarmInfoService productAlarmInfoService; |
| | | |
| | | public void queryDataSource1() throws Exception { |
| | | S7DataDLPOne s7DataDLPOne = s7SerializerDLPOne.read(S7DataDLPOne.class); |
| | | S7DataDLPTwo s7DataWLTwo = s7SerializerDLPTwo.read(S7DataDLPTwo.class); |
| | | |
| | | private static final String ALARM_MODULE = "钢化"; |
| | | private static final String ALARM_TYPE = "钢化大理片"; |
| | | private static final String ALARM_CODE_SIZE = "sizeSame"; |
| | | private static final String ALARM_CODE_ID = "idSame"; |
| | | |
| | | |
| | | public JSONObject queryDataSource1() throws Exception { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("alarmInfo", productAlarmInfoService.list(new LambdaQueryWrapper<ProductAlarmInfo>() |
| | | .eq(ProductAlarmInfo::getState, Const.LOAD_RAW_GLASS_NEW) |
| | | .eq(ProductAlarmInfo::getAlarmModule, ALARM_MODULE) |
| | | .eq(ProductAlarmInfo::getAlarmType, ALARM_TYPE))); |
| | | List<Double> carPostion = new ArrayList<>(); |
| | | carPostion.add(0.25); |
| | | carPostion.add(0.5); |
| | |
| | | //界面展示笼子信息 |
| | | jsonObject.append("bigStorageCageInfos", bigStorageCageDetailsService.querybigStorageCageDetail()); |
| | | |
| | | S7DataDLPOne s7DataDLPOne = s7SerializerDLPOne.read(S7DataDLPOne.class); |
| | | S7DataDLPTwo s7DataWLTwo = s7SerializerDLPTwo.read(S7DataDLPTwo.class); |
| | | try { |
| | | //进片任务数据 |
| | | List<BigStorageTaskVO> inTaskList = new ArrayList(); |
| | |
| | | //当前指定工程 |
| | | jsonObject.append("temperingEngineerId", redisUtil.getCacheObject("temperingEngineerId")); |
| | | |
| | | |
| | | return jsonObject; |
| | | } |
| | | |
| | | public void queryDataSource2() throws InterruptedException { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //出片队列 |
| | | List<TemperingGlassInfo> temperingGlassInfoList = temperingGlassInfoService.list( |
| | | new LambdaQueryWrapper<TemperingGlassInfo>() |
| | |
| | | */ |
| | | @Scheduled(fixedDelay = 3000) |
| | | public void plcStorageCageTask() throws Exception { |
| | | jsonObject = new JSONObject(); |
| | | //查询使用数据源1查询数据 |
| | | queryDataSource1(); |
| | | JSONObject jsonObject = queryDataSource1(); |
| | | //查询使用数据源2查询数据 |
| | | // queryDataSource2(); |
| | | webSocketUtils.sendToWeb("slicecage", jsonObject); |
| | |
| | | import com.github.yulichang.toolkit.JoinWrappers; |
| | | import com.kangaroohy.milo.model.ReadWriteEntity; |
| | | import com.kangaroohy.milo.service.MiloService; |
| | | import com.mes.alarm.entity.ProductAlarmInfo; |
| | | import com.mes.alarm.service.ProductAlarmInfoService; |
| | | import com.mes.base.entity.BigStorageCageBaseInfo; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | |
| | | */ |
| | | private static final Integer THROUGH_SLOT = 920; |
| | | |
| | | |
| | | @Resource |
| | | private ProductAlarmInfoService productAlarmInfoService; |
| | | |
| | | private static final String ALARM_MODULE = "钢化"; |
| | | private static final String ALARM_TYPE = "钢化大理片"; |
| | | private static final String ALARM_CODE_SIZE = "sizeSame"; |
| | | private static final String ALARM_CODE_ID = "idSame"; |
| | | |
| | | @Resource |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void inBigStorageTask() { |
| | | List<ProductAlarmInfo> alarmInfos = productAlarmInfoService.list(new LambdaQueryWrapper<ProductAlarmInfo>() |
| | | .eq(ProductAlarmInfo::getState, Const.LOAD_RAW_GLASS_NEW) |
| | | .eq(ProductAlarmInfo::getAlarmModule, ALARM_MODULE) |
| | | .eq(ProductAlarmInfo::getAlarmType, ALARM_TYPE)); |
| | | if (CollectionUtil.isNotEmpty(alarmInfos)) { |
| | | log.info("界面报警,等待人工干预处理"); |
| | | return; |
| | | } |
| | | S7DataDLPOne s7DataDLPOne = s7SerializerDLPOne.read(S7DataDLPOne.class); |
| | | log.info("进片任务开始{}", s7DataDLPOne); |
| | | Boolean inkageEntity = s7DataDLPOne.getMesControl(); |
| | |
| | | if (entry.getValue() > 1) { |
| | | log.info("进片玻璃{}存在相同,结束本次任务", entry.getKey()); |
| | | //向plc发送报警:同一车进片玻璃存在相同 |
| | | ProductAlarmInfo alarmInfo = new ProductAlarmInfo(); |
| | | alarmInfo.setState(Const.LOAD_RAW_GLASS_NEW); |
| | | alarmInfo.setAlarmModule(ALARM_MODULE); |
| | | alarmInfo.setAlarmType(ALARM_TYPE); |
| | | alarmInfo.setAlarmCode(ALARM_CODE_ID); |
| | | alarmInfo.setAlarmMessage(entry.getKey()); |
| | | productAlarmInfoService.save(alarmInfo); |
| | | s7DataDLPOne = new S7DataDLPOne(); |
| | | s7DataDLPOne.setAlarmSignal(2); |
| | | s7SerializerDLPOne.write(s7DataDLPOne); |
| | |
| | | if (CollectionUtil.isNotEmpty(detailsList)) { |
| | | log.info("理片笼存在相同的进片玻璃{},结束本次任务", detailsList); |
| | | //向plc发送报警:理片笼存在相同的进片玻璃 |
| | | List<String> sameGlassIds = detailsList.stream() |
| | | .map(BigStorageCageDetails::getGlassId) |
| | | .collect(Collectors.toList()); |
| | | ProductAlarmInfo alarmInfo = new ProductAlarmInfo(); |
| | | alarmInfo.setState(Const.LOAD_RAW_GLASS_NEW); |
| | | alarmInfo.setAlarmModule(ALARM_MODULE); |
| | | alarmInfo.setAlarmType(ALARM_TYPE); |
| | | alarmInfo.setAlarmCode(ALARM_CODE_ID); |
| | | alarmInfo.setAlarmMessage(sameGlassIds.toString()); |
| | | productAlarmInfoService.save(alarmInfo); |
| | | |
| | | s7DataDLPOne = new S7DataDLPOne(); |
| | | s7DataDLPOne.setAlarmSignal(4); |
| | | s7SerializerDLPOne.write(s7DataDLPOne); |
| | |
| | | damage_temp as ( |
| | | select engineer_id, tempering_layout_id, count(*) as damage_count |
| | | from damage |
| | | where type in(8,9) |
| | | where type in(8,9) and STATUS = 1 |
| | | group by engineer_id, tempering_layout_id |
| | | ), |
| | | result as ( |
| | |
| | | import com.mes.pp.service.OptimizeProjectService; |
| | | import com.mes.rawglassdetails.entity.RawGlassStorageDetails; |
| | | import com.mes.rawglassstation.service.RawGlassStorageStationService; |
| | | import com.mes.tools.WebSocketServer; |
| | | import com.mes.tools.WebSocketUtils; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.service.UpPattenUsageService; |
| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | private void loadGlassChild(String redisRequest, int stationCell, String tableName, String webSocketName) { |
| | | public String loadGlassChild(String redisRequest, int stationCell, String tableName, String webSocketName) { |
| | | try { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //当前线路正在执行的工程 |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return "success"; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mes.job.PlcLoadGlassTask; |
| | | import com.mes.loadglassdevicetaskhistory.entity.request.LoadGlassRequest; |
| | | import com.mes.opctask.entity.LoadGlassDeviceTaskHistory; |
| | | import com.mes.opctask.entity.request.LoadGlassDeviceTaskHistoryRequest; |
| | | import com.mes.opctask.service.LoadGlassDeviceTaskHistoryService; |
| | | import com.mes.pp.service.OptimizeProjectService; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | 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 java.util.List; |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author wf |
| | |
| | | @RequestMapping("/loadglassdevicetaskhistory") |
| | | public class LoadGlassDeviceTaskHistoryController { |
| | | |
| | | @Resource |
| | | PlcLoadGlassTask plcLoadGlassTask; |
| | | @Autowired |
| | | private LoadGlassDeviceTaskHistoryService loadGlassDeviceTaskHistoryService; |
| | | |
| | |
| | | return Result.build(200, "查询成功", loadGlassDeviceTaskHistoryService.queryLoadGlassHistoryTask(request)); |
| | | } |
| | | |
| | | @ApiOperation("查询线路所有数据") |
| | | @PostMapping("/queryAllMessage") //查询现在上片机的玻璃信息 |
| | | public Result<String> queryAllMessage(@RequestBody @Validated LoadGlassRequest request) { |
| | | return Result.build(200, "查询成功", plcLoadGlassTask.loadGlassChild(request.getRedisRequest(), request.getStationCell(), |
| | | request.getTableName(), request.getWebSocketName())); |
| | | } |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | package com.mes.loadglassdevicetaskhistory.entity.request; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2025/10/11 11:04 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class LoadGlassRequest { |
| | | |
| | | @ApiModelProperty(value = "redis名字(loadGlassRequestOne loadGlassRequestTwo)", position = 1) |
| | | private String redisRequest; |
| | | @ApiModelProperty(value = "线路(5 6)", position = 2) |
| | | private int stationCell; |
| | | @ApiModelProperty(value = "线路表名(LOAD_GLASS_DEVICE_ONE_TASK LOAD_GLASS_DEVICE_TWO_TASK)", position = 3) |
| | | private String tableName; |
| | | @ApiModelProperty(value = "websocket(loadGlassOne loadGlassTwo)", position = 4) |
| | | private String webSocketName; |
| | | } |
| | |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cache.annotation.EnableCaching; |
| | | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc; |
| | |
| | | @EnableDiscoveryClient |
| | | @MapperScan(basePackages = "com.mes.*.mapper") |
| | | @EnableScheduling |
| | | @EnableCaching |
| | | public class HollowGlassApplication { |
| | | |
| | | public static void main(String[] args) { |
| | |
| | | |
| | | |
| | | import com.mes.damage.entity.request.DamageRequest; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.hollow.entity.dto.LackDetailsDTO; |
| | | import com.mes.hollow.entity.vo.HollowAllFlowCardVO; |
| | | import com.mes.hollow.entity.vo.HollowBigStorageDetailsQueryVO; |
| | |
| | | return Result.success(hollowAllFlowCardVOList); |
| | | } |
| | | |
| | | @ApiOperation("查询指定流程卡及层数的缺片详情") |
| | | @PostMapping("/queryLackByFlowCard") |
| | | public Result<List<LackDetailsDTO>> queryLackByFlowCard() { |
| | | List<LackDetailsDTO> lackDetailsList = hollowGlassRelationInfoService.queryLackByFlowCard(); |
| | | @ApiOperation("界面展示:查询流程卡、层数的缺片详情") |
| | | @PostMapping("/queryAllLackByFlowCard") |
| | | public Result<List<LackDetailsDTO>> queryAllLackByFlowCard() { |
| | | List<LackDetailsDTO> lackDetailsList = hollowGlassRelationInfoService.queryAllLackByFlowCard(); |
| | | return Result.success(lackDetailsList); |
| | | } |
| | | |
| | | @ApiOperation("按照流程卡、订单序号、层号获取缺片玻璃信息详情") |
| | | @PostMapping("/queryLackGlassByFlowCard") |
| | | public Result<List<GlassInfo>> queryLackGlassByFlowCard(@RequestBody HollowBigStorageDetailsQueryVO query) { |
| | | List<GlassInfo> lackGlassList = hollowGlassRelationInfoService.queryLackGlassByFlowCard(query); |
| | | return Result.success(lackGlassList); |
| | | } |
| | | |
| | | // @ApiOperation("查询指定流程卡及层数的缺片详情") |
| | |
| | | // List<LackDetailsDTO> lackDetailsList = hollowGlassRelationInfoService.queryLackByFlowCard(flowCardId); |
| | | // return Result.success(lackDetailsList); |
| | | // } |
| | | @ApiOperation("查询指定流程卡的缺片详情") |
| | | @PostMapping("/queryLackByFlowCard") |
| | | public Result<Map<Integer,List<LackDetailsDTO>>> queryLackByFlowCard(String flowCardId) { |
| | | Map<Integer,List<LackDetailsDTO>> lackDetailsMap = hollowGlassRelationInfoService.queryLackByFlowCard(flowCardId); |
| | | return Result.success(lackDetailsMap); |
| | | } |
| | | |
| | | @ApiOperation("中空缺片爆破笼报破损") |
| | | @PostMapping("/hollowBigStorageGlassDamage") |
| | |
| | | */ |
| | | private String productName; |
| | | /** |
| | | * 中空片序 0 直通 1 笼内 |
| | | */ |
| | | private int hollowSequence; |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private String filmsId; |
| | |
| | | */ |
| | | private String flowCardId; |
| | | /** |
| | | * 玻璃id |
| | | */ |
| | | private String glassId; |
| | | /** |
| | | * 流程卡 |
| | | */ |
| | | private int layer; |
| | |
| | | * /*破损片数 |
| | | */ |
| | | private Integer damageCount; |
| | | /** |
| | | * /*补片数量 |
| | | */ |
| | | private Integer patchCount; |
| | | |
| | | /** |
| | | * 工序 |
| | | */ |
| | | private String workingProcedure; |
| | | |
| | | } |
| | |
| | | * 产品名称 |
| | | */ |
| | | private String productName; |
| | | /** |
| | | * 序号 |
| | | */ |
| | | private Integer orderSort; |
| | | /** |
| | | * 层 |
| | | */ |
| | | private Integer layer; |
| | | |
| | | } |
| | |
| | | import com.mes.hollow.entity.dto.FlowCardGlassInfoDTO; |
| | | import com.mes.hollow.entity.dto.FlowCardVirtualSlotDTO; |
| | | import com.mes.hollow.entity.dto.UpdateHollowBigStorageCageDTO; |
| | | import com.mes.hollow.entity.vo.HollowBigStorageDetailsQueryVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | void updateDeviceIdBySlot(@Param("list") List<Integer> slotList); |
| | | |
| | | List<HollowBigStorageCageDetails> queryPairGlassList(@Param("flowCardId")String flowCardId, @Param("totalLayer")Integer totalLayer, @Param("totalPairQuantity")Integer totalPairQuantity,@Param("isOut") Integer isOut); |
| | | List<HollowBigStorageCageDetails> queryPairGlassList(@Param("flowCardId") String flowCardId, @Param("totalLayer") Integer totalLayer, @Param("totalPairQuantity") Integer totalPairQuantity, @Param("isOut") Integer isOut); |
| | | |
| | | List<FlowCardVirtualSlotDTO> queryFlowCardIdsAndLayer(); |
| | | |
| | | /** |
| | | * 查询笼内的缺片详情 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | | List<FlowCardGlassInfoDTO> queryHollowAllFlowCard(HollowBigStorageDetailsQueryVO query); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.hollow.entity.HollowGlassOutRelationInfo; |
| | | import com.mes.hollow.entity.dto.OrderDTO; |
| | | import com.mes.hollow.entity.dto.OrderDetailsDTO; |
| | | import com.mes.largenscreen.entity.PieChartVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | OrderDTO queryOrderByFlowCardId(@Param("flowCardId") String flowCardId); |
| | | |
| | | List<PieChartVO> queryPieChart(); |
| | | |
| | | /** |
| | | * 按照流程卡获取产品名称 |
| | | * |
| | | * @param flowCardId |
| | | * @return |
| | | */ |
| | | OrderDetailsDTO queryProductNameByFlowCardId(String flowCardId); |
| | | } |
| | | |
| | |
| | | package com.mes.hollow.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.hollow.entity.HollowGlassRelationInfo; |
| | | import com.mes.hollow.entity.dto.HollowGlassDetailsDTO; |
| | | import com.mes.hollow.entity.dto.LackDetailsDTO; |
| | | import com.mes.hollow.entity.dto.OrderDetailsDTO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | List<HollowGlassDetailsDTO> queryFlowCardIdLayerGlassInfo(@Param("flowCardId") String flowCardId, @Param("totalLayer") int totalLayer, @Param("layer") int layer); |
| | | |
| | | List<LackDetailsDTO> queryLackByFlowCard(); |
| | | List<LackDetailsDTO> queryAllLackByFlowCard(); |
| | | |
| | | int queryLayerByFlowCardId(@Param("flowCardId") String flowCardId); |
| | | |
| | |
| | | * @param flowCardId |
| | | * @return |
| | | */ |
| | | OrderDetailsDTO queryProductNameByFlowCardId(@Param("flowCardId") String flowCardId,@Param("productName") String productName,@Param("customerName") String customerName); |
| | | OrderDetailsDTO queryProductNameByFlowCardId(@Param("flowCardId") String flowCardId, @Param("productName") String productName, @Param("customerName") String customerName); |
| | | |
| | | List<LackDetailsDTO> queryLackByFlowCard(@Param("flowCardId") String flowCardId); |
| | | |
| | | List<GlassInfo> queryLackGlassByFlowCard(@Param("flowCardId") String flowCardId, @Param("orderSort") Integer orderSort, @Param("layer") Integer layer); |
| | | } |
| | | |
| | |
| | | import com.mes.base.entity.vo.BigStorageVO; |
| | | import com.mes.hollow.entity.HollowBigStorageCageDetails; |
| | | import com.mes.hollow.entity.dto.*; |
| | | import com.mes.hollow.entity.vo.HollowAllFlowCardVO; |
| | | import com.mes.hollow.entity.vo.HollowBigStorageDetailsQueryVO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | Boolean updateHollowStorageCageDisabled(int slot, int enableState); |
| | | |
| | | List<FlowCardVirtualSlotDTO> queryFlowCardIdsAndLayer(); |
| | | |
| | | List<FlowCardGlassInfoDTO> queryHollowAllFlowCard(HollowBigStorageDetailsQueryVO query); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.hollow.entity.HollowGlassOutRelationInfo; |
| | | import com.mes.hollow.entity.dto.OrderDetailsDTO; |
| | | import com.mes.hollow.entity.request.HollowHistoryTaskRequest; |
| | | import com.mes.hollow.entity.request.HollowTaskRequest; |
| | | import com.mes.hollowqueue.entity.HollowGlassQueueInfo; |
| | |
| | | |
| | | List<String> hollowTaskList(int cell); |
| | | |
| | | Map<String, List<HollowGlassQueueInfo>> appointHollowTaskDetails( int cell); |
| | | Map<String, List<HollowGlassQueueInfo>> appointHollowTaskDetails(int cell); |
| | | |
| | | Boolean startTask(int cell); |
| | | |
| | |
| | | Page<HollowGlassOutRelationInfo> queryHollowHistoryTask(HollowHistoryTaskRequest request); |
| | | |
| | | List<PieChartVO> queryPieChart(); |
| | | |
| | | OrderDetailsDTO queryProductNameByFlowCardId(String flowCardId); |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.damage.entity.request.DamageRequest; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.hollow.entity.HollowGlassRelationInfo; |
| | | import com.mes.hollow.entity.dto.FlowCardGlassInfoDTO; |
| | | import com.mes.hollow.entity.dto.HollowBigStorageDTO; |
| | | import com.mes.hollow.entity.dto.LackDetailsDTO; |
| | | import com.mes.hollow.entity.dto.OrderDetailsDTO; |
| | | import com.mes.hollow.entity.vo.HollowAllFlowCardVO; |
| | | import com.mes.hollow.entity.vo.HollowBigStorageDetailsQueryVO; |
| | | |
| | |
| | | |
| | | List<FlowCardGlassInfoDTO> queryHollowAllFlowCardSummary(HollowBigStorageDetailsQueryVO query); |
| | | |
| | | List<LackDetailsDTO> queryLackByFlowCard(); |
| | | List<LackDetailsDTO> queryAllLackByFlowCard(); |
| | | |
| | | int queryLayerByFlowCardId(String flowCardId); |
| | | // List<LackDetailsDTO> queryLackByFlowCard(String flowCardId); |
| | | |
| | | Map<Integer,List<LackDetailsDTO>> queryLackByFlowCard(String flowCardId); |
| | | |
| | | |
| | | /** |
| | |
| | | Integer getGlassGapByThickness(Double thickness); |
| | | |
| | | Boolean hollowBigStorageGlassDamage(DamageRequest request); |
| | | |
| | | OrderDetailsDTO queryProductNameByFlowCardId(String flowCardId, String productName, String customerName); |
| | | |
| | | List<GlassInfo> queryLackGlassByFlowCard(HollowBigStorageDetailsQueryVO query); |
| | | } |
| | | |
| | |
| | | return baseMapper.queryFlowCardIdsAndLayer(); |
| | | } |
| | | |
| | | @Override |
| | | public List<FlowCardGlassInfoDTO> queryHollowAllFlowCard(HollowBigStorageDetailsQueryVO query) { |
| | | return baseMapper.queryHollowAllFlowCard(query); |
| | | } |
| | | |
| | | private List<HollowBigStorageAndDetailsDTO> hollowBigStorageCageDetailsChild(String glassId, Integer deviceId, Integer slot, int state) { |
| | | //将对应格子号的玻璃id置为101 |
| | | this.update(new LambdaUpdateWrapper<HollowBigStorageCageDetails>() |
| | |
| | | import freemarker.template.Version; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | return this.page(page, wrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Cacheable(value = "orderDetails", key = "#flowCardId") |
| | | public OrderDetailsDTO queryProductNameByFlowCardId(String flowCardId) { |
| | | log.info("查询数据库一次:{}", flowCardId); |
| | | return baseMapper.queryProductNameByFlowCardId(flowCardId); |
| | | } |
| | | |
| | | private HollowGlassOutRelationInfo childrenTask(HollowTaskRequest request, int isForce) { |
| | | GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getFlowCardId, request.getFlowCardId()).last("limit 1")); |
| | |
| | | .last("limit 1") |
| | | ); |
| | | } |
| | | Assert.isTrue(null != relationInfoOne, "相关流程卡未找到对应的组号信息,玻璃流程卡:{},序号:{},总层数:{},层数:{}", flowCardId, glassType, totalLayer, layer); |
| | | if (null == relationInfoOne) { |
| | | throw new RuntimeException("相关流程卡未找到对应的组号信息,玻璃流程卡:" + flowCardId + ",序号:" + glassType + ",总层数:" + totalLayer + ",层数:" + layer); |
| | | } |
| | | Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_WIDTH); |
| | | //详情表内获取本组是否已经有玻璃在笼子内(0表示提前占用) |
| | | int taskCount = hollowGlassOutRelationInfoService.count(new LambdaQueryWrapper<HollowGlassOutRelationInfo>() |
| | |
| | | public List<HollowAllFlowCardVO> queryHollowAllFlowCard(HollowBigStorageDetailsQueryVO query) { |
| | | Date startDate = new Date(); |
| | | log.info("开始查询中空流程卡任务信息,开始时间{}", startDate); |
| | | List<HollowBigStorageCageDetails> detailsList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .like(StringUtils.isNotBlank(query.getFilmsId()), HollowBigStorageCageDetails::getFilmsId, query.getFilmsId()) |
| | | .like(StringUtils.isNotBlank(query.getFlowCardId()), HollowBigStorageCageDetails::getFlowCardId, query.getFlowCardId()) |
| | | .eq(query.getThickness() != 0, HollowBigStorageCageDetails::getThickness, query.getThickness()) |
| | | .orderByAsc(HollowBigStorageCageDetails::getFlowCardId) |
| | | ); |
| | | List<FlowCardGlassInfoDTO> detailsList = hollowBigStorageCageDetailsService.queryHollowAllFlowCard(query); |
| | | |
| | | if (CollectionUtil.isEmpty(detailsList)) { |
| | | log.info("笼内无玻璃"); |
| | | return new ArrayList<>(); |
| | | } |
| | | Date middleDate = new Date(); |
| | | log.info("中空理片笼详情数据已查询完毕,耗时:{}ms", middleDate.getTime() - startDate.getTime()); |
| | | Map<String, List<HollowBigStorageCageDetails>> listMap = detailsList.stream().collect(Collectors.groupingBy(HollowBigStorageCageDetails::getFlowCardId)); |
| | | Map<String, List<FlowCardGlassInfoDTO>> listMap = detailsList.stream().collect(Collectors.groupingBy(FlowCardGlassInfoDTO::getFlowCardId)); |
| | | List<HollowAllFlowCardVO> resultList = new ArrayList<>(); |
| | | AtomicInteger pairTotalCount = new AtomicInteger(); |
| | | listMap.forEach((e, v) -> { |
| | | HollowAllFlowCardVO hollowAllFlowCardVO = new HollowAllFlowCardVO(); |
| | | HollowBigStorageCageDetails cageDetails = v.get(0); |
| | | FlowCardGlassInfoDTO cageDetails = v.get(0); |
| | | //按照流程卡获取对应的产品名称 |
| | | OrderDetailsDTO orderDetails = baseMapper.queryProductNameByFlowCardId(cageDetails.getFlowCardId(), query.getProductName(), query.getCustomerName()); |
| | | OrderDetailsDTO orderDetails = this.queryProductNameByFlowCardId(cageDetails.getFlowCardId(), query.getProductName(), query.getCustomerName()); |
| | | if (null != orderDetails) { |
| | | BeanUtils.copyProperties(orderDetails, hollowAllFlowCardVO); |
| | | hollowAllFlowCardVO.setFlowCardId(e); |
| | |
| | | } else { |
| | | hollowAllFlowCardVO.setIsThroughSlot(Boolean.FALSE); |
| | | } |
| | | List<FlowCardGlassInfoDTO> flowCardInfoList = hollowBigStorageCageDetailsService.hollowIsAll(e, cageDetails.getTotalLayer(), Boolean.FALSE); |
| | | log.info("获取到的流程卡信息为:{}", flowCardInfoList); |
| | | if (CollectionUtil.isNotEmpty(flowCardInfoList)) { |
| | | hollowAllFlowCardVO.setFlowCardGlassInfoDTOList(flowCardInfoList); |
| | | pairTotalCount.addAndGet(flowCardInfoList.get(0).getPairCount()); |
| | | } |
| | | hollowAllFlowCardVO.setFlowCardGlassInfoDTOList(v); |
| | | pairTotalCount.addAndGet(cageDetails.getPairCount()); |
| | | resultList.add(hollowAllFlowCardVO); |
| | | } |
| | | }); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<LackDetailsDTO> queryLackByFlowCard() { |
| | | List<LackDetailsDTO> lackDetailsList = this.baseMapper.queryLackByFlowCard(); |
| | | public List<LackDetailsDTO> queryAllLackByFlowCard() { |
| | | List<LackDetailsDTO> lackDetailsList = this.baseMapper.queryAllLackByFlowCard(); |
| | | return lackDetailsList; |
| | | } |
| | | |
| | | @Override |
| | | public int queryLayerByFlowCardId(String flowCardId) { |
| | | return baseMapper.queryLayerByFlowCardId(flowCardId); |
| | | } |
| | | |
| | | @Override |
| | | public Map<Integer,List<LackDetailsDTO>> queryLackByFlowCard(String flowCardId) { |
| | | List<LackDetailsDTO> detailsDTOS = baseMapper.queryLackByFlowCard(flowCardId); |
| | | return detailsDTOS.stream().collect(Collectors.groupingBy(item -> item.getLayer())); |
| | | } |
| | | |
| | | @Override |
| | |
| | | List<GlassInfo> glassInfos = glassInfoService.list(new LambdaQueryWrapper<GlassInfo>() |
| | | .eq(GlassInfo::getFlowCardId, request.getFlowCardId()) |
| | | .eq(GlassInfo::getLayer, request.getLayer()) |
| | | .eq(GlassInfo::getGlassType, request.getGlassType())); |
| | | .eq(GlassInfo::getGlassType, request.getGlassType()) |
| | | .eq(request.getGlassId() != null, GlassInfo::getGlassId, request.getGlassId()) |
| | | ); |
| | | for (GlassInfo glassInfo : glassInfos) { |
| | | //掰片报破损 |
| | | damageService.autoSubmitReport(glassInfo.getGlassId(), request.getLine(), request.getWorkingProcedure(), request.getRemark(), request.getState()); |
| | |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | | @Override |
| | | public List<GlassInfo> queryLackGlassByFlowCard(HollowBigStorageDetailsQueryVO query) { |
| | | return baseMapper.queryLackGlassByFlowCard(query.getFlowCardId(), query.getOrderSort(), query.getLayer()); |
| | | } |
| | | |
| | | @Override |
| | | public OrderDetailsDTO queryProductNameByFlowCardId(String flowCardId, String productName, String customerName) { |
| | | OrderDetailsDTO dto = hollowGlassOutRelationInfoService.queryProductNameByFlowCardId(flowCardId); |
| | | if ((StringUtils.isBlank(productName) || dto.getProductName().contains(productName)) && (StringUtils.isBlank(customerName) || dto.getCustomerName().contains(customerName))) { |
| | | return dto; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | private void sortFlowCardIdList(List<HollowAllFlowCardVO> list) { |
| | | Pattern pattern = Pattern.compile("^NG(\\d+)([A-Za-z]+)(\\d+)$"); |
| | | |
| | |
| | | public Result<List<RunTime>> queryRunTimes(String days) { |
| | | return Result.success(hollowBigStorageCageHistoryTaskService.queryRunTimes(days)); |
| | | } |
| | | |
| | | @ApiOperation(value = "查询中空大理片界面所有信息", notes = "查询中空大理片界面所有信息") |
| | | @GetMapping("/queryAllMessage") |
| | | public Result<String> queryAllMessage() { |
| | | return Result.success(hollowBigStorageCageHistoryTaskService.queryAllMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | DailyProductionVO queryHollowDailyProduction(HollowBigStorageCageHistoryRequest request); |
| | | |
| | | List<RunTime> queryRunTimes(String days); |
| | | |
| | | String queryAllMessage(); |
| | | } |
| | | |
| | |
| | | import com.mes.hollowtask.entity.request.HollowBigStorageCageHistoryRequest; |
| | | import com.mes.hollowtask.mapper.HollowBigStorageCageHistoryTaskMapper; |
| | | import com.mes.hollowtask.service.HollowBigStorageCageHistoryTaskService; |
| | | import com.mes.job.PushMessageToIndex; |
| | | import com.mes.largenscreen.entity.DailyProductionVO; |
| | | import com.mes.largenscreen.entity.RunTime; |
| | | import com.mes.tools.DateUtil; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | @Service |
| | | public class HollowBigStorageCageHistoryTaskServiceImpl extends ServiceImpl<HollowBigStorageCageHistoryTaskMapper, HollowBigStorageCageHistoryTask> implements HollowBigStorageCageHistoryTaskService { |
| | | |
| | | @Resource |
| | | PushMessageToIndex pushMessageToIndex; |
| | | |
| | | @Override |
| | | public Page<HollowBigStorageCageHistoryTask> queryHollowBigStorageCageHistoryTask(HollowBigStorageCageHistoryRequest request) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<RunTime> queryRunTimes(String days){ |
| | | public List<RunTime> queryRunTimes(String days) { |
| | | return baseMapper.queryRunTimes(days); |
| | | } |
| | | |
| | | @Override |
| | | public String queryAllMessage() { |
| | | pushMessageToIndex.hollowGlassMessage(); |
| | | return "success"; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | private static final String ALARM_MODULE = "中空"; |
| | | private static final String ALARM_TYPE = "中空大理片"; |
| | | private static final String ALARM_CODE = "sizeSame"; |
| | | private static final String ALARM_CODE_SIZE = "sizeSame"; |
| | | private static final String ALARM_CODE_ID = "idSame"; |
| | | |
| | | /** |
| | | * 直通格子 |
| | |
| | | List<ProductAlarmInfo> alarmInfos = productAlarmInfoService.list(new LambdaQueryWrapper<ProductAlarmInfo>() |
| | | .eq(ProductAlarmInfo::getState, Const.LOAD_RAW_GLASS_NEW) |
| | | .eq(ProductAlarmInfo::getAlarmModule, ALARM_MODULE) |
| | | .eq(ProductAlarmInfo::getAlarmType, ALARM_TYPE) |
| | | .eq(ProductAlarmInfo::getAlarmCode, ALARM_CODE)); |
| | | .eq(ProductAlarmInfo::getAlarmType, ALARM_TYPE)); |
| | | if (CollectionUtil.isNotEmpty(alarmInfos)) { |
| | | log.info("界面报警,等待人工干预处理"); |
| | | return; |
| | |
| | | for (Map.Entry<String, Long> entry : glassCountMap.entrySet()) { |
| | | if (entry.getValue() > 1) { |
| | | log.info("进片玻璃{}存在相同,结束本次任务", entry.getKey()); |
| | | ProductAlarmInfo alarmInfo = new ProductAlarmInfo(); |
| | | alarmInfo.setState(Const.LOAD_RAW_GLASS_NEW); |
| | | alarmInfo.setAlarmModule(ALARM_MODULE); |
| | | alarmInfo.setAlarmType(ALARM_TYPE); |
| | | alarmInfo.setAlarmCode(ALARM_CODE_ID); |
| | | alarmInfo.setAlarmMessage(entry.getKey()); |
| | | productAlarmInfoService.save(alarmInfo); |
| | | //向plc发送报警:同一车进片玻璃存在相同 |
| | | s7DataZKDLPOne = new S7DataZKDLPOne(); |
| | | s7DataZKDLPOne.setAlramSignal(2); |
| | |
| | | if (CollectionUtil.isNotEmpty(detailsList)) { |
| | | log.info("理片笼存在相同的进片玻璃{},结束本次任务", detailsList); |
| | | //向plc发送报警:理片笼存在相同的进片玻璃 |
| | | List<String> sameGlassIds = detailsList.stream() |
| | | .map(HollowBigStorageCageDetails::getGlassId) |
| | | .collect(Collectors.toList()); |
| | | ProductAlarmInfo alarmInfo = new ProductAlarmInfo(); |
| | | alarmInfo.setState(Const.LOAD_RAW_GLASS_NEW); |
| | | alarmInfo.setAlarmModule(ALARM_MODULE); |
| | | alarmInfo.setAlarmType(ALARM_TYPE); |
| | | alarmInfo.setAlarmCode(ALARM_CODE_ID); |
| | | alarmInfo.setAlarmMessage(sameGlassIds.toString()); |
| | | productAlarmInfoService.save(alarmInfo); |
| | | s7DataZKDLPOne = new S7DataZKDLPOne(); |
| | | s7DataZKDLPOne.setAlramSignal(4); |
| | | s7SerializerZKDLPOne.write(s7DataZKDLPOne); |
| | |
| | | alarmInfo.setState(Const.LOAD_RAW_GLASS_NEW); |
| | | alarmInfo.setAlarmModule(ALARM_MODULE); |
| | | alarmInfo.setAlarmType(ALARM_TYPE); |
| | | alarmInfo.setAlarmCode(ALARM_CODE); |
| | | alarmInfo.setAlarmCode(ALARM_CODE_SIZE); |
| | | alarmInfo.setAlarmMessage(info.getGlassId()); |
| | | productAlarmInfoService.save(alarmInfo); |
| | | //重置详情表数据 |
| | |
| | | } |
| | | baseInfoList = resultList; |
| | | } else { |
| | | //大于总层数先取totalLyaer倍数数量的玻璃,保证大车上的玻璃成对传 |
| | | //大于总层数先取totalLayer倍数数量的玻璃,保证大车上的玻璃成对传 |
| | | int remainCount = templist.size() % totalLayer; |
| | | if (targetSlot == 930) { |
| | | baseInfoList = templist.subList(0, totalLayer); |
| | | int tempSequence = templist.get(0).getHollowSequence(); |
| | | List<T> resultList = new ArrayList<>(); |
| | | for (int i = 0; i < templist.size(); i++) { |
| | | if (tempSequence == list.get(i).getHollowSequence()) { |
| | | resultList.add(templist.get(i)); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | baseInfoList = resultList; |
| | | } else { |
| | | baseInfoList = templist.subList(0, templist.size() - remainCount); |
| | | } |
| | |
| | | jsonObject.append("bigStorageCageUsageSummary", bigStorageCageUsageSummary); |
| | | |
| | | //缺片详情 |
| | | List<LackDetailsDTO> lackDetailsList = hollowGlassRelationInfoService.queryLackByFlowCard(); |
| | | List<LackDetailsDTO> lackDetailsList = hollowGlassRelationInfoService.queryAllLackByFlowCard(); |
| | | jsonObject.append("lackDetailsList", lackDetailsList); |
| | | |
| | | jsonObject.append("alarmInfo", productAlarmInfoService.list(new LambdaQueryWrapper<ProductAlarmInfo>() |
| | |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | northGlassMes: |
| | | url: jdbc:mysql://127.0.0.1:3306/north_glass_mes?serverTimezone=GMT%2b8 |
| | | url: jdbc:mysql://127.0.0.1:3306/yw_mes?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | |
| | | discovery: |
| | | server-addr: 127.0.0.1:8848 |
| | | redis: |
| | | database: 0 |
| | | database: 1 |
| | | host: 127.0.0.1 |
| | | port: 6379 |
| | | password: 123456 |
| | | kangaroohy: |
| | | milo: |
| | | enabled: true |
| | | primary: default |
| | | config: |
| | | default: |
| | | endpoint: opc.tcp://10.153.19.150:49320 |
| | | security-policy: basic256sha256 |
| | | username: admin |
| | | password: 1qaz2wsx3edc4rfv |
| | | cache: |
| | | type: redis # 明确指定缓存类型 |
| | | redis: |
| | | time-to-live: -1 # 缓存过期时间 |
| | | cache-null-values: true # 是否缓存空值 |
| | | use-key-prefix: true # 使用key前缀 |
| | | kangaroohy: |
| | | milo: |
| | | enabled: true |
| | | enabled: false |
| | | primary: default |
| | | config: |
| | | default: |
| | |
| | | </update> |
| | | |
| | | <select id="hollowIsAll" resultMap="baseMap"> |
| | | WITH sum_flow_layer_count AS ( SELECT flow_card_id, layer, min( films_id ) AS films_id, min(thickness) as |
| | | thickness,count(*) AS sum_count FROM hollow_glass_relation_info GROUP BY flow_card_id, layer ), |
| | | real_flow_layer_count AS ( SELECT flow_card_id, layer, count(*) AS real_count, count(distinct slot) as |
| | | slot_count FROM |
| | | hollow_big_storage_cage_details t WHERE state = 100 GROUP BY flow_card_id, layer ), |
| | | damage_flow_layer_count AS ( SELECT process_id AS flow_card_id, technology_number AS layer, count(*) as |
| | | damage_count FROM damage where type in(8,9) GROUP BY process_id, technology_number ), |
| | | lack_flow_layer_count AS ( |
| | | WITH flow_layer_stats AS ( |
| | | SELECT |
| | | t.flow_card_id, |
| | | t.layer, |
| | | ifnull((sum_count - real_count - ifnull(damage_count,0)),0) AS lack_count |
| | | FROM |
| | | sum_flow_layer_count t |
| | | left JOIN real_flow_layer_count t1 ON t.flow_card_id = t1.flow_card_id |
| | | AND t.layer = t1.layer |
| | | left JOIN damage_flow_layer_count t2 ON t1.flow_card_id = t2.flow_card_id |
| | | AND t1.layer = t2.layer |
| | | h.flow_card_id, |
| | | h.layer, |
| | | MIN(r.films_id) AS films_id, |
| | | MIN(r.thickness) AS thickness, |
| | | COUNT(*) AS sum_count, |
| | | COUNT(DISTINCT h.slot) AS slot_count, |
| | | SUM(CASE WHEN h.state = 100 THEN 1 ELSE 0 END) AS real_count |
| | | FROM hollow_glass_relation_info r |
| | | LEFT JOIN hollow_big_storage_cage_details h |
| | | ON r.flow_card_id = h.flow_card_id AND r.layer = h.layer |
| | | WHERE r.flow_card_id = #{flowCardId} |
| | | GROUP BY h.flow_card_id, h.layer |
| | | ), |
| | | layer_one AS ( SELECT * FROM hollow_big_storage_cage_details WHERE layer = 1 AND state = 100 ), |
| | | layer_two AS ( SELECT * FROM hollow_big_storage_cage_details WHERE layer = 2 AND state = 100), |
| | | layer_three AS ( SELECT * FROM hollow_big_storage_cage_details WHERE layer = 3 AND state = 100 ) |
| | | , |
| | | pair_flow_layer_count AS ( |
| | | damage_stats AS ( |
| | | SELECT |
| | | t.flow_card_id, |
| | | count(*) AS pair_count |
| | | FROM |
| | | layer_one t |
| | | INNER JOIN layer_two t1 ON t.flow_card_id = t1.flow_card_id |
| | | AND t.virtual_slot = t1.virtual_slot |
| | | AND t.sequence = t1.sequence |
| | | process_id AS flow_card_id, |
| | | technology_number AS layer, |
| | | COUNT(*) AS damage_count |
| | | FROM damage |
| | | WHERE type IN (8,9) AND process_id = #{flowCardId} |
| | | GROUP BY process_id, technology_number |
| | | ), |
| | | pair_stats AS ( |
| | | SELECT |
| | | t1.flow_card_id, |
| | | COUNT(*) AS pair_count |
| | | FROM hollow_big_storage_cage_details t1 |
| | | INNER JOIN hollow_big_storage_cage_details t2 |
| | | ON t1.flow_card_id = t2.flow_card_id |
| | | AND t1.virtual_slot = t2.virtual_slot |
| | | AND t1.sequence = t2.sequence |
| | | AND t1.layer = 1 AND t2.layer = 2 |
| | | AND t1.state = 100 AND t2.state = 100 |
| | | <if test="totalLayer == 3"> |
| | | inner join layer_three t2 |
| | | on t.flow_card_id = t2.flow_card_id and |
| | | t.virtual_slot = t2.virtual_slot and t.sequence = t2.sequence |
| | | INNER JOIN hollow_big_storage_cage_details t3 |
| | | ON t1.flow_card_id = t3.flow_card_id |
| | | AND t1.virtual_slot = t3.virtual_slot |
| | | AND t1.sequence = t3.sequence |
| | | AND t3.layer = 3 AND t3.state = 100 |
| | | </if> |
| | | GROUP BY |
| | | t.flow_card_id |
| | | ), |
| | | result_flow_layer_count AS ( |
| | | WHERE t1.flow_card_id = #{flowCardId} |
| | | GROUP BY t1.flow_card_id |
| | | ) |
| | | SELECT |
| | | t.flow_card_id, |
| | | t.layer, |
| | | t.films_id, |
| | | t.thickness, |
| | | sum_count, |
| | | IFNULL( t3.pair_count, 0 ) AS pair_count, |
| | | IFNULL( real_count, 0 ) AS real_count, |
| | | IFNULL( damage_count, 0 ) AS damage_count, |
| | | IFNULL( lack_count, 0 ) AS lack_count, |
| | | IFNULL(slot_count,0) AS slot_count |
| | | FROM |
| | | sum_flow_layer_count t |
| | | LEFT JOIN real_flow_layer_count t1 ON t.flow_card_id = t1.flow_card_id |
| | | AND t.layer = t1.layer |
| | | LEFT JOIN lack_flow_layer_count t2 ON t.flow_card_id = t2.flow_card_id |
| | | AND t.layer = t2.layer |
| | | LEFT JOIN pair_flow_layer_count t3 ON t.flow_card_id = t3.flow_card_id |
| | | LEFT JOIN damage_flow_layer_count t4 ON t.flow_card_id = t4.flow_card_id |
| | | AND t.layer = t4.layer |
| | | ) SELECT |
| | | * |
| | | FROM |
| | | result_flow_layer_count |
| | | WHERE |
| | | flow_card_id = #{flowCardId} |
| | | f.flow_card_id, |
| | | f.layer, |
| | | f.films_id, |
| | | f.thickness, |
| | | f.sum_count, |
| | | COALESCE(p.pair_count, 0) AS pair_count, |
| | | COALESCE(f.real_count, 0) AS real_count, |
| | | COALESCE(d.damage_count, 0) AS damage_count, |
| | | (f.sum_count - COALESCE(f.real_count, 0) - COALESCE(d.damage_count, 0)) AS lack_count, |
| | | f.slot_count |
| | | FROM flow_layer_stats f |
| | | LEFT JOIN damage_stats d |
| | | ON f.flow_card_id = d.flow_card_id AND f.layer = d.layer |
| | | LEFT JOIN pair_stats p |
| | | ON f.flow_card_id = p.flow_card_id |
| | | WHERE 1=1 |
| | | <if test="flag == true"> |
| | | and sum_count = pair_count |
| | | AND f.sum_count = COALESCE(p.pair_count, 0) |
| | | </if> |
| | | order by layer |
| | | ORDER BY f.layer; |
| | | </select> |
| | | |
| | | <select id="queryIsAllNeedDispatchVirtualSlot" resultMap="virtualSlotSequenceDTO"> |
| | |
| | | where state in (100, 102, 103, 104) |
| | | group by flow_card_id, layer |
| | | </select> |
| | | |
| | | <select id="queryHollowAllFlowCard" resultType="com.mes.hollow.entity.dto.FlowCardGlassInfoDTO"> |
| | | WITH hollow_flow_temp AS ( |
| | | SELECT DISTINCT flow_card_id |
| | | FROM hollow_big_storage_cage_details |
| | | WHERE state = 100 |
| | | <if test="flowCardId != null and flowCardId != ''"> |
| | | AND flow_card_id LIKE CONCAT('%', #{flowCardId}, '%') |
| | | </if> |
| | | <if test="filmsId != null and filmsId != ''"> |
| | | AND films_id LIKE CONCAT('%', #{filmsId}, '%') |
| | | </if> |
| | | <if test="thickness != 0"> |
| | | AND thickness = #{thickness} |
| | | </if> |
| | | ), |
| | | hollow_details_temp AS ( |
| | | SELECT |
| | | flow_card_id, |
| | | glass_id, |
| | | virtual_slot, |
| | | sequence, |
| | | layer, |
| | | total_layer, |
| | | hollow_sequence |
| | | FROM hollow_big_storage_cage_details |
| | | WHERE state = 100 |
| | | <if test="flowCardId != null and flowCardId != ''"> |
| | | AND flow_card_id LIKE CONCAT('%', #{flowCardId}, '%') |
| | | </if> |
| | | <if test="filmsId != null and filmsId != ''"> |
| | | AND films_id LIKE CONCAT('%', #{filmsId}, '%') |
| | | </if> |
| | | <if test="thickness != 0"> |
| | | AND thickness = #{thickness} |
| | | </if> |
| | | ), |
| | | hollow_through_temp AS ( |
| | | SELECT |
| | | flow_card_id, |
| | | MIN(hollow_sequence) as hollow_sequence, |
| | | MAX(total_layer) as total_layer |
| | | FROM hollow_details_temp |
| | | GROUP BY flow_card_id |
| | | ), |
| | | hollow_pair_temp AS ( |
| | | SELECT |
| | | t1.flow_card_id, |
| | | COUNT(*) AS pair_count |
| | | FROM hollow_details_temp t1 |
| | | INNER JOIN hollow_details_temp t2 |
| | | ON t1.flow_card_id = t2.flow_card_id |
| | | AND t1.virtual_slot = t2.virtual_slot |
| | | AND t1.sequence = t2.sequence |
| | | AND t1.layer = 1 AND t2.layer = 2 |
| | | WHERE NOT EXISTS ( |
| | | SELECT 1 |
| | | FROM hollow_through_temp ht |
| | | WHERE ht.flow_card_id = t1.flow_card_id |
| | | AND ht.total_layer = 3 |
| | | ) OR EXISTS ( |
| | | SELECT 1 |
| | | FROM hollow_details_temp t3 |
| | | WHERE t3.flow_card_id = t1.flow_card_id |
| | | AND t3.virtual_slot = t1.virtual_slot |
| | | AND t3.sequence = t1.sequence |
| | | AND t3.layer = 3 |
| | | ) |
| | | GROUP BY t1.flow_card_id |
| | | ), |
| | | glass_info_temp AS ( |
| | | SELECT |
| | | gi.id, |
| | | gi.glass_id, |
| | | gi.flow_card_id, |
| | | gi.layer, |
| | | gi.thickness, |
| | | gi.filmsId |
| | | FROM hollow_flow_temp hft |
| | | INNER JOIN glass_info gi ON hft.flow_card_id = gi.flow_card_id |
| | | ), |
| | | damage_ranked AS ( |
| | | SELECT |
| | | d.glass_id, |
| | | d.type, |
| | | d.status, |
| | | ROW_NUMBER() OVER(PARTITION BY d.glass_id ORDER BY d.id DESC) as rn |
| | | FROM hollow_flow_temp hft |
| | | INNER JOIN damage d ON hft.flow_card_id = d.process_id |
| | | ), |
| | | damage_latest AS ( |
| | | SELECT |
| | | glass_id, |
| | | type, |
| | | status |
| | | FROM damage_ranked |
| | | WHERE rn = 1 |
| | | ), |
| | | result_temp AS ( |
| | | SELECT |
| | | t.flow_card_id, |
| | | t.layer, |
| | | t.thickness, |
| | | t.filmsId, |
| | | COUNT(DISTINCT t.id) as sum_count, |
| | | COUNT(DISTINCT t1.glass_id) as real_count, |
| | | COUNT(DISTINCT t.id) - COUNT(DISTINCT t1.glass_id) as lack_count, |
| | | COUNT(DISTINCT CASE WHEN t2.type IN (7,8) AND t2.status = 1 THEN t.glass_id END) as damage_count |
| | | FROM glass_info_temp t |
| | | LEFT JOIN hollow_details_temp t1 ON t.glass_id = t1.glass_id |
| | | LEFT JOIN damage_latest t2 ON t.glass_id = t2.glass_id |
| | | GROUP BY t.flow_card_id, t.layer, t.thickness, t.filmsId |
| | | ) |
| | | SELECT |
| | | t.*, |
| | | COALESCE(t1.pair_count, 0) as pair_count, |
| | | t2.hollow_sequence, |
| | | t2.total_layer |
| | | FROM result_temp t |
| | | LEFT JOIN hollow_pair_temp t1 ON t.flow_card_id = t1.flow_card_id |
| | | LEFT JOIN hollow_through_temp t2 ON t.flow_card_id = t2.flow_card_id |
| | | ORDER BY t.flow_card_id |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | date( hgori.create_time ) = date( |
| | | now()) |
| | | </select> |
| | | <select id="queryProductNameByFlowCardId" resultType="com.mes.hollow.entity.dto.OrderDetailsDTO"> |
| | | select t.product_name, t1.customer_name |
| | | from sd.order_detail t |
| | | inner join sd.order t1 on t.order_id = t1.order_id |
| | | where (t.order_id, t.order_number) = ( |
| | | select min(order_id) as order_id, min(order_number) as order_number |
| | | from pp.flow_card |
| | | where process_id = #{flowCardId} |
| | | ) |
| | | limit 1 |
| | | </select> |
| | | </mapper> |
| | |
| | | <resultMap id="lackBaseMap" type="com.mes.hollow.entity.dto.LackDetailsDTO"> |
| | | <result column="flow_card_id" property="flowCardId"/> |
| | | <result column="layer" property="layer"/> |
| | | <result column="order_sort" property="glassType"/> |
| | | <result column="films_id" property="filmsId"/> |
| | | <result column="first_length" property="width"/> |
| | | <result column="second_Length" property="height"/> |
| | | <result column="glass_type" property="glassType"/> |
| | | <result column="filmsid" property="filmsId"/> |
| | | <result column="width" property="width"/> |
| | | <result column="height" property="height"/> |
| | | <result column="thickness" property="thickness"/> |
| | | <result column="lack_count" property="lackCount"/> |
| | | <result column="damage_count" property="damageCount"/> |
| | |
| | | select * |
| | | from result |
| | | </select> |
| | | <select id="queryLackByFlowCard" resultMap="lackBaseMap"> |
| | | with flow_card_id_info as ( |
| | | select distinct flow_card_id from hollow_big_storage_cage_details where state = 100 |
| | | <select id="queryAllLackByFlowCard" resultMap="lackBaseMap"> |
| | | WITH flow_card_id_info AS ( |
| | | SELECT DISTINCT flow_card_id |
| | | FROM hollow_big_storage_cage_details |
| | | WHERE state = 100 |
| | | ), |
| | | relation_length as ( |
| | | select flow_card_id, |
| | | layer, |
| | | order_sort, |
| | | tempering_layout_id, |
| | | tempering_feed_sequence, |
| | | GREATEST(width, height) as first_length, |
| | | LEAST(width, height) as second_Length, |
| | | width, |
| | | height, |
| | | thickness, |
| | | films_id |
| | | from hollow_glass_relation_info |
| | | where flow_card_id in (select flow_card_id from flow_card_id_info) |
| | | and tempering_layout_id is null |
| | | and tempering_feed_sequence is null |
| | | glass_temp AS ( |
| | | SELECT t.* |
| | | FROM glass_info t |
| | | INNER JOIN flow_card_id_info t1 ON t.flow_card_id = t1.flow_card_id |
| | | ), |
| | | lack_count_temp as ( |
| | | select flow_card_id, |
| | | layer, |
| | | order_sort, |
| | | first_length, |
| | | films_id, |
| | | second_Length, |
| | | thickness, |
| | | count(*) as lack_count |
| | | from relation_length |
| | | group by flow_card_id, layer, order_sort, films_id, first_length, second_Length, thickness |
| | | detail_temp AS ( |
| | | SELECT t.* |
| | | FROM glass_temp t |
| | | WHERE NOT EXISTS ( |
| | | SELECT 1 |
| | | FROM hollow_big_storage_cage_details t1 |
| | | WHERE t1.glass_id = t.glass_id |
| | | AND t1.state NOT IN (8,9) |
| | | ) |
| | | ), |
| | | damage_count_temp as ( |
| | | select process_id as flow_card_id, |
| | | technology_number as layer, |
| | | order_number as order_sort, |
| | | count(1) as damage_count |
| | | from damage |
| | | where process_id in (select flow_card_id from flow_card_id_info) |
| | | and type in (8, 9) |
| | | and status < 3 |
| | | group by process_id, technology_number, order_number |
| | | damage_latest AS ( |
| | | SELECT |
| | | dr.glass_id, |
| | | dr.type, |
| | | dr.status |
| | | FROM ( |
| | | SELECT |
| | | t1.glass_id, |
| | | t1.type, |
| | | t1.status, |
| | | ROW_NUMBER() OVER(PARTITION BY t1.glass_id ORDER BY t1.id DESC) as rn |
| | | FROM detail_temp t |
| | | INNER JOIN damage t1 ON t.flow_card_id = t1.process_id |
| | | ) dr |
| | | WHERE dr.rn = 1 |
| | | ), |
| | | result_count as ( |
| | | select t.*, IFNULL(t1.damage_count, 0) damage_count |
| | | from lack_count_temp t |
| | | left join damage_count_temp t1 on t.flow_card_id = t1.flow_card_id and t.layer = t1.layer and |
| | | t.order_sort = t1.order_sort |
| | | order by t.flow_card_id, t.layer |
| | | result_temp AS ( |
| | | SELECT |
| | | t.flow_card_id, |
| | | t.layer, |
| | | t.glass_type, |
| | | t.thickness, |
| | | t.filmsId, |
| | | t.width, |
| | | t.height, |
| | | COUNT(DISTINCT t.glass_id) as lack_count, |
| | | COUNT(DISTINCT CASE WHEN t1.type IN (7,8) AND t1.status = 1 THEN t.glass_id END) as damage_count |
| | | FROM detail_temp t |
| | | LEFT JOIN damage_latest t1 ON t.glass_id = t1.glass_id |
| | | GROUP BY |
| | | t.flow_card_id, |
| | | t.layer, |
| | | t.glass_type, |
| | | t.thickness, |
| | | t.filmsId, |
| | | t.width, |
| | | t.height |
| | | ) |
| | | select * |
| | | from result_count |
| | | SELECT * |
| | | FROM result_temp |
| | | ORDER BY flow_card_id, layer; |
| | | </select> |
| | | <select id="queryLayerByFlowCardId" resultType="java.lang.Integer"> |
| | | select count(distinct layer) |
| | |
| | | ) |
| | | limit 1 |
| | | </select> |
| | | <select id="queryLackGlassByFlowCard" resultType="com.mes.glassinfo.entity.GlassInfo"> |
| | | with glass_id_info as ( |
| | | select glass_id,order_sort from hollow_glass_relation_info where flow_card_id=#{flowCardId} and |
| | | order_sort=#{orderSort} and layer=#{layer} and glass_id is not null |
| | | ), |
| | | damage_glass_id as ( |
| | | select glass_id from damage where process_id=#{flowCardId} and order_number=#{orderSort} and |
| | | technology_number=#{layer} and type=8 and status < 3 and glass_id is not null |
| | | ) |
| | | select t.* from glass_info t left join glass_id_info t1 on t.glass_id=t1.glass_id |
| | | left join damage_glass_id t2 on t.glass_id=t2.glass_id |
| | | where t.flow_card_id=#{flowCardId} and t.glass_type=#{orderSort} and t.layer=#{layer} and t1.glass_id is null |
| | | and t2.glass_id is null |
| | | </select> |
| | | <select id="queryLackByFlowCard" resultType="com.mes.hollow.entity.dto.LackDetailsDTO"> |
| | | with hollow_flow_temp AS ( |
| | | SELECT DISTINCT flow_card_id |
| | | FROM hollow_big_storage_cage_details |
| | | WHERE state = 100 |
| | | <if test="flowCardId != null and flowCardId != ''"> |
| | | and flow_card_id = #{flowCardId} |
| | | </if> |
| | | ) |
| | | , glass_temp as ( |
| | | select t1.* |
| | | from hollow_flow_temp t |
| | | INNER JOIN glass_info t1 on t.flow_card_id = t1.flow_card_id |
| | | ) |
| | | , detail_temp as ( |
| | | select t.* |
| | | from glass_temp t |
| | | left join hollow_big_storage_cage_details t1 on t.glass_id = t1.glass_id and t1.state not in (8,9) |
| | | where t1.glass_id is null |
| | | ) |
| | | , damage_ranked AS ( |
| | | SELECT t.flow_card_id, |
| | | t.layer, |
| | | t.glass_id, |
| | | t.glass_type, |
| | | t.width, |
| | | t.height, |
| | | t.filmsId, |
| | | t.thickness, |
| | | case |
| | | when type in (7, 8) and status = 1 then '' |
| | | else t1.working_procedure end as working_procedure, |
| | | ROW_NUMBER() OVER (PARTITION BY t1.glass_id ORDER BY t1.id DESC) as rn |
| | | FROM detail_temp t |
| | | inner join damage t1 on t.glass_id = t1.glass_id |
| | | ) |
| | | , damage_latest AS ( |
| | | SELECT * |
| | | FROM damage_ranked |
| | | WHERE rn = 1 |
| | | ) |
| | | select * |
| | | from damage_latest |
| | | |
| | | </select> |
| | | |
| | | <update id="clearDirtyFlowCardData"> |
| | | update hollow_glass_relation_info |
| | | set glass_id = null, |
| | | tempering_layout_id = null, |
| | | tempering_feed_sequence = null, |
| | | engineer_id = null, |
| | | state = 0 |
| | | update tempering_glass_relation_info |
| | | set shelf_order = null |
| | | , state = 0 |
| | | where flow_card_id = #{flowCardId} |
| | | and layer = #{layer} |
| | | and glass_id not in ( |
| | | select glass_id |
| | | from hollow_big_storage_cage_details |
| | | and shelf_order not in ( |
| | | select shelf_order |
| | | from vertical_sheet_cage_details |
| | | where flow_card_id = #{flowCardId} |
| | | and layer = #{layer} |
| | | and state in (100, 102, 103, 104) |