| | |
| | | package com.example.springboot.service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | import com.example.springboot.common.Result; |
| | | import com.example.springboot.component.Plchome; |
| | | import com.example.springboot.component.S7control; |
| | | import com.example.springboot.entity.Flowcard; |
| | | import com.example.springboot.entity.GlassInfo; |
| | | import com.example.springboot.entity.Queue; |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.entity.StorageTask; |
| | |
| | | return Result.success(map); |
| | | } |
| | | |
| | | public List<StorageCage> SelectStorageCageInfo() { |
| | | return homeMapper.SelectStorageCageInfo(); |
| | | } |
| | | |
| | | // 增加/减少理片笼玻璃数 |
| | | public Result UpdateStroageCageByCell(Integer cell, Integer num) { |
| | | if (num == 0) { |
| | | homeMapper.DeleteStroageCageByCell(cell); |
| | | } else { |
| | | homeMapper.updateStroageCageByCell(cell, num); |
| | | homeMapper.UpdateStroageCageWidthByCell(cell); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | // 查询进/出片任务 |
| | | public List<StorageTask> SelectStorageTask(int task_type) { |
| | | List<StorageTask> storageTasks = new ArrayList<>(); |
| | | if (task_type == 0) { |
| | | storageTasks = homeMapper.SelectStorageTask(task_type); |
| | | } else { |
| | | storageTasks = homeMapper.SelectStorageTask(task_type); |
| | | } |
| | | for (StorageTask storageTask : storageTasks) { |
| | | storageTask.setstorageCage(homeMapper.SelectStorageByCell(storageTask.getLoadrack())); |
| | | } |
| | | return storageTasks; |
| | | } |
| | | |
| | | //手动完成任务 |
| | | public Result FinishTask(Integer tasktype, Integer id) { |
| | | StorageTask storageTask = homeMapper.SelectStorageTaskById(id);//获取任务信息 |
| | | homeMapper.FinishTask(storageTask.getId());//完成任务 |
| | | if(storageTask.getTaskType().equals("0")){ |
| | | UpdateStroageCageByCell(Integer.parseInt(storageTask.getLoadrack()),1);//玻璃数量+1 |
| | | }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);//清除格内信息 |
| | | } |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | |
| | | //查询玻璃信息 |
| | | public Result SelectGlassInfo(String width,String height,String thickness,String films) { |
| | | List<GlassInfo> glassInfoList = homeMapper.SelectGlassInfo(width,height,thickness,films); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("StorageCageAddInfo", glassInfoList); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | //添加玻璃到格子内 |
| | | public Result StorageCageAddGlass(String cell,GlassInfo glassInfo) { |
| | | homeMapper.StorageCageAddGlass(cell,glassInfo); |
| | | UpdateStroageCageByCell(Integer.parseInt(cell),1); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | public List<Flowcard> SelectOrderTask() { |
| | | List<Flowcard> OrderTask=homeMapper.SelectOrderTask(); |
| | | for (Flowcard flowcard : OrderTask) { |
| | | flowcard.setglassinfo(homeMapper.SelectOrderView(flowcard.getFlowcard())); |
| | | } |
| | | return OrderTask; |
| | | } |
| | | |
| | | public Result ClaimTasks(String flowcard, Integer state) { |
| | | if(state==1){ |
| | | homeMapper.ClaimTasks(flowcard,0); |
| | | }else{ |
| | | homeMapper.ClaimTasks(flowcard,1); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | public Result ModeChange(String flowcard, Integer method) { |
| | | if(method==1){ |
| | | homeMapper.ModeChange(flowcard,0); |
| | | }else{ |
| | | homeMapper.ModeChange(flowcard,1); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | public Result UpdateQueue(GlassInfo glassInfo) { |
| | | homeMapper.UpdateQueue(glassInfo.getFlowcard(),glassInfo.getWidth(),glassInfo.getHeight(),glassInfo.getGlasstype()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | } |