| | |
| | | import com.example.springboot.component.S7control; |
| | | import com.example.springboot.entity.Flowcard; |
| | | import com.example.springboot.entity.GlassInfo; |
| | | import com.example.springboot.entity.MeasureSetting; |
| | | 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.AlbaniaMapper; |
| | | import com.example.springboot.mapper.HomeMapper; |
| | | import com.example.springboot.mapper.QueueMapper; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | |
| | | |
| | | @Autowired |
| | | private SpianService spianService; |
| | | @Autowired |
| | | private AlbaniaMapper albaniaMapper; |
| | | |
| | | public void EndTask(int types) { |
| | | String A01glassid1 = spianService.queGlassid("DB103.128", 14).toString(); |
| | |
| | | } else { |
| | | if (id == 1) { |
| | | // 调用伍存储过程 |
| | | System.out.println("调用上片函数"); |
| | | zhi = spianService.selectAll(queue.getglassId()); |
| | | if (zhi == 200) { |
| | | homeMapper.InsertQueueGlassId(queue, id); |
| | |
| | | // 查询进/出片任务 |
| | | public List<StorageTask> SelectStorageTask(int task_type) { |
| | | List<StorageTask> storageTasks = new ArrayList<>(); |
| | | String loadrack="0"; |
| | | String loadrack = "0"; |
| | | if (task_type == 0) { |
| | | storageTasks = homeMapper.SelectStorageTask(task_type); |
| | | } else { |
| | |
| | | } |
| | | for (StorageTask storageTask : storageTasks) { |
| | | if (task_type == 0) { |
| | | loadrack=storageTask.getLoadrack(); |
| | | }else{ |
| | | loadrack=storageTask.getShelfRack(); |
| | | loadrack = storageTask.getLoadrack(); |
| | | } else { |
| | | loadrack = storageTask.getShelfRack(); |
| | | } |
| | | storageTask.setstorageCage(homeMapper.SelectStorageByCell(loadrack)); |
| | | } |
| | | return storageTasks; |
| | | } |
| | | |
| | | // 查询进/出片任务 |
| | | public List<GlassInfo> SelectMeasure() { |
| | | return homeMapper.SelectMeasure(); |
| | | } |
| | | // 查询当前膜系厚度 |
| | | public MeasureSetting SelectSetting() { |
| | | return homeMapper.SelectMeasureSetting(); |
| | | } |
| | | // 查询测量宽高厚膜系 |
| | | public Map StorageCageForm() { |
| | | return homeMapper.SelectMeasureWidthHeight(); |
| | | } |
| | | |
| | | |
| | | // 手动完成任务 |
| | | public Result FinishTask(Integer id) { |
| | | StorageTask storageTask = homeMapper.SelectStorageTaskById(id);// 获取任务信息 |
| | | homeMapper.FinishTask(storageTask.getId());// 完成任务 |
| | | if (storageTask.getTaskType().equals("0")) { |
| | | UpdateStroageCageByCell(Integer.parseInt(storageTask.getLoadrack()), 1);// 玻璃数量+1 |
| | | homeMapper.DeletequeueByGlassid(storageTask.getGlassId()); |
| | | } else { |
| | | StorageCage storageCage = homeMapper.SelectStorageByCell(storageTask.getShelfRack()); |
| | | if (storageCage.getNumber() > 1) { |
| | | UpdateStroageCageByCell(Integer.parseInt(storageTask.getShelfRack()), -1);// 玻璃数量-1 |
| | | } else { |
| | | UpdateStroageCageByCell(Integer.parseInt(storageTask.getShelfRack()), 0);// 清除格内信息 |
| | | public Result FinishTask() { |
| | | for (int i = 1; i < 7; i++) { |
| | | int taskcont = albaniaMapper.SelectTaskcount(); // 正在进行的任务数量 |
| | | System.out.println("任务数量:"+taskcont); |
| | | if (taskcont == 0) { |
| | | break; |
| | | } |
| | | homeMapper.AddGlassNo(storageTask.getFlowcard(), storageTask.getMateid(), storageTask.geTier());// 添加出片完成数量 |
| | | StorageTask storageTask = homeMapper.SelectStorageTaskById();// 获取任务信息 |
| | | if (storageTask.getTaskType().equals("0")) { |
| | | System.out.println("完成进片任务:"+storageTask.getId()); |
| | | homeMapper.FinishTask(storageTask.getId(), 1);// 完成任务 |
| | | UpdateStroageCageByCell(Integer.parseInt(storageTask.getLoadrack()), 1);// 玻璃数量+1 |
| | | homeMapper.DeletequeueByGlassid(storageTask.getGlassId()); |
| | | } else { |
| | | System.out.println("完成出片任务:"+storageTask.getId()); |
| | | homeMapper.FinishTask(storageTask.getId(), 1);// 完成任务 |
| | | StorageCage storageCage = homeMapper.SelectStorageByCell(storageTask.getShelfRack()); |
| | | if (storageCage.getNumber()==null||storageCage.getNumber() ==0) { |
| | | UpdateStroageCageByCell(Integer.parseInt(storageTask.getShelfRack()), 0);// 清除格内信息 |
| | | } |
| | | // homeMapper.AddGlassNo(storageTask.getFlowcard(), storageTask.getMateid(), storageTask.geTier());// 添加出片完成数量 |
| | | |
| | | } |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | // 自动完成任务 |
| | | public Result LoseTask() { |
| | | for (int i = 1; i < 7; i++) { |
| | | int taskcont = albaniaMapper.SelectTaskcount(); // 正在进行的任务数量 |
| | | System.out.println("任务数量:"+taskcont); |
| | | if (taskcont == 0) { |
| | | break; |
| | | } |
| | | StorageTask storageTask = homeMapper.SelectStorageTaskById();// 获取任务信息 |
| | | if (storageTask.getTaskType().equals("0")) { |
| | | System.out.println("完成进片任务:"+storageTask.getId()); |
| | | homeMapper.FinishTask(storageTask.getId(), 1);// 完成任务 |
| | | UpdateStroageCageByCell(Integer.parseInt(storageTask.getLoadrack()), 1);// 玻璃数量+1 |
| | | homeMapper.DeletequeueByGlassid(storageTask.getGlassId()); |
| | | } else { |
| | | System.out.println("完成出片任务:"+storageTask.getId()); |
| | | homeMapper.FinishTask(storageTask.getId(), 1);// 完成任务 |
| | | StorageCage storageCage = homeMapper.SelectStorageByCell(storageTask.getShelfRack()); |
| | | if (storageCage.getNumber() > 1) { |
| | | UpdateStroageCageByCell(Integer.parseInt(storageTask.getShelfRack()), -1);// 玻璃数量-1 |
| | | } else { |
| | | UpdateStroageCageByCell(Integer.parseInt(storageTask.getShelfRack()), 0);// 清除格内信息 |
| | | } |
| | | homeMapper.AddGlassNo(storageTask.getFlowcard(), storageTask.getMateid(), storageTask.geTier());// 添加出片完成数量 |
| | | |
| | | } |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | |
| | | return OrderTask; |
| | | } |
| | | |
| | | // 开始任务 |
| | | // 开始出片 |
| | | public Result ClaimTasks(String flowcard, Integer state, Integer line) { |
| | | int count=homeMapper.SelectTaskCount(flowcard,line); |
| | | int count = homeMapper.SelectTaskCount(flowcard, line); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | if(count==0){ |
| | | if (count == 0) { |
| | | if (state == 1) { |
| | | homeMapper.ClaimTasks(flowcard, 0, line); |
| | | } else { |
| | | homeMapper.ClaimTasks(flowcard, 1, line); |
| | | } |
| | | map.put("message", "200"); |
| | | }else{ |
| | | } else { |
| | | map.put("message", "300"); |
| | | } |
| | | |
| | | |
| | | return Result.success(map); |
| | | } |
| | | |
| | |
| | | |
| | | // 修改测量信息 |
| | | public Result UpdateQueue(GlassInfo glassInfo) { |
| | | homeMapper.UpdateQueue(glassInfo.getFlowcard(), glassInfo.getWidth(), glassInfo.getHeight(), |
| | | glassInfo.getGlasstype(), glassInfo.getThickness(), glassInfo.getTier()); |
| | | // 删除数据 |
| | | QueueMapper.DeleteQueue(); |
| | | homeMapper.AddQueue(glassInfo.getFlowcard(), glassInfo.getWidth(), glassInfo.getHeight(), |
| | | glassInfo.getGlasstype(), glassInfo.getThickness(), glassInfo.getTier(),glassInfo.getMateid()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1); |
| | |
| | | return Result.success(map); |
| | | } |
| | | |
| | | // 开始工程 |
| | | public Result StartChange(String flowcard) { |
| | | homeMapper.StartChange(flowcard, 1); |
| | | // 开始上片 |
| | | public Result StartChange(String flowcard,int orderstate) { |
| | | homeMapper.StartChange(flowcard, orderstate); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | int state=homeMapper.selectStartChange(flowcard); |
| | | int state = homeMapper.selectStartChange(flowcard); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | | } |
| | | // 删除工程 |
| | | public Result deleteTasks(String flowcard) { |
| | | int aa=homeMapper.deleteFlowcard(flowcard.trim()); |
| | | |
| | | // 删除工程 |
| | | public Result deleteTasks(Map num) { |
| | | String flowcard = (String) num.get("num"); |
| | | int aa = homeMapper.deleteFlowcard(flowcard.trim()); |
| | | homeMapper.deleteGlassinfo(flowcard.trim()); |
| | | System.out.println(flowcard); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", aa); |
| | | map.put("message", flowcard.trim()); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | // 保存测量设置 |
| | | public Result SaveMeasure(String films, Integer thickness) { |
| | | int Measure = homeMapper.SaveMeasure(films, thickness); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", Measure); |
| | | return Result.success(map); |
| | | } |
| | | |
| | |
| | | Map<String, Integer> OrderFinishedProduct = new HashMap<String, Integer>(); // 得到处理完后订单成品总数量; |
| | | // "order zong 0 1 10 2 10" |
| | | List<Map> RemoveErrorData = IportDataStr.stream() |
| | | .filter(item -> (item.get("order") != null && item.get("glasstype") != null && item.get("tier") != null |
| | | .filter(item -> (item.get("order") != 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 |
| | |
| | | int count = 1; |
| | | for (Map map : RemoveErrorData) { |
| | | String key = map.get("base").toString() + "_" + map.get("height").toString() + "_" |
| | | + map.get("thickness").toString() + "_" + map.get("films").toString(); |
| | | |
| | | + map.get("thickness").toString() + "_" + map.get("films").toString()+ "_" + map.get("order").toString(); |
| | | |
| | | String tierkey = map.get("order").toString() + "_" + map.get("matching").toString(); |
| | | |
| | | String value = TypeData.get(key); |
| | | Integer glasstype; |
| | | System.out.println(key+":"+TypeData.get(key)); |
| | | System.out.println(key + ":" + TypeData.get(key)); |
| | | if (TypeData.get(key) == null) { |
| | | |
| | | glasstype = homeMapper.SelectMaxTypes(key); |
| | | if(glasstype==null){ |
| | | glasstype = homeMapper.SelectMaxType(); |
| | | } |
| | | if (glasstype == null) { |
| | | glasstype = homeMapper.SelectMaxType(); |
| | | } |
| | | if (glasstype == null) { |
| | | glasstype = 1; |
| | | } |
| | | } |
| | | } else { |
| | | glasstype = Integer.valueOf(value); |
| | | } |