系统主界面添加点击理片笼显示玻璃信息,进行玻璃,出片操作
| | |
| | | data :""
|
| | | })
|
| | | }
|
| | |
|
| | | export function SelectCageInfo(cage) {
|
| | | return request({
|
| | | url: '/home/SelectCageInfo?cage='+cage,
|
| | | method: 'get',
|
| | | data :""
|
| | | })
|
| | | }
|
| | |
|
| | | export function DeleteByGlassID(glassid) {
|
| | | return request({
|
| | | url: '/home/DeleteByGlassID?glassid='+glassid,
|
| | | method: 'get',
|
| | | data :""
|
| | | })
|
| | | }
|
| | |
|
| | | export function OutByGlassID(glassid) {
|
| | | return request({
|
| | | url: '/home/OutByGlassID?glassid='+glassid,
|
| | | method: 'get',
|
| | | data :""
|
| | | })
|
| | | }
|
| | |
| | | </label>
|
| | | </div>
|
| | | </div>
|
| | |
|
| | | <div style="display:flex;justify-content: space-around;width: 95%;margin: 0 auto;">
|
| | | <el-input style="width:15%;" placeholder="Enter the glass lD" v-model="glassid"></el-input>
|
| | | <el-button type="primary" @click="showform()">Manually feed the glass</el-button>
|
| | |
| | | <el-footer>
|
| | | <div class="blocks" style="position: relative;">
|
| | | <div style="display:flex;position: absolute;float:left;z-index: 999;top:112px;left:328px;">
|
| | | <div :class="getStatusClass(item.state)" v-for="item in cagelist1" :key="item['date']"></div>
|
| | | <div :class="getStatusClass(item.state)" v-for="item in cagelist1" :key="item['date']"
|
| | | @click="showcageinfo(item['cage'])"></div>
|
| | | </div>
|
| | | <div style="display:flex;position: absolute;float:left;z-index: 999;top:112px;left:885px;">
|
| | | <div :class="getStatusClass(item.state)" v-for="item in cagelist2" :key="item['date']"></div>
|
| | | <div :class="getStatusClass(item.state)" v-for="item in cagelist2" :key="item['date']"
|
| | | @click="showcageinfo(item['cage'])"></div>
|
| | | </div>
|
| | | <div style="display:flex;position: absolute;float:left;z-index: 999;top:154px;left:328px;">
|
| | | <div :class="getStatusClass(item.state)" v-for="item in cagelist3" :key="item['date']"></div>
|
| | | <div :class="getStatusClass(item.state)" v-for="item in cagelist3" :key="item['date']"
|
| | | @click="showcageinfo(item['cage'])"></div>
|
| | | </div>
|
| | | <div style="display:flex;position: absolute;float:left;z-index: 999;top:154px;left:885px;">
|
| | | <div :class="getStatusClass(item.state)" v-for="item in cagelist4" :key="item['date']"></div>
|
| | | <div :class="getStatusClass(item.state)" v-for="item in cagelist4" :key="item['date']"
|
| | | @click="showcageinfo(item['cage'])"></div>
|
| | | </div>
|
| | | <div class="blocks-img" :style="{ left: car1 + 'px', top: '16px' }">
|
| | |
|
| | | </div>
|
| | | <div class="blocks-img" :style="{ left: car2 + 'px', top: '194px' }">
|
| | |
|
| | | </div>
|
| | | <div class="blocks-img" :style="{ left: car1 + 'px', top: '16px' }"></div>
|
| | | <div class="blocks-img" :style="{ left: car2 + 'px', top: '194px' }"></div>
|
| | | </div>
|
| | | </el-footer>
|
| | | <el-dialog :visible.sync="dialogFormVisible" title="Please confirm the information">
|
| | |
| | | <el-table-column prop="endTime" label="endTime"></el-table-column>
|
| | | </el-table>
|
| | | </el-dialog>
|
| | | <el-dialog :visible.sync="dialogFormVisible3" title="Ordering Information">
|
| | | <el-table :data="this.cageinfo" border style="width: 100%;height: 700px;overflow: auto;">
|
| | | <el-table-column :width="150" prop="cage" label="the grille number"></el-table-column>
|
| | | <el-table-column prop="cell" label="cell"></el-table-column>
|
| | | <el-table-column prop="tier" label="tier"></el-table-column>
|
| | | <el-table-column prop="glassId" label="glassid"></el-table-column>
|
| | | <el-table-column :width="130" prop="orderId" label="order number"></el-table-column>
|
| | | <el-table-column :width="150" prop="lengthWidth" label="length and width"></el-table-column>
|
| | | <el-table-column prop="coating" label="coating"></el-table-column>
|
| | | <el-table-column :width="150" label="operate">
|
| | | <template slot-scope='scope'>
|
| | | <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
|
| | | @click="deleteglass(scope.row.glassId, scope.row.state)">delete</el-button>
|
| | | <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
|
| | | @click="outglass(scope.row.glassId,scope.row.state)">out</el-button>
|
| | | </template>
|
| | | </el-table-column>
|
| | | </el-table>
|
| | | </el-dialog>
|
| | | </el-container>
|
| | | </template>
|
| | | |
| | | <script>
|
| | |
|
| | | import { home, home2, loadtask, InsertOrder, Addglassid, UpdateTask, SelectAlarmmgInfo } from "../../api/home";
|
| | | import { home, home2, loadtask, InsertOrder, Addglassid, UpdateTask, SelectAlarmmgInfo, SelectCageInfo, DeleteByGlassID, OutByGlassID } from "../../api/home";
|
| | |
|
| | |
|
| | | import LanguageMixin from '../../lang/LanguageMixin'
|
| | | let socket;
|
| | |
| | | dialogFormVisible: false,
|
| | | dialogFormVisible1: false,
|
| | | dialogFormVisible2: false,
|
| | | dialogFormVisible3: false,
|
| | | form: {
|
| | | orderno: "NG2210210",
|
| | | length: 800,
|
| | |
| | | car1: 150,
|
| | | car2: 242,
|
| | | incell: "",
|
| | | outcell: ""
|
| | | outcell: "",
|
| | | cageinfo: [],
|
| | | cage: 0
|
| | | };
|
| | | },
|
| | | created() {
|
| | |
| | |
|
| | | //console.log("收到数据====" + msg.data);
|
| | | let obj = JSON.parse(msg.data);
|
| | |
|
| | | if (obj.params != null) {
|
| | | this.car1 = 150 + 24.6 * obj.params[0][0];
|
| | | this.car2 = 242 + 24.6 * obj.params[0][1];
|
| | | }
|
| | |
|
| | | this.tableData = obj.tableData[0];
|
| | | this.cagelist1 = obj.cagelist1[0];
|
| | | this.cagelist2 = obj.cagelist2[0];
|
| | |
| | | this.outcell = this.tasklist2[0]['cell'];
|
| | | }
|
| | | this.alarm = obj.alarmmg[0];
|
| | | // for (let a = 0; a <= this.record.params.length - 1; a++) {
|
| | | // // this.record.xyData[a] = [this.record.canshu[a], this.record.params[0][a]];
|
| | | // // this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
|
| | |
|
| | | // // this.record.xyData[a].value = this.record.params[0][a];
|
| | | // this.car1=this.record.params[0][a];
|
| | | // console.log(this.record.params[0][a]);
|
| | | SelectCageInfo(this.cage).then(res => {
|
| | | this.cageinfo = res.data.cageinfo;
|
| | | });
|
| | |
|
| | |
|
| | | // }
|
| | | this.$forceUpdate();
|
| | |
|
| | | }.bind(this);
|
| | |
| | | });
|
| | | }
|
| | |
|
| | |
|
| | | },
|
| | | formatDate(timestamp) {
|
| | | const date = new Date(timestamp);
|
| | | const year = date.getFullYear();
|
| | | const month = date.getMonth() + 1;
|
| | | const day = date.getDate();
|
| | | const hours = date.getHours();
|
| | | const minutes = date.getMinutes();
|
| | | const seconds = date.getSeconds();
|
| | | return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
| | | showcageinfo(cage) {
|
| | | this.cage = cage;
|
| | | SelectCageInfo(cage).then(res => {
|
| | | this.cageinfo = res.data.cageinfo;
|
| | | this.dialogFormVisible3 = true;
|
| | | });
|
| | | },
|
| | | deleteglass(glassid, state) {
|
| | | if (state == 1) {
|
| | | DeleteByGlassID(glassid).then(res=>{
|
| | | if (res.data.message3 == 200) {
|
| | | this.$message.success("Operation successful");
|
| | | }
|
| | | });
|
| | | } else {
|
| | | this.$message.success("No out allowed");
|
| | | }
|
| | | },
|
| | | outglass(glassid,state){
|
| | | if (state == 1) {
|
| | | OutByGlassID(glassid).then(res=>{
|
| | | if (res.data.message3 == 200) {
|
| | | this.$message.success("Operation successful");
|
| | | }
|
| | | });
|
| | | } else {
|
| | | this.$message.success("No out allowed");
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.example.springboot.component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import javax.websocket.Session; |
| | | |
| | | import com.example.springboot.controller.SpianController; |
| | | import com.example.springboot.service.SpianService; |
| | | import com.example.springboot.mapper.AlarmMapper; |
| | | import com.example.springboot.mapper.HomeMapper; |
| | | |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | |
| | | public class PlcHold extends Thread { |
| | | |
| | |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | List<Boolean> bitlist = S7control.getinstance().ReadBits("DB2.0.0", 100); |
| | | List<Short> paramlist = S7control.getinstance().ReadWord("DB100.6", 1); |
| | | |
| | | spianService = WebSocketServer.applicationContext.getBean(SpianService.class); |
| | | //spianService.selectout("112"); |
| | | |
| | | //判断进片请求 |
| | | // List<Short> datas1List=S7control.getinstance().ReadWord("DB106.24", 1); |
| | | // List<Short> datas1ListState=S7control.getinstance().ReadWord("DB106.8", 1); |
| | | SpianController spianController=new SpianController(); |
| | | List<Short> datas1List1=new ArrayList<>(); |
| | | List<Short> datas1List2=new ArrayList<>(); |
| | | datas1List1.add((short)1); |
| | | datas1List2.add((short)0); |
| | | List<Short> datas1List=S7control.getinstance().ReadWord("DB106.24", 1); |
| | | List<Short> datas1ListState=S7control.getinstance().ReadWord("DB106.8", 1); |
| | | if(datas1List!=null &&datas1ListState!=null){ |
| | | //获取prc进片请求数据 |
| | | boolean exist = datas1List1.contains((short)1); |
| | | boolean exist1 = datas1List2.contains((short)0); |
| | | boolean exist = datas1List.contains((short)1); |
| | | //获取进片车状态 |
| | | boolean exist1 = datas1ListState.contains((short)0); |
| | | //进片请求为1时 |
| | | if(exist=true){ |
| | | //当进片车空闲时 |
| | | if(exist=true){ |
| | | //List<Short> datas1ListID=S7control.getinstance().ReadWord("DB106.26", 13); |
| | | List<Short> datas1ListID=new ArrayList<>(); |
| | | datas1ListID.add((short)001); |
| | | spianService = WebSocketServer.applicationContext.getBean(SpianService.class); |
| | | if(exist1=true){ |
| | | //获取进片id |
| | | List<Short> datas1ListID=S7control.getinstance().ReadWord("DB106.26", 13); |
| | | //获取玻璃id |
| | | for(Short list1:datas1ListID){ |
| | | spianService.selectAll(list1); |
| | | spianService.selectAll((short)list1); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //System.out.println(exist); |
| | | } |
| | | } |
| | | //获取进片id |
| | | // List<Short> datas1ListID=S7control.getinstance().ReadWord("DB106.26", 13); |
| | | |
| | | |
| | | |
| | | |
| | | // 查询数据库 |
| | |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(10000); |
| | | Thread.sleep(5000); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | return Result.success(map); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/loadinout") |
| | | public Result selectinout(Integer types){ |
| | | List<StorageCage> storageCageinout=homeMapper.selectinout(types); |
| | |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @GetMapping("/SelectCageInfo") |
| | | public Result SelectCageInfo(short cage) { |
| | | List<StorageCage> cageinfo = homeMapper.SelectCageInfo(cage); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("cageinfo", cageinfo); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @GetMapping("/DeleteByGlassID") |
| | | public Result DeleteByGlassID(short glassid) { |
| | | homeMapper.DeleteByGlassID(glassid); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message3", "200"); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @GetMapping("/OutByGlassID") |
| | | public Result OutByGlassID(String glassid) { |
| | | spianService.selectout2(glassid); |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message3", "200"); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.example.springboot.entity; |
| | | |
| | | public class Glass{ |
| | | private Integer id; |
| | | private Short orderId; |
| | | private double glassWidth; |
| | | private Short glassId; |
| | | |
| | | |
| | | |
| | | public Integer id() { |
| | | return id; |
| | | } |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public Short getOrderId() { |
| | | return orderId; |
| | | } |
| | | |
| | | public void setOrderId(Short orderId) { |
| | | this.orderId = orderId; |
| | | } |
| | | |
| | | public double getWidth() { |
| | | return glassWidth; |
| | | } |
| | | |
| | | public void setWidth(double glassWidth) { |
| | | this.glassWidth = glassWidth; |
| | | } |
| | | |
| | | public Short getGlassId() { |
| | | return glassId; |
| | | } |
| | | |
| | | public void setGlassId(Short glassId) { |
| | | this.glassId = glassId; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | public class StorageCage { |
| | | private Integer id; |
| | | private Integer prcId; |
| | | private String glassId; |
| | | private Integer cage; |
| | | private Integer cell; |
| | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | public Integer getPrcId() { |
| | | return prcId; |
| | | } |
| | | |
| | | public void setPrcId(Integer prcId) { |
| | | this.prcId = prcId; |
| | | } |
| | | |
| | | |
| | | public String getGlassId() { |
| | | return glassId; |
| | |
| | | List<StorageCage> selectAll(); |
| | | |
| | | // 查询1-5笼内层格子状态 |
| | | @Select("SELECT state from storage_cage where cage<=5 and tier=1") |
| | | @Select("SELECT cage,state from storage_cage where cage<=5 and tier=1") |
| | | List<StorageCage> selectRack1(); |
| | | |
| | | // 查询6-10笼内层格子状态 |
| | | @Select("SELECT state from storage_cage where cage>5 and tier=1") |
| | | @Select("SELECT cage,state from storage_cage where cage>5 and tier=1") |
| | | List<StorageCage> selectRack2(); |
| | | |
| | | // 查询1-5笼外层格子状态 |
| | | @Select("SELECT state from storage_cage where cage<=5 and tier=2") |
| | | @Select("SELECT cage,state from storage_cage where cage<=5 and tier=2") |
| | | List<StorageCage> selectRack3(); |
| | | |
| | | // 查询6-10笼外层格子状态 |
| | | @Select("SELECT state from storage_cage where cage>5 and tier=2") |
| | | @Select("SELECT cage,state from storage_cage where cage>5 and tier=2") |
| | | List<StorageCage> selectRack4(); |
| | | |
| | | // 根据任务类型查询当前正在出片,进片的玻璃信息 |
| | |
| | | //获取报警信息 |
| | | @Select("select id,content,timeon as timeons,endTime from alarmmg where endTime is null") |
| | | List<alarmmg> SelectAlarmmgInfo(); |
| | | |
| | | //获取理片笼内玻璃信息 |
| | | @Select("select *,concat(glasswidth,' x ',glassheight) as lengthwidth from storage_cage where cage=#{cage} ") |
| | | List<StorageCage> SelectCageInfo(short cage); |
| | | |
| | | @Update("update storage_cage set state=0,glass_id=null,order_id=null,glasswidth=null,glassheight=null,coating=null where glass_id=#{glassid}") |
| | | void DeleteByGlassID(short glassid); |
| | | |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.*; |
| | | |
| | | import com.example.springboot.common.Result; |
| | | import com.example.springboot.entity.Glass; |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.entity.StorageTask; |
| | | import com.example.springboot.entity.StorageCage; |
| | |
| | | |
| | | public interface SpianMapper { |
| | | //判断相邻笼子是否有空格 |
| | | @Select("select COUNT(if(a.state1=0,cell,null))as cell,ROUND(id/2)as id from (select *,max(state)as state1 from storage_cage a GROUP BY cage,cell)as a where (a.cage=#{cage1}-1 or a.cage=#{cage1}+1)and if(#{cage1}<6,a.cage>0 and a.cage<6,a.cage>5) GROUP BY cage ORDER BY cell desc LIMIT 1") |
| | | @Select("select COUNT(if(a.state1=0,cell,null))as cell,ROUND(id/2)as id from (select *,max(state)as state1 from storage_cage a GROUP BY cage,cell)as a where (a.cage=#{cage1}-1 or a.cage=#{cage1}+1)and if(a.cage<6,a.cage>0 and a.cage<6,a.cage>5) GROUP BY cage ORDER BY cell desc LIMIT 1") |
| | | int selectCage(int cage1); |
| | | |
| | | //@Select("(select*from storage_cage as a where a.state=0 and cage%2=0 ORDER BY id LIMIT 1)union (select a.* from storage_cage a inner join (select cage,if(shu2=1,shu3,shu5) as gezi from ( select cage, count(case when state1=1 and state2=0 then cell else null end)as shu1, count(case when state1=0 then cell else null end) as shu2, min(case when state1=1 and state2=0 then cell else null end) as shu3, min(case when state1=0 then cell else null end) as shu4, min(case when state1=0 or state2=0 then cell else null end) as shu5 from (select *,max(state) as state1,min(state) as state2 from storage_cage group by cage,cell) as a where cage%2!=0 GROUP BY cage HAVING shu2>1 or (shu2=1 and shu1>0) ) as sss limit 1)as b on a.cage=b.cage and a.cell=b.gezi and a.state=0 order by tier limit 1) ORDER BY id LIMIT 1;") |
| | |
| | | List<StorageCage> selectAll(Short glassid); |
| | | |
| | | //判断该笼子是否有合适宽度空格 |
| | | @Select("select COUNT(*),cage,cell,IF(tier=1,0,1)as tier,ROUND(id/2)as id from storage_cage where cage=#{cage1} and state=0 and width>=#{width} ORDER BY cell,tier") |
| | | @Select("select cage,cell,tier,id,ROUND(id/2)as prcId from storage_cage where cage=#{cage1} and state=0 and width>=#{width} ORDER BY cell,tier LIMIT 1") |
| | | StorageCage selectCage1(int cage1,double width); |
| | | //判断笼子内玻璃数 |
| | | @Select("select COUNT(tier)as tier from storage_cage where cage=#{cage} and cell=#{cell} and state=1;") |
| | | int selectsum(int cage,int cell); |
| | | |
| | | //@Update("update longzi set glass_id = #{glass_id}, width = #{width}, state = #{state} where cell = #{cell}") |
| | | @Update("update longzi set glass_id =123, width =1600, state =1 where cell =24") |
| | | void update(); |
| | | //获取玻璃信息 |
| | | @Select("select orderid,width from glass where glassid=#{glassid}") |
| | | Glass selectGlass(Short glassid); |
| | | |
| | | @Insert("insert into storage_task(task_type,task_state,shelf_rack,load_rack)values(#{storage_task},#{task_state},#{shelf_rack},#{load_rack})") |
| | | void insert(StorageTask storageTask); |
| | | |
| | | //出片任务查询 |
| | | @Select("select cage,cell,tier,glasswidth,ROUND(id/2)as id from storage_cage as a where a.order_id=#{orderId} and state=1 order by cage desc,tier desc,cell desc LIMIT 1") |
| | | @Select("select cage,cell,tier,glasswidth,ROUND(id/2)as prcId,id from storage_cage as a where a.order_id=#{orderId} and state=1 order by cage desc,tier desc,cell desc LIMIT 1") |
| | | StorageCage selectOut(String orderId); |
| | | //按玻璃ID出片任务查询 |
| | | @Select("select cage,cell,tier,glasswidth,ROUND(id/2)as prcId,id from storage_cage as a where a.order_id=#{orderId} and state=1 order by cage desc,tier desc,cell desc LIMIT 1") |
| | | StorageCage selectOut2(String glassid); |
| | | |
| | | //判断出片为1时,是否可直接出片 |
| | | @Select("select state from storage_cage where cage=#{cage} and cell=#{cell} and tier=2;") |
| | | int selectGlassState(int cage,int cell); |
| | | |
| | | //判断该调拨的笼子 |
| | | @Select("select cage,cell,max(state)as shu,ROUND(id/2)as id from storage_cage where width>=#{width} and cage>#{cage1} and cage<#{cage2} GROUP BY cage,cell HAVING shu=0 order by abs(#{cage} - cage) limit 1;") |
| | | @Select("select cage,cell,max(state)as shu,ROUND(id/2)as prcid,id from storage_cage where width>=#{width} and cage>#{cage1} and cage<#{cage2} GROUP BY cage,cell HAVING shu=0 order by abs(#{cage} - cage) limit 1;") |
| | | StorageCage selectGlassCage(int cage,double width,int cage1,int cage2); |
| | | |
| | | //修改笼子信息(出片) |
| | | //删除笼子信息(出片) |
| | | @Update("update storage_cage set state=#{state},width=width+#{width},glass_id=#{glassid},order_id=#{orderid},glasswidth=0 where cage=#{cage} and cell=#{cell} and tier=#{tier};") |
| | | void UpdataGlassCage(String orderid,String glassid,double width,int cage,int cell,int tier,int state); |
| | | |
| | | //修改笼子信息(进片) |
| | | @Update("update storage_cage set state=#{state},width=width-#{width},glass_id=#{glassid},order_id=#{orderid},glasswidth=#{width} where cage=#{cage} and cell=#{cell} and tier=#{tier};") |
| | | void UpdataAddCage(String orderid,Short glassid,double width,int cage,int cell,int tier,int state); |
| | | @Update("update storage_cage set state=#{state},width=width-#{width},glass_id=#{glassid},order_id=#{orderid},glasswidth=#{width} where id=#{id};") |
| | | void UpdataAddCage(Short orderid,Short glassid,double width,int cage,int cell,int id,int state); |
| | | //调拨更换笼子信息 |
| | | @Update("update storage_cage as a,(select*from storage_cage b where b.cage=#{cage} and b.cell=#{cell} and b.tier=2)as b set a.glass_id=b.glass_id,a.order_id=b.order_id,a.glasswidth=b.glasswidth,a.width=a.width-b.glasswidth,a.state=1 where a.id=#{id1}") |
| | | void UpdateDBCage(int id1,int cage,int cell); |
| | | // @Insert("insert into user(name, date, address, user_no) values (#{name}, #{date}, #{address}, #{userNo})") |
| | | // void insert (Spian spian); |
| | | |
| | |
| | | |
| | | import com.example.springboot.common.Result; |
| | | import com.example.springboot.component.S7control; |
| | | import com.example.springboot.entity.Glass; |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.mapper.SpianMapper; |
| | | |
| | |
| | | @Autowired |
| | | private SpianMapper spianMapper; |
| | | @GetMapping("/all2") |
| | | public Result selectadd(String orderid){ |
| | | public Result selectout(String orderid){ |
| | | //定义PRC数据传送数组 |
| | | List<String> adddresslist=new ArrayList<>(); |
| | | adddresslist.add("DB105.6");//出片车起始位置 |
| | |
| | | //获取优先出片的位置 |
| | | StorageCage cageout=spianMapper.selectOut(orderid); |
| | | int cage =cageout.getCage(); //储存出片位置,笼子格子几号玻璃 |
| | | int cell =cageout.getCell(); |
| | | int tier =cageout.getTier(); |
| | | int id=cageout.getId(); |
| | | int cell =cageout.getCell();//出片格号 |
| | | int tier =cageout.getTier();//出片内外片 |
| | | int prcid=cageout.getPrcId();//prcid |
| | | int prcid2; |
| | | int ids; |
| | | double glasswidth=cageout.getGlassWidth(); |
| | | //判断玻璃内外片 |
| | |
| | | //判断玻璃可直接出片时 |
| | | //修改数据库笼子表(出片) |
| | | spianMapper.UpdataGlassCage("","",glasswidth, cage, cell, tier, 0); |
| | | datas.add((short)id); |
| | | |
| | | datas.add((short)prcid); |
| | | datas.add((short)1000); |
| | | datas.add((short)1); |
| | | datas.add((short)1); |
| | |
| | | //玻璃需要调拨时,判断属于哪个半区的笼子 |
| | | if(cage<6){ |
| | | StorageCage cagecell= spianMapper.selectGlassCage(cage,glasswidth,0,6); |
| | | if(cagecell==null){ |
| | | return Result.success(cagecell); |
| | | } |
| | | //获取调拨位置进行调拨 |
| | | prcid2=cagecell.getPrcId();//调拨目标位PRCID |
| | | ids=cagecell.getId();//调拨目标位ID |
| | | //更换玻璃的笼子 |
| | | spianMapper.UpdateDBCage(ids, cage, cell);//将原格子数据更新到新格子里 |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 0);//清除原格子数据 |
| | | //填入调拨数据 |
| | | datas.add((short)id); |
| | | datas.add((short)ids); |
| | | datas.add((short)prcid);//调拨外片起始位置 |
| | | datas.add((short)prcid2); |
| | | datas.add((short)2); |
| | | datas.add((short)1); |
| | | //传输mes数据,坐标,数据 |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | //更换玻璃的笼子 |
| | | datas.clear(); // 清空整个列表 |
| | | //判断调拨结束后再次出片,填入出片数据 |
| | | datas.add((short)id); |
| | | datas.add((short)prcid); |
| | | datas.add((short)1000); |
| | | datas.add((short)1); |
| | | datas.add((short)1); |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | //修改数据库笼子表(出片) |
| | | spianMapper.UpdataGlassCage("","",glasswidth, cage, cell, tier, 0); |
| | | |
| | | return Result.success(cagecell); //调拨位置的参数内容 |
| | | |
| | | }else{ |
| | | }else{//笼子号大于5时 |
| | | StorageCage cagecell= spianMapper.selectGlassCage(cage,glasswidth,5,11); |
| | | if(cagecell==null){ |
| | | return Result.success(cagecell); |
| | | } |
| | | //获取调拨位置进行调拨 |
| | | prcid2=cagecell.getPrcId();//调拨目标位prcID |
| | | ids=cagecell.getId();//调拨目标位ID |
| | | //填入调拨数据 |
| | | datas.add((short)id); |
| | | datas.add((short)ids); |
| | | datas.add((short)prcid); |
| | | datas.add((short)prcid2); |
| | | datas.add((short)2); |
| | | datas.add((short)1); |
| | | //转移原调拨格子数据 |
| | | spianMapper.UpdateDBCage(ids, cage, cell);//将原格子数据更新到新格子里 |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 0);//清除原格子数据 |
| | | //传输mes数据,坐标,数据 |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | datas.clear(); // 清空整个列表 |
| | | //判断调拨结束后再次出片 |
| | | //填入出片数据 |
| | | datas.add((short)id); |
| | | datas.add((short)prcid); |
| | | datas.add((short)1000); |
| | | datas.add((short)1); |
| | | datas.add((short)1); |
| | |
| | | public Result selectAll(Short glassid){ |
| | | //return spianMapper.selectAll(); |
| | | int cage1; |
| | | int cells; |
| | | int ids; |
| | | int tier; |
| | | double widths=1500; |
| | | int prcid; |
| | | int tiers; |
| | | int prctier; |
| | | |
| | | Glass glasslist=spianMapper.selectGlass(glassid); |
| | | double widths=glasslist.getWidth(); |
| | | Short orderids=glasslist.getOrderId(); |
| | | |
| | | List<String> adddresslist=new ArrayList<>(); |
| | | adddresslist.add("DB105.0");//进片车起始位置 |
| | | adddresslist.add("DB105.2");//进片车目标位置 |
| | | adddresslist.add("DB105.4");//进片笼玻璃数 |
| | | adddresslist.add("DB105.12");//进片车启动 1为启动 |
| | | List<Short> datas=new ArrayList<>(); |
| | | |
| | | //String orderid="A001"; |
| | | //获取订单相关度最高的笼子排序 |
| | | List<StorageCage> storageCage=spianMapper.selectAll(glassid); |
| | | if(storageCage==null){ |
| | | return Result.success(storageCage); |
| | | } |
| | | for (StorageCage storageCage2 : storageCage) { |
| | | //保存订单优先顺序笼子号 |
| | | cage1=storageCage2.getCage(); |
| | |
| | | int cages=spianMapper.selectCage(cage1); |
| | | //判断选中笼子是否有合适宽度空格 |
| | | StorageCage cages1=spianMapper.selectCage1(cage1,widths); |
| | | ids=cages1.getId(); |
| | | tier=cages1.getTier(); |
| | | ids=cages1.getId();//数据库ID |
| | | tiers=cages1.getTier();//内外片 |
| | | cells=cages1.getCell();//格子号 |
| | | prcid=cages1.getPrcId();//传给prc的目标地id |
| | | prctier=spianMapper.selectsum(cage1, cells);//传给prc的格子内玻璃数 |
| | | //有合适空格时进片 |
| | | if(cages>1 &&cages1.getTier()!=null){ |
| | | //执行进片 |
| | | datas.add((short)1000); |
| | | datas.add((short)ids); |
| | | datas.add((short)tier); |
| | | datas.add((short)prcid); |
| | | datas.add((short)prctier); |
| | | datas.add((short)1); |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | //数据库修改笼子表新增一条玻璃 |
| | | spianMapper.UpdataAddCage("glassid", glassid, widths, cages, ids, tier, 1);//还未获取玻璃id |
| | | |
| | | spianMapper.UpdataAddCage(orderids, glassid, widths, cage1, cells, ids, 1); |
| | | return Result.success(cages1); |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | @GetMapping("/all2") |
| | | public Result selectout2(String glassid){ |
| | | //定义PRC数据传送数组 |
| | | List<String> adddresslist=new ArrayList<>(); |
| | | adddresslist.add("DB105.6");//出片车起始位置 |
| | | adddresslist.add("DB105.8");//出片车目标位置 |
| | | adddresslist.add("DB105.10");//出片笼玻璃数 |
| | | adddresslist.add("DB105.14");//出片车启动 1为启动 |
| | | List<Short> datas=new ArrayList<>(); |
| | | //获取优先出片的位置 |
| | | StorageCage cageout=spianMapper.selectOut2(glassid); |
| | | int cage =cageout.getCage(); //储存出片位置,笼子格子几号玻璃 |
| | | int cell =cageout.getCell();//出片格号 |
| | | int tier =cageout.getTier();//出片内外片 |
| | | int prcid=cageout.getPrcId();//prcid |
| | | int prcid2; |
| | | int ids; |
| | | double glasswidth=cageout.getGlassWidth(); |
| | | //判断玻璃内外片 |
| | | if(tier==2){ |
| | | //判断玻璃可直接出片时 |
| | | //修改数据库笼子表(出片) |
| | | spianMapper.UpdataGlassCage("","",glasswidth, cage, cell, tier, 0); |
| | | |
| | | datas.add((short)prcid); |
| | | datas.add((short)1000); |
| | | datas.add((short)1); |
| | | datas.add((short)1); |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | return Result.success(datas); |
| | | } |
| | | else{ |
| | | //获取格子的玻璃数量 |
| | | int state= spianMapper.selectGlassState(cage,cell); |
| | | //判断内片是否需要调拨 |
| | | if(state==0){ |
| | | return Result.success("状态为0,直接出片"); |
| | | }else{ |
| | | //玻璃需要调拨时,判断属于哪个半区的笼子 |
| | | if(cage<6){ |
| | | StorageCage cagecell= spianMapper.selectGlassCage(cage,glasswidth,0,6); |
| | | if(cagecell==null){ |
| | | return Result.success(cagecell); |
| | | } |
| | | //获取调拨位置进行调拨 |
| | | prcid2=cagecell.getPrcId();//调拨目标位PRCID |
| | | ids=cagecell.getId();//调拨目标位ID |
| | | //更换玻璃的笼子 |
| | | spianMapper.UpdateDBCage(ids, cage, cell);//将原格子数据更新到新格子里 |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 0);//清除原格子数据 |
| | | //填入调拨数据 |
| | | datas.add((short)prcid);//调拨外片起始位置 |
| | | datas.add((short)prcid2); |
| | | datas.add((short)2); |
| | | datas.add((short)1); |
| | | //传输mes数据,坐标,数据 |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | datas.clear(); // 清空整个列表 |
| | | //判断调拨结束后再次出片,填入出片数据 |
| | | datas.add((short)prcid); |
| | | datas.add((short)1000); |
| | | datas.add((short)1); |
| | | datas.add((short)1); |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | //修改数据库笼子表(出片) |
| | | |
| | | return Result.success(cagecell); //调拨位置的参数内容 |
| | | |
| | | }else{//笼子号大于5时 |
| | | StorageCage cagecell= spianMapper.selectGlassCage(cage,glasswidth,5,11); |
| | | if(cagecell==null){ |
| | | return Result.success(cagecell); |
| | | } |
| | | //获取调拨位置进行调拨 |
| | | prcid2=cagecell.getPrcId();//调拨目标位prcID |
| | | ids=cagecell.getId();//调拨目标位ID |
| | | //填入调拨数据 |
| | | datas.add((short)prcid); |
| | | datas.add((short)prcid2); |
| | | datas.add((short)2); |
| | | datas.add((short)1); |
| | | //转移原调拨格子数据 |
| | | spianMapper.UpdateDBCage(ids, cage, cell);//将原格子数据更新到新格子里 |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 0);//清除原格子数据 |
| | | //传输mes数据,坐标,数据 |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | datas.clear(); // 清空整个列表 |
| | | //判断调拨结束后再次出片 |
| | | //填入出片数据 |
| | | datas.add((short)prcid); |
| | | datas.add((short)1000); |
| | | datas.add((short)1); |
| | | datas.add((short)1); |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | return Result.success(cagecell); //调拨位置的参数内容 |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |