表格导入(数据处理,页面调整);测量页面功能实现;
| | |
| | | data |
| | | }) |
| | | } |
| | | //人工拿走AnewMeasure |
| | | export function ManualTake(data) { |
| | | return request({ |
| | | url: '/home/ManualTake', |
| | | method: 'post', |
| | | data |
| | | |
| | | }) |
| | | } |
| | | //重新测量 |
| | | export function AnewMeasure(data) { |
| | | return request({ |
| | | url: '/home/AnewMeasure', |
| | | method: 'post', |
| | | data |
| | | |
| | | }) |
| | | } |
| | | |
| | | export function importData(data) { |
| | | return request({ |
| | | url: '/home/importData', |
| | | method: 'post', |
| | | data |
| | | |
| | | }) |
| | | } |
| | |
| | | <div id="fileinput" class="container"> |
| | | <div class="header"> |
| | | <div class="btn"> |
| | | <button @click="AllAdd">保存</button> |
| | | <el-button type="primary" @click="importData()">保存</el-button> |
| | | </div> |
| | | <div class="inp"> |
| | | <input type="file" id="uploadExcel" multiple @change="Change" /> |
| | |
| | | <el-button type="primary" @click="ManualMatching()" :disabled="SoftEmergencyStopState" |
| | | style="z-index: 999;">人工匹配</el-button> |
| | | <el-button type="primary" @click="ManualTake()" :disabled="SoftEmergencyStopState" |
| | | style="z-index: 999;">人工匹配</el-button> |
| | | style="z-index: 999;">人工拿走</el-button> |
| | | <el-button type="primary" @click="AnewMeasure()" :disabled="SoftEmergencyStopState" |
| | | style="z-index: 999;">重新测量</el-button> |
| | | </div> |
| | | <!--显示--> |
| | | <div style="width:1000px;height: 720px;border: 2px solid #d1d1d1;margin: auto auto;"> |
| | |
| | | Disabled, SelectPermissionByUserName, currentUsername, CompleteQueue, |
| | | isAllowReorderings, |
| | | |
| | | UpdateStroageCageByCell, FinishTask, SelectGlassInfo, StorageCageAddGlass, ClaimTasks, ModeChange, UpdateQueue |
| | | UpdateStroageCageByCell, FinishTask, SelectGlassInfo, StorageCageAddGlass, ClaimTasks, ModeChange, UpdateQueue,importData,ManualTake,AnewMeasure |
| | | } from "../../api/home"; |
| | | |
| | | |
| | |
| | | }, |
| | | //人工拿走 |
| | | ManualTake() { |
| | | |
| | | let s="123"; |
| | | ManualTake(s).then(res => { |
| | | if (res.data.message == 200) { |
| | | console.log(res.data.message); |
| | | } |
| | | }) |
| | | }, |
| | | //重新测量 |
| | | AnewMeasure() { |
| | | let s="123"; |
| | | AnewMeasure(s).then(res => { |
| | | if (res.data.message == 200) { |
| | | console.log(res.data.message); |
| | | } |
| | | }) |
| | | }, |
| | | Change(event) { |
| | | // 获取到文件夹 |
| | |
| | | Add() { |
| | | |
| | | }, |
| | | Hide() { |
| | | importData() { |
| | | |
| | | }, |
| | | AllAdd() { |
| | | //添加数据进后台 |
| | | console.log(this.dataList); |
| | | //let tbdata=JSON.stringify(this.dataList); |
| | | let tbdata=this.dataList; |
| | | console.log(tbdata); |
| | | importData(tbdata).then(res => { |
| | | if (res.data.message == 200) { |
| | | //this.$message.success(this.$t('Operation successful')); |
| | | } |
| | | }); |
| | | }, |
| | | del() { |
| | | |
| | |
| | | PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | |
| | | //String PlcRequest=plcmes.getPlcParameter("GaToMES").getValue();//请求 |
| | | //String MesSend=plcmes.getPlcParameter("MESToGaStatus").getValue();//发送 |
| | | //double width=plcmes.getPlcParameter("Height").getValue();//宽 |
| | | //double height=plcmes.getPlcParameter("width").getValue();//高 |
| | | //获取测量的长,宽 |
| | |
| | | |
| | | |
| | | String PlcRequest = "1"; |
| | | String MesSend = "0"; |
| | | double width = 402; |
| | | double height = 402; |
| | | |
| | | //匹配 |
| | | if ("1".equals(PlcRequest)) { |
| | | if ("1".equals(PlcRequest)&&"0".equals(PlcRequest)) { |
| | | GlassInfo MesureGlassinfo=HomeService.Normal(width, height, "1"); |
| | | |
| | | |
| | | } |
| | | Queue LastQueue= QueueMapper.selectLastQueue(); |
| | | // String E01id = new String( S7controlLK.getinstance().ReadByte("DB17.0",16)); |
| | |
| | | package com.example.springboot.controller; |
| | | |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | import com.example.springboot.service.OutSliceServive; |
| | | import com.example.springboot.service.SpianService; |
| | | import com.example.springboot.service.StorageCageService; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.google.gson.JsonArray; |
| | | import com.google.gson.JsonObject; |
| | | |
| | | import cn.hutool.core.lang.Console; |
| | | |
| | | import com.example.springboot.common.Result; |
| | | import com.example.springboot.component.Plchome; |
| | |
| | | public Result UpdateQueue(@RequestBody GlassInfo glassInfo) { |
| | | return storageCageService.UpdateQueue(glassInfo); |
| | | } |
| | | //人工拿走 |
| | | @PostMapping("/ManualTake") |
| | | public Result ManualTake(@RequestBody String glassInfo) { |
| | | return storageCageService.ManualTake(glassInfo); |
| | | } |
| | | //重新测量 |
| | | @PostMapping("/AnewMeasure") |
| | | public Result AnewMeasure(@RequestBody String glassInfo) { |
| | | return storageCageService.AnewMeasure(glassInfo); |
| | | } |
| | | //导入数据 :添加玻璃信息 |
| | | @PostMapping("/importData") |
| | | public Result importData(@RequestBody List<Map> IportDataStr) { |
| | | return storageCageService.AddGlassinfo(IportDataStr); |
| | | } |
| | | } |
| | |
| | | private Double thickness;// 厚 |
| | | private Integer number;// 数量 |
| | | private Integer finishnumber;// 完成数量 |
| | | private Integer sumtier;// 完成数量 |
| | | private Integer measurenumber;// 测量完成数量 |
| | | private Integer cageno;//笼内数量 |
| | | } |
| | |
| | | private Double thickness;// 厚 |
| | | private Integer number;// 数量 |
| | | private Integer finishnumber;// 完成数量 |
| | | private Integer sumtier;// 完成数量 |
| | | private Integer measurenumber;// 测量完成数量 |
| | | private Integer cageno;//笼内数量 |
| | | } |
| | |
| | | import com.example.springboot.entity.RolePermission; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Mapper |
| | | public interface HomeMapper { |
| | |
| | | @Update("update glassinfo set finishnumber=finishnumber+1 where flowcard=#{flowcard} and mateid=#{mateid} and tier=#{geTier}") |
| | | void AddGlassNo(String flowcard, Integer mateid, Integer geTier); |
| | | |
| | | |
| | | //添加出片队列 |
| | | @Insert("INSERT INTO glassinfo (`flowcard`, `glasstype`, `mateid`, `glassid`, `tier`, `films`, `width`, `height`, `thickness`, `number`, `finishnumber`, `sumtier`, `measurenumber`)"+ |
| | | " VALUES (#{flowcard}, #{glasstype}, #{mateid}, #{glassid}, #{tier}, #{films}, #{width}, #{height}, #{thickness}, #{number}, 0, #{sumtier}, 0)") |
| | | void AddGlassinfo(String flowcard, Integer glasstype, Integer mateid, String glassid, Integer tier, String films, Double width, Double height,Double thickness, Integer number, Integer sumtier); |
| | | //最大玻璃类型 |
| | | @Select("select max(glasstype)+1 from glassinfo") |
| | | Integer SelectMaxType(); |
| | | //查询全部玻璃类型 |
| | | @Select("select CONCAT(IFNULL(width,''),'_',IFNULL(height,''),'_',IFNULL(thickness,''),'_',IFNULL(films,'')) as type,glasstype from glassinfo GROUP BY width,height,thickness,films") |
| | | List<Map> SelectType(); |
| | | } |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.example.springboot.common.Result; |
| | | import com.example.springboot.component.PLCAutoMes; |
| | | import com.example.springboot.component.Plchome; |
| | | import com.example.springboot.component.S7control; |
| | | import com.example.springboot.entity.FlowCard; |
| | |
| | | import com.example.springboot.entity.Queue; |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.entity.StorageTask; |
| | | import com.example.springboot.entity.device.PlcParameterObject; |
| | | import com.example.springboot.mapper.HomeMapper; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | |
| | | @Service |
| | | public class StorageCageService { |
| | |
| | | return Result.success(map); |
| | | } |
| | | |
| | | |
| | | //查询玻璃信息 |
| | | public Result SelectGlassInfo(String width,String height,String thickness,String films) { |
| | | List<GlassInfo> glassInfoList = homeMapper.SelectGlassInfo(width,height,thickness,films); |
| | |
| | | |
| | | //修改测量信息 |
| | | public Result UpdateQueue(GlassInfo glassInfo) { |
| | | homeMapper.UpdateQueue(glassInfo.getFlowcard(),glassInfo.getWidth(),glassInfo.getHeight(),glassInfo.getGlasstype()); |
| | | homeMapper.UpdateQueue(glassInfo.getFlowcard(), glassInfo.getWidth(), glassInfo.getHeight(), |
| | | glassInfo.getGlasstype()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | // 人工拿走 |
| | | public Result ManualTake(String glassInfo) { |
| | | // 读取DB105区文件 |
| | | PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; |
| | | // 移除 |
| | | // S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), |
| | | // (short) 3); |
| | | // plcmes.getPlcParameter("GaToMES").setValue("3"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | // 重新测量 |
| | | public Result AnewMeasure(String glassInfo) { |
| | | // 读取DB105区文件 |
| | | PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; |
| | | // 重新测量 |
| | | // S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), |
| | | // (short) 2); |
| | | // plcmes.getPlcParameter("GaToMES").setValue("2"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | // 添加小片信息 |
| | | public Result AddGlassinfo(List<Map> IportDataStr) { |
| | | |
| | | // 筛选处理数据 1.去除无用数据 2.计算配片ID 3.计算ID 4. 计算总层数 |
| | | List<Map> TypeDatas = homeMapper.SelectType(); |
| | | Map<String, String> TypeData = new HashMap<String, String>();// 得到处理完后所有的类型 |
| | | |
| | | List<Map> RemoveErrorData = IportDataStr.stream() |
| | | .filter(item -> (item.get("order") != null && item.get("glasstype") != null && item.get("tier") != null |
| | | && |
| | | item.get("films") != null && item.get("base") != null && item.get("height") != null |
| | | && item.get("thickness") != null && item.get("quantity") != null)) |
| | | .collect(Collectors.toList()); |
| | | // 取出RemoveErrorData 里面的列当作TypeData的key |
| | | |
| | | TypeDatas.forEach(item -> { |
| | | TypeData.put(item.get("type").toString(), item.get("glasstype").toString()); |
| | | }); |
| | | |
| | | System.out.println(RemoveErrorData.size()); |
| | | // 处理完成 添加数据库 |
| | | for (Map map : RemoveErrorData) { |
| | | // GlassInfo glassInfo = mapper.convertValue(map, GlassInfo.class); |
| | | |
| | | String key=map.get("base").toString()+"_"+map.get("height").toString()+"_"+map.get("thickness").toString()+"_"+map.get("films").toString(); |
| | | String value=TypeData.get(key); |
| | | Integer glasstype; |
| | | if (TypeData.get(key)==null) { |
| | | glasstype=homeMapper.SelectMaxType(); |
| | | }else{ |
| | | glasstype=Integer.valueOf(value); |
| | | } |
| | | homeMapper.AddGlassinfo(map.get("order").toString(), glasstype, |
| | | Integer.parseInt(map.get("glasstype").toString()) // 需要计算 配片ID |
| | | , map.get("glasstype").toString() // 需要计算 玻璃ID |
| | | , Integer.parseInt(map.get("tier").toString()), map.get("films").toString(), |
| | | Double.parseDouble(map.get("base").toString()), Double.parseDouble(map.get("height").toString()), |
| | | Double.parseDouble(map.get("thickness").toString()), |
| | | Integer.parseInt(map.get("quantity").toString()), 1);// 需要计算总层数 |
| | | } |
| | | Map<String, Object> ResultCode = new HashMap<>(); |
| | | ResultCode.put("message", "200"); |
| | | return Result.success(ResultCode); |
| | | } |
| | | |
| | | } |