Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
| | |
| | | data :""
|
| | | })
|
| | | }
|
| | |
|
| | | export function Loadcarlist() {
|
| | | return request({
|
| | | url: '/home/Loadcarlist',
|
| | | method: 'get',
|
| | | data :""
|
| | | })
|
| | | }
|
| | |
|
| | |
| | |
|
| | | .gezi {
|
| | | height: 35px;
|
| | | |
| | |
|
| | | position: absolute;
|
| | | width: 3.07px;
|
| | | width: 3.08px;
|
| | | /* width: 4.22px; */
|
| | | }
|
| | |
|
| | | .gezi:nth-child(22),
|
| | | /* .gezi:nth-child(22),
|
| | | .gezi:nth-child(43),
|
| | | .gezi:nth-child(64),
|
| | | .gezi:nth-child(85) {
|
| | | margin-left: 7px;
|
| | | /* margin-left: 10px; */
|
| | | }
|
| | | margin-left: 10px;
|
| | | } */
|
| | |
|
| | |
|
| | |
|
| | | .blocks {
|
| | |
|
| | | |
| | |
|
| | | background-image: url('../../img/xmjc.png');
|
| | | margin: 0 auto;
|
| | | background-repeat: no-repeat;
|
| | |
| | | transform: translateX(-150%);
|
| | | }
|
| | | }
|
| | |
|
| | | .el-dialog{
|
| | | width: 80%;
|
| | | }
|
| | | </style>
|
| | | <template>
|
| | | <el-container>
|
| | |
| | | <el-main>
|
| | | <div class="box" @click="dialogFormVisible2 = true">
|
| | | <div class="text">
|
| | | Alarm:
|
| | | <!-- Alarm: -->
|
| | | <label v-for="item in this.alarm" :key="item['id']">
|
| | | {{ item['content'] }}
|
| | | </label>
|
| | |
| | | <el-footer>
|
| | | <div class="blocks" style="position: relative;">
|
| | | <div style="display:flex;position: absolute;float:left;z-index: 999;top:102px;left:237px;">
|
| | | <div :class="getStatusClass(item.state)" v-for="item in cagelist1" :key="item['date']"
|
| | | :style="{ height: 35 * item['glassWidth'] + 'px' }" @click="showcageinfo(item['cage'])"></div>
|
| | | <div :class="getStatusClass(item.state)" v-for="(item, index) in cagelist1" :key="item['date']"
|
| | | :style="{ height: 35 * item['glassWidth'] + 'px', left: 3.07 * index + Math.abs(item['cage'] - 10) * 6.8 + 'px' }"
|
| | | @click="showcageinfo(item['cage'])"></div>
|
| | | </div>
|
| | | <div style="display:flex;position: absolute;float:left;z-index: 999;top:102px;left:640px;">
|
| | | <div :class="getStatusClass(item.state)" v-for="item in cagelist2" :key="item['date']"
|
| | | :style="{ height: 35 * item['glassWidth'] + 'px' }" @click="showcageinfo(item['cage'])"></div>
|
| | | <div :class="getStatusClass(item.state)" v-for="(item, index) in cagelist2" :key="item['date']"
|
| | | :style="{ height: 35 * item['glassWidth'] + 'px', left: 3.07 * index + Math.abs(item['cage'] - 5) * 6.8 + 'px' }"
|
| | | @click="showcageinfo(item['cage'])"></div>
|
| | | </div>
|
| | | <div style="display:flex;position: absolute;float:left;z-index: 999;top:139px;left:237px;">
|
| | | <div :class="getStatusClass(item.state)" v-for="item in cagelist3" :key="item['date']"
|
| | | :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px' }"
|
| | | <div :class="getStatusClass(item.state)" v-for="(item, index) in cagelist3" :key="item['date']"
|
| | | :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px', left: 3.07 * index + Math.abs(item['cage'] - 10) * 6.8 + 'px' }"
|
| | | @click="showcageinfo(item['cage'])">
|
| | | </div>
|
| | | </div>
|
| | | <div style="display:flex;position: absolute;float:left;z-index: 999;top:139px;left:640px;">
|
| | | <div :class="getStatusClass(item.state)" v-for="item in cagelist4" :key="item['date']"
|
| | | :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px' }"
|
| | | <div :class="getStatusClass(item.state)" v-for="(item, index) in cagelist4" :key="item['date']"
|
| | | :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px', left: 3.07 * index + Math.abs(item['cage'] - 5) * 6.8 + 'px' }"
|
| | | @click="showcageinfo(item['cage'])"></div>
|
| | | </div>
|
| | | <div class="blue gezi" :style="{display:flex,position: absolute,float:left,top: 105 +'px',left: 1050 +'px',height: loadglassheight+'px',width: 5+'px'}"></div>
|
| | | <div class="blocks-img" :style="{ left: car1 + 'px', top: '16px' }"></div>
|
| | | <div class="blocks-img" :style="{ left: car2 + 'px', top: '175px' }"></div>
|
| | | <div class="blocks-img2"></div>
|
| | | <div class="blocks-img3"></div>
|
| | | <!-- <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']"
|
| | | :style="{ height: 35 * item['glassWidth'] + 'px' }"
|
| | | <div :class="getStatusClass(item.state)" v-for="(item,index) in cagelist1" :key="item['date']"
|
| | | :style="{ height: 35 * item['glassWidth'] + 'px',left:4.22*index+'px' }"
|
| | | @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']"
|
| | | :style="{ height: 35 * item['glassWidth'] + 'px' }"
|
| | | <div :class="getStatusClass(item.state)" v-for="(item,index) in cagelist2" :key="item['date']"
|
| | | :style="{ height: 35 * item['glassWidth'] + 'px',left:4.22*index+'px' }"
|
| | | @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']"
|
| | | :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px' }"
|
| | | <div :class="getStatusClass(item.state)" v-for="(item,index) in cagelist3" :key="item['date']"
|
| | | :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px',left:4.22*index+'px' }"
|
| | | @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']"
|
| | | :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px' }"
|
| | | <div :class="getStatusClass(item.state)" v-for="(item,index) in cagelist4" :key="item['date']"
|
| | | :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px',left:4.22*index+'px' }"
|
| | | @click="showcageinfo(item['cage'])"></div>
|
| | | </div>
|
| | | <div class="blocks-img" :style="{ left: car1 + 'px', top: '16px' }"></div>
|
| | |
| | | </el-dialog>
|
| | | <el-dialog :visible.sync="dialogFormVisible3" :title="$t('Cage Details')">
|
| | | <el-table :data="this.cageinfo" :height="700" border style="width: 100%;overflow: auto;">
|
| | | <el-table-column :width="150" prop="cage" :label="$t('The Cage number')"></el-table-column>
|
| | | <el-table-column prop="cage" :label="$t('The Cage number')"></el-table-column>
|
| | | <el-table-column prop="cell" :label="$t('cell')"></el-table-column>
|
| | | <el-table-column prop="tier" :label="$t('tier')"></el-table-column>
|
| | | <el-table-column prop="glassId" :label="$t('glassid')"></el-table-column>
|
| | | <el-table-column :width="130" prop="orderId" :label="$t('order number')"></el-table-column>
|
| | | <el-table-column :width="150" prop="lengthWidth" :label="$t('Length and width')"></el-table-column>
|
| | | <el-table-column prop="orderId" :label="$t('order number')"></el-table-column>
|
| | | <el-table-column prop="lengthWidth" :label="$t('Length and width')"></el-table-column>
|
| | | <el-table-column prop="coating" :label="$t('coating')"></el-table-column>
|
| | | <el-table-column :width="140" :label="$t('Operate')">
|
| | | <el-table-column :label="$t('Operate')">
|
| | | <template slot-scope='scope'>
|
| | | <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
|
| | | @click="deleteglass(scope.row.glassId, scope.row.state)">{{ $t('delete') }}</el-button>
|
| | |
| | | </template>
|
| | | <script>
|
| | |
|
| | | import { home, home2, loadtask, InsertOrder, Addglassid, UpdateTask, SelectAlarmmgInfo, SelectCageInfo, DeleteByGlassID, OutByGlassID } from "../../api/home";
|
| | | import { home, home2, loadtask, InsertOrder, Addglassid, UpdateTask, SelectAlarmmgInfo, SelectCageInfo, DeleteByGlassID, OutByGlassID, Loadcarlist } from "../../api/home";
|
| | |
|
| | |
|
| | | import LanguageMixin from '../../lang/LanguageMixin'
|
| | |
| | | order: "",
|
| | | glassid: "",
|
| | | url: "../../img/bigcar01.png",
|
| | | car1: 107,
|
| | | car2: 175,
|
| | | // car1: 150,
|
| | | // car2: 242,
|
| | | car1: 145,
|
| | | car2: 210,
|
| | | // car1: 210,
|
| | | // car2: 300,
|
| | | cageinfo: [],
|
| | | cage: 0
|
| | | cage: 0,
|
| | | carlist: [],
|
| | | loadglassheight:0
|
| | | };
|
| | | },
|
| | | created() {
|
| | |
| | | //console.log("收到数据====" + msg.data);
|
| | | let obj = JSON.parse(msg.data);
|
| | | if (obj.params != null) {
|
| | | this.car1 = 107 + 17.62 * obj.params[0][0]/1000;
|
| | | this.car2 = 175 + 17.62 * obj.params[0][1]/1000;
|
| | | // this.car1 = 150 + 24.6 * obj.params[0][0]/1000;
|
| | | // this.car2 = 242 + 24.6 * obj.params[0][1]/1000;
|
| | | this.car1 = 145 + 8.1 * Math.abs(obj.params[0][0] - this.carlist[0]['start']) / Math.abs(this.carlist[0]['end'] - this.carlist[0]['start']) * 100;
|
| | | this.car2 = 210 + 8.25 * Math.abs(obj.params[0][1] - this.carlist[1]['start']) / Math.abs(this.carlist[1]['end'] - this.carlist[1]['start']) * 100;
|
| | | // this.car1 = 210 + 11.25 * (obj.params[0][1]-this.carlist[1]['start'])/(this.carlist[1]['end']-this.carlist[1]['start'])*100;
|
| | | // this.car2 = 300 + 11.25 * (obj.params[0][1]-this.carlist[1]['start'])/(this.carlist[1]['end']-this.carlist[1]['start'])*100;
|
| | | console.log(obj.params[0][1], this.carlist[1]['start']);
|
| | | }
|
| | | this.tableData = obj.tableData[0];
|
| | | this.cagelist1 = obj.cagelist1[0];
|
| | |
| | | this.tasklist1 = obj.tasklist1[0];
|
| | | this.tasklist2 = obj.tasklist2[0];
|
| | | this.alarm = obj.alarmmg[0];
|
| | |
|
| | | this.loadglassheight=obj.loadglassheight;
|
| | | SelectCageInfo(this.cage).then(res => {
|
| | | this.cageinfo = res.data.cageinfo;
|
| | | });
|
| | |
| | | if (res.data.list.length > 0) {
|
| | | this.outcell = this.tasklist2[0]['cell'];
|
| | | }
|
| | |
|
| | | });
|
| | | loadtask(this.task2).then(res => {
|
| | | this.tasklist2 = res.data.list;
|
| | |
|
| | | });
|
| | | SelectAlarmmgInfo().then(res => {
|
| | | this.alarm = res.data.alarmmg;
|
| | | });
|
| | | Loadcarlist().then(res => {
|
| | | this.carlist = res.data.carlist;
|
| | | console.log(this.carlist);
|
| | | });
|
| | | },
|
| | | //根据格子状态修改颜色
|
| | | getStatusClass(state) {
|
| | |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | // SpringApplication.run(AuthorityApplication.class, args); |
| | | // 111 |
| | | //System.out.println("null"); |
| | | |
| | | SpringApplication springApplication = new SpringApplication(AuthorityApplication.class); |
| | | ConfigurableApplicationContext configurableApplicationContext = springApplication.run(args); |
| | | WebSocketServer.setApplicationContext(configurableApplicationContext); |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.javassist.compiler.ast.Symbol; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import com.example.springboot.service.JdbcConnections; |
| | |
| | | |
| | | @Override |
| | | public void run() { |
| | | |
| | | boolean inglassbegin=false; |
| | | boolean outglassbegin=false; |
| | | while (this != null) { |
| | | try { |
| | | |
| | | Thread.sleep(500); |
| | | Thread.sleep(1000); |
| | | } catch (InterruptedException e) { |
| | | // \\ TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | |
| | | |
| | | // 根据玻璃id获取订单号,单独数据源 |
| | | // try { |
| | | |
| | | // Glass glass = jdbcConnections.selectGlass(112); |
| | | |
| | | // // System.out.println(glass.getOrderId()); |
| | |
| | | // // TODO Auto-generated catch block |
| | | // e.printStackTrace(); |
| | | // } |
| | | spianService.selectAll((short)257); |
| | | // spianService.selectAll((short)257); |
| | | //判断进片请求 |
| | | List<Short> datas1List = S7control.getinstance().ReadWord("DB106.24", 1); |
| | | List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8", 1); |
| | | |
| | | |
| | | List<Short> datas1List = S7control.getinstance().ReadWord("DB106.24", 1);// 获取prc进片请求数据 |
| | | List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8", 1);// 获取进片车状态 |
| | | List<Short> datas1ListState2 = S7control.getinstance().ReadWord("DB105.12", 1);// 获取进片车任务是否启动 |
| | | |
| | | if (datas1List != null && datas1ListState != null) { |
| | | |
| | | // 获取prc进片请求数据 |
| | | boolean exist = datas1List.contains((short) 1); |
| | | // 获取进片车状态 |
| | | boolean exist1 = datas1ListState.contains((short) 0); |
| | | //判断进片车任务是否启动 |
| | | boolean exist2 = datas1ListState2.contains((short) 1); |
| | | |
| | | String glassid=""; |
| | | StringBuilder strId=new StringBuilder(); |
| | | StringBuilder writedstrId=new StringBuilder(); |
| | | |
| | | if(!inglassbegin&!exist1) |
| | | { |
| | | inglassbegin=true; |
| | | } |
| | | if(inglassbegin&exist1) |
| | | { |
| | | inglassbegin=false; |
| | | spianMapper.UpdataAddCageState(1,2); |
| | | } |
| | | // 进片请求为1时 |
| | | if (exist == true) { |
| | | // 当进片车空闲时 |
| | | if (exist1 == true) { |
| | | //获取已下发的进片id 与plc请求的id作比较 |
| | | byte[] writedglassidbytes = S7control.getinstance().ReadByte("DB105.16", 1); |
| | | if (writedglassidbytes != null) { |
| | | // 获取玻璃id |
| | | for (byte iditem : writedglassidbytes) { |
| | | writedstrId.append(iditem); |
| | | } |
| | | } |
| | | // 获取进片id |
| | | List<Short> datas1ListID = S7control.getinstance().ReadWord("DB106.26", 1); |
| | | byte[] datas1ListID = S7control.getinstance().ReadByte("DB106.26", 1); |
| | | if (datas1ListID != null) { |
| | | // 获取玻璃id |
| | | for (Short list1 : datas1ListID) { |
| | | glassid=glassid.concat(list1.toString()); |
| | | for (byte list1 : datas1ListID) { |
| | | strId.append(list1); |
| | | |
| | | } |
| | | spianService.selectAll(Short.parseShort(glassid)); |
| | | if(!writedstrId.toString().equals(strId.toString())) //已经下发的id与plc请求的id不一样时,认为不是重复的任务,才执行下发任务指令 |
| | | { |
| | | spianService.selectAll(strId.toString()); |
| | | S7control.getinstance().WriteByte("DB105.16",datas1ListID);//派发进片id |
| | | |
| | | } |
| | | //spianService.selectAll(Short.parseShort(strId.toString())); |
| | | } |
| | | |
| | | } |
| | | // System.out.println(exist); |
| | | } |
| | | |
| | | if(exist1==false){//下发任务后将任务启动改为0 |
| | | if(exist2==true) { |
| | | S7control.getinstance().WriteWord("DB105.12",(short)0);//进片任务启动改为0 |
| | | } |
| | | } |
| | | } |
| | | |
| | | //spianService.selectAll((short) 111); |
| | | |
| | | List<Short> outlist = S7control.getinstance().ReadWord("DB106.20", 1); // 出片车状态 |
| | | List<Short> outlist1 = S7control.getinstance().ReadWord("DB105.14", 1); // 出片任务是否启动 |
| | | StringBuilder writedstrIdOut=new StringBuilder(); |
| | | //获取已下发的出片id |
| | | byte[] writedglassidbytesOut = S7control.getinstance().ReadByte("DB105.30", 1); |
| | | if (writedglassidbytesOut != null) { |
| | | // 获取玻璃id |
| | | for (byte iditem : writedglassidbytesOut) { |
| | | writedstrIdOut.append(iditem); |
| | | } |
| | | } |
| | | boolean outstate=false;//出片车空闲判断 |
| | | if (outlist != null) { |
| | | boolean outstate1=false;//出片车任务是否启动 |
| | | if (outlist != null&&outlist1!=null) { |
| | | // 判断按订单出片 |
| | | outstate = outlist.contains((short) 0); |
| | | outstate = outlist.contains((short) 0);//出片车空闲判断 |
| | | outstate1 = outlist1.contains((short) 1);//出片车任务是否启动 |
| | | |
| | | Glass glass=spianMapper.SelectDBOut();//判断是否有调拨后的出片任务未完成 |
| | | |
| | | if(outstate== true ){ |
| | | if(glass.getId()==2){ |
| | | if(!outglassbegin&!outstate)//当任务还未开始,且出片车不空闲时,任务状态改为开始 |
| | | { |
| | | outglassbegin=true; |
| | | } |
| | | if(outglassbegin&outstate)//当任务开始且出片车空闲时 |
| | | { |
| | | outglassbegin=false; |
| | | spianMapper.UpdataAddCageState(0,3); |
| | | } |
| | | |
| | | if(outstate== true &glass.getGlassId()!=null){ //当出片车空闲且有出片任务待完成时 |
| | | if(glass.getId()==2&!writedstrIdOut.toString().equals(glass.getGlassId().toString())){ |
| | | spianService.selectout2(glass.getGlassId().toString()); |
| | | } |
| | | } |
| | | } |
| | | if(outstate==false){//下发任务后将任务启动改为0//出片车空闲判断 |
| | | if(outstate1==true){ |
| | | S7control.getinstance().WriteWord("DB105.14",(short)0);//出片任务启动改为0 |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | if (outstate == true) { // 出片车状态空闲时 |
| | | Integer state=spianMapper.Selectoutstate(); |
| | | String orderid = spianMapper.SelectOrderout(); |
| | | if (orderid != null) { |
| | | |
| | | if (orderid != null &&state==0) { |
| | | spianService.selectout(orderid); |
| | | } |
| | | } |
| | |
| | | public void run() {
|
| | | while (this != null) {
|
| | | try {
|
| | | Thread.sleep(500);
|
| | | Thread.sleep(1000);
|
| | | } catch (InterruptedException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | jsonObject.append("alarmmg", alarmmg); |
| | | // 读去Plc进片车与出片车位置W |
| | | List<String> addressList = new ArrayList<String>(); |
| | | addressList.add("DB106.0"); |
| | | addressList.add("DB106.12"); |
| | | addressList.add("DB106.0"); |
| | | List<Short> paramlist = S7control.getinstance().ReadWord(addressList); |
| | | |
| | | // List<Short> paramlists = new ArrayList<Short>(); |
| | | // short para1 = 1; |
| | | // short para2 = 2; |
| | | // short para1 = 11111; |
| | | // short para2 = 32000; |
| | | // paramlists.add(para1); |
| | | // paramlists.add(para2); |
| | | // System.out.println(paramlists); |
| | | |
| | | if(paramlist!=null){ |
| | | // Short[] paramlists = paramlist.toArray(new Short[0]); |
| | | jsonObject.append("params", paramlist); |
| | | } |
| | | List<Short> inglassInfo = S7control.getinstance().ReadWord("DB106.24",1); |
| | | if(inglassInfo!=null&inglassInfo.size()>0){ |
| | | jsonObject.append("loadglassheight", inglassInfo.get(0)*70); |
| | | } |
| | | // jsonObject.append("params", new short[] { 30, 40, }); |
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Home"); |
| | | if (sendwServer != null) { |
| | |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(500); |
| | | Thread.sleep(1000); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(500); |
| | | Thread.sleep(1000); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | } |
| | | s7PLC.writeMultiData(addressWrite); |
| | | } |
| | | /** |
| | | * 按指定的地址 写入多个byte |
| | | * |
| | | * @param address 地址 |
| | | * @param datas byte的值 |
| | | */ |
| | | public void WriteByte(String address, byte[] datas) { |
| | | if (s7PLC==null) |
| | | return; |
| | | // s7PLC.write(address, data); |
| | | s7PLC.writeByte(address, datas); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 读取word结果集 |
| | |
| | | List<String> addresslist = GetAddressList(address, count, 16); |
| | | return s7PLC.readInt16(addresslist); |
| | | } |
| | | /** |
| | | * 按指定的地址 读取byte结果集 |
| | | * |
| | | * @param address 地址 |
| | | * @param count 连续读多少个byte |
| | | * @return 结果 |
| | | */ |
| | | public byte[] ReadByte(String address, int count) { |
| | | if (s7PLC==null) |
| | | return null; |
| | | |
| | | // List<String> addresslist = GetAddressList(address, count, 16); |
| | | return s7PLC.readByte(address,count); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 按bit位 0 flase 1 true 读取结果 |
| | |
| | | import com.example.springboot.service.HomeService; |
| | | import com.example.springboot.service.SpianService; |
| | | import com.example.springboot.common.Result; |
| | | import com.example.springboot.entity.CarPosition; |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.entity.alarmmg; |
| | | |
| | |
| | | map.put("message2", "500"); |
| | | } else { |
| | | // 调用伍上片函数 |
| | | short results = spianService.selectAll(glassid); |
| | | short results = spianService.selectAll(Short.toString(glassid)); |
| | | if (results == 200) { |
| | | map.put("message2", "200"); |
| | | } else if (results == 300) { |
| | |
| | | |
| | | @GetMapping("/OutByGlassID") |
| | | public Result OutByGlassID(String glassid) { |
| | | |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | // 调用伍上片函数 |
| | | Short results = spianService.selectout2(glassid); |
| | |
| | | } else if (results == 400) { |
| | | map.put("message2", "400"); |
| | | } |
| | | |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @GetMapping("/Loadcarlist") |
| | | public Result Loadcarlist() { |
| | | List<CarPosition> carlist = homeMapper.Loadcarlist(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("carlist", carlist); |
| | | return Result.success(map); |
| | | } |
| | | } |
| | |
| | | //按订单优先进片 |
| | | public void selectAll(Short glassid){ |
| | | SpianService service=new SpianService(); |
| | | service.selectAll(glassid); |
| | | service.selectAll(Short.toString(glassid)); |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.example.springboot.entity; |
| | | |
| | | public class CarPosition { |
| | | public int carid; |
| | | public int start; |
| | | public int end; |
| | | |
| | | public void setcarId(Integer carid) { |
| | | this.carid = carid; |
| | | } |
| | | |
| | | public Integer getcarId() { |
| | | return carid; |
| | | } |
| | | |
| | | public void setStart(Integer start) { |
| | | this.start = start; |
| | | } |
| | | |
| | | public Integer getStart() { |
| | | return start; |
| | | } |
| | | |
| | | public void setEnd(Integer end) { |
| | | this.end = end; |
| | | } |
| | | |
| | | public Integer getEnd() { |
| | | return end; |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import org.apache.ibatis.annotations.*; |
| | | |
| | | import com.example.springboot.entity.CarPosition; |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.entity.alarmmg; |
| | | |
| | |
| | | @Mapper |
| | | public interface HomeMapper { |
| | | //查询每个笼子的使用情况 |
| | | @Select("SELECT cage,ROUND(sum(case when state=1 or state=2 or state=3 then 1 else 0 end)/42*100) as cell,42-sum(case when state=1 or state=2 or state=3 then 1 else 0 end) as state FROM `storage_cage` group by cage") |
| | | @Select("select cage,round(100-(21-sum(state))/21*100) as cell,21-sum(state) as state from (select cage,cell,max(state) as state from storage_cage group by cage,cell) as cages group by cage") |
| | | List<StorageCage> selectAll(); |
| | | |
| | | // 查询1-5笼内层格子状态 |
| | | @Select("SELECT cage,state,glasswidth/width*2 as glasswidth from storage_cage where cage<=5 and tier=2") |
| | | @Select("SELECT cage,state,glasswidth/2750*2 as glasswidth from storage_cage where cage>5 and tier=2 order by cage desc,cell desc") |
| | | List<StorageCage> selectRack1(); |
| | | |
| | | // 查询6-10笼内层格子状态 |
| | | @Select("SELECT cage,state,glasswidth/width*2 as glasswidth from storage_cage where cage>5 and tier=2") |
| | | @Select("SELECT cage,state,glasswidth/2750*2 as glasswidth from storage_cage where cage<=5 and tier=2 order by cage desc,cell desc") |
| | | List<StorageCage> selectRack2(); |
| | | |
| | | // 查询1-5笼外层格子状态 |
| | | @Select("SELECT case when tier=1 then cage else 0 end as cage,case when tier=1 then state else 0 end as state,sum(case when tier=1 then glasswidth/width*2 else 0 end) as glasswidth,sum(case when tier=2 then glasswidth/width*2 else 0 end) as width from storage_cage where cage<=5 group by cell") |
| | | @Select("SELECT case when tier=1 then cage else 0 end as cage,case when tier=1 then state else 0 end as state,sum(case when tier=1 then glasswidth/2750*2 else 0 end) as glasswidth,sum(case when tier=2 then glasswidth/2750*2 else 0 end) as width from storage_cage where cage>5 group by cage,cell order by cage desc,cell desc") |
| | | List<StorageCage> selectRack3(); |
| | | |
| | | // 查询6-10笼外层格子状态 |
| | | @Select("SELECT case when tier=1 then cage else 0 end as cage,case when tier=1 then state else 0 end as state,sum(case when tier=1 then glasswidth/width*2 else 0 end) as glasswidth,sum(case when tier=2 then glasswidth/width*2 else 0 end) as width from storage_cage where cage>5 group by cell") |
| | | @Select("SELECT case when tier=1 then cage else 0 end as cage,case when tier=1 then state else 0 end as state,sum(case when tier=1 then glasswidth/2750*2 else 0 end) as glasswidth,sum(case when tier=2 then glasswidth/2750*2 else 0 end) as width from storage_cage where cage<=5 group by cage,cell order by cage desc,cell desc") |
| | | List<StorageCage> selectRack4(); |
| | | |
| | | // 根据任务类型查询当前正在出片,进片的玻璃信息 |
| | |
| | | @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); |
| | | |
| | | @Select("select * from car_position") |
| | | List<CarPosition> Loadcarlist(); |
| | | |
| | | } |
| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import javax.print.DocFlavor.STRING; |
| | | |
| | | @Mapper |
| | | |
| | | public interface SpianMapper { |
| | |
| | | void update(); |
| | | //获取玻璃信息 |
| | | @Select("select orderid,width from glass where glassid=#{glassid}") |
| | | Glass selectGlass(Short glassid); |
| | | Glass selectGlass(String 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 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") |
| | | @Select("select cage,cell,tier,glasswidth,ROUND(id/2)as prcId,id,glass_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.glass_id=#{glassid} and state=1 order by cage desc,tier desc,cell desc LIMIT 1") |
| | |
| | | |
| | | //修改笼子信息(进片) |
| | | @Update("update storage_cage set state=#{state},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); |
| | | void UpdataAddCage(Short orderid,String glassid,double width,int cage,int cell,int id,int state); |
| | | //修改同笼子格子宽度 |
| | | @Update("update storage_cage set width=width-#{width} where cage=#{cage} and cell=#{cell};") |
| | | void UpdataAddCage1(double width,int cage,int cell); |
| | | //修改同笼子格子宽度 |
| | | @Update("update storage_cage set state=#{state} where state=#{oldstate};") |
| | | void UpdataAddCageState(int state,int oldstate); |
| | | //修改同笼子格子宽度(出片) |
| | | @Update("update storage_cage set width=width+#{width} where cage=#{cage} and cell=#{cell};") |
| | | void UpdataOutCage1(double width,int cage,int cell); |
| | | //调拨更换笼子信息 |
| | | @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.state=1 where a.id=#{id1}") |
| | | @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.state=1,a.glasswidth=b.glasswidth 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); |
| | |
| | | //判断是否有调拨完后出片的任务 |
| | | @Select("select COUNT(*)as id,glass_id from storage_task where (task_type=1 or task_type=2) and task_state=0;") |
| | | Glass SelectDBOut(); |
| | | //根据笼子格子层数获取玻璃id |
| | | @Select("select glass_id from storage_cage where cage=#{cage} and cell=#{cell} and tier=2;") |
| | | String SelectGlassid(int cage,int cell); |
| | | //根据笼子格子层数获取玻璃id |
| | | @Select("SELECT COUNT(*) FROM `storage_cage` where state=3;") |
| | | Integer Selectoutstate(); |
| | | } |
| | | |
| | |
| | | package com.example.springboot.service; |
| | | |
| | | import java.lang.reflect.Array; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | import com.example.springboot.entity.Glass; |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.mapper.SpianMapper; |
| | | import com.google.common.primitives.Bytes; |
| | | |
| | | @Service |
| | | public class SpianService { |
| | |
| | | int cell = cageout.getCell();// 出片格号 |
| | | int tier = cageout.getTier();// 出片内外片 |
| | | int prcid = cageout.getPrcId();// prcid |
| | | String glassid=cageout.getGlassId(); |
| | | int prcid2; |
| | | int ids; |
| | | int cages; |
| | |
| | | datas.add((short) 1); |
| | | |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);//增加原格子宽度 |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);//清除格子玻璃信息 |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 3);//清除格子玻璃信息 |
| | | spianMapper.Inserttask(1, 0,cageout.getId(),1000,orderid);//新增任务 |
| | | S7control.getinstance().WriteWord(adddresslist, datas);//派发出片车任务 |
| | | outmesid(glassid);//派发出片ID |
| | | return Result.success(datas);//结束 |
| | | } else { |
| | | // 获取格子的玻璃数量 |
| | | int state = spianMapper.selectGlassState(cage, cell); |
| | | // 判断内片是否需要调拨 |
| | | if (state == 0) { |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0); |
| | | //spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0); |
| | | datas.add((short) prcid); |
| | | datas.add((short) 1000); |
| | | datas.add((short) 1); |
| | | datas.add((short) 1); |
| | | spianMapper.Inserttask(1, 0,cageout.getId(),1000,orderid);//新增任务 |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);//增加原格子宽度 |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);//清除格子玻璃信息 |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 3);//清除格子玻璃信息 |
| | | S7control.getinstance().WriteWord(adddresslist, datas);//派发出片车任务 |
| | | outmesid(glassid);//派发出片ID |
| | | //spianMapper.Updatetask(1, 1);//完成任务 |
| | | return Result.success(datas);//结束 |
| | | |
| | |
| | | prcid2 = cagecell.getPrcId();// 调拨目标位PRCID |
| | | ids = cagecell.getId();// 调拨目标位ID |
| | | cages=cagecell.getCage();//调拨目标位笼子 |
| | | cells=cagecell.getCell();//调拨目标位格子 |
| | | |
| | | |
| | | |
| | | cells=cagecell.getCell();//调拨目标位格子 |
| | | |
| | | // 填入调拨数据 |
| | | datas.add((short) prcid);// 调拨外片起始位置 |
| | |
| | | datas.add((short) 2); |
| | | datas.add((short) 1); |
| | | // 更换玻璃的笼子 |
| | | spianMapper.UpdataAddCage1(glasswidth, cages, cells);//减少新格子宽度 |
| | | String glassids=spianMapper.SelectGlassid(cage, cell); //获取被调拨的玻璃id |
| | | spianMapper.UpdateDBCage(ids, cage, cell);// 将原格子数据更新到新格子里 |
| | | spianMapper.UpdataAddCage1(glasswidth, cages, cells);//减少新格子宽度 |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);//增加原格子宽度 |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 0);// 清除被调拨格子数据 |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 3);// 清除被调拨格子数据 |
| | | spianMapper.Inserttask(2, 0,cageout.getId(),ids,orderid);//新增调度任务 |
| | | // 传输mes数据,坐标,数据 |
| | | S7control.getinstance().WriteWord(adddresslist, datas);//派发出片车任务 |
| | | S7control.getinstance().WriteWord(adddresslist, datas);//派发出片车任务 |
| | | System.out.println(datas); |
| | | outmesid(glassids);//派发调拨玻璃ID |
| | | return Result.success(cagecell); //结束 |
| | | |
| | | } else {// 笼子号大于5时 |
| | |
| | | datas.add((short) prcid2); |
| | | datas.add((short) 2); |
| | | datas.add((short) 1); |
| | | String glassids=spianMapper.SelectGlassid(cage, cell); //获取被调拨的玻璃id |
| | | spianMapper.UpdateDBCage(ids, cage, cell);// 将原格子数据更新到新格子里 |
| | | spianMapper.Inserttask(2, 0,cageout.getId(),ids,orderid);//新增调度任务 |
| | | spianMapper.UpdataAddCage1(glasswidth, cages, cells);//减少新格子宽度 |
| | | spianMapper.UpdateDBCage(ids, cage, cell);// 将原格子数据更新到新格子里 |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);//增加原格子宽度 |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 0);// 清除被调拨格子数据 |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 3);// 清除被调拨格子数据 |
| | | // 传输mes数据,坐标,数据 |
| | | S7control.getinstance().WriteWord(adddresslist, datas);//派发出片车任务 |
| | | S7control.getinstance().WriteWord(adddresslist, datas);//派发出片车任务 |
| | | |
| | | outmesid(glassids);//派发调拨玻璃ID |
| | | return Result.success(cagecell); //结束 |
| | | |
| | | } |
| | |
| | | // @GetMapping("/all") |
| | | // 进片任务,传订单id |
| | | // 按订单优先进片 |
| | | public Short selectAll(Short glassid) { |
| | | public Short selectAll(String glassid) { |
| | | |
| | | int cage1; |
| | | int cells; |
| | |
| | | datas.add((short) prctier); |
| | | datas.add((short) 1); |
| | | // 数据库修改笼子表新增一条玻璃 |
| | | spianMapper.UpdataAddCage(orderids, glassid, widths, cage1, cells, ids, 1); |
| | | spianMapper.UpdataAddCage(orderids, glassid, widths, cage1, cells, ids, 2); |
| | | spianMapper.UpdataAddCage1(widths, cage1, cells);//减少格子宽度 |
| | | spianMapper.Inserttask(0, 0, 1000, ids,glassid.toString());//新增任务 |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | |
| | | // S7control.getinstance().WriteByte("DB105.16",glassid); |
| | | return (200); |
| | | |
| | | } |
| | |
| | | datas.add((short) 1); |
| | | |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);//增加原格子宽度 |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);//清除格子玻璃信息 |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 3);//清除格子玻璃信息 |
| | | spianMapper.Inserttask(1, 0,cageout.getId(),1000,glassid);//新增任务 |
| | | //int state = spianMapper.selectGlassState(cage, cell);//获取格子数量 |
| | | if(state==2){ |
| | |
| | | spianMapper.UpdateDBCage2(cage, cell);// 清除内片数据 |
| | | } |
| | | S7control.getinstance().WriteWord(adddresslist, datas);//派发出片车任务 |
| | | |
| | | |
| | | outmesid(glassid);//派发出片ID |
| | | |
| | | |
| | | return (200);//结束 |
| | | } else { |
| | | // 获取格子的玻璃数量 |
| | | int state = spianMapper.selectGlassState(cage, cell); |
| | | // 判断内片是否需要调拨 |
| | | if (state == 0) { |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0); |
| | | //spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 3); |
| | | datas.add((short) prcid); |
| | | datas.add((short) 1000); |
| | | datas.add((short) 1); |
| | | datas.add((short) 1); |
| | | spianMapper.Inserttask(1, 0,cageout.getId(),1000 ,glassid);//新增任务 |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);//增加原格子宽度 |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);//清除格子玻璃信息 |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 3);//清除格子玻璃信息 |
| | | outmesid(glassid);//派发出片ID |
| | | S7control.getinstance().WriteWord(adddresslist, datas);//派发出片车任务 |
| | | //spianMapper.Updatetask(1, 1);//完成任务 |
| | | |
| | | |
| | | return (200);//结束 |
| | | |
| | | } else { |
| | |
| | | datas.add((short) 2); |
| | | datas.add((short) 1); |
| | | // 更换玻璃的笼子 |
| | | spianMapper.UpdataAddCage1(glasswidth, cages, cells);//减少新格子宽度 |
| | | String glassids=spianMapper.SelectGlassid(cage, cell); //获取被调拨的玻璃id |
| | | spianMapper.UpdateDBCage(ids, cage, cell);// 将原格子数据更新到新格子里 |
| | | spianMapper.UpdataAddCage1(glasswidth, cages, cells);//减少新格子宽度 |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);//增加原格子宽度 |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 0);// 清除被调拨格子数据 |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 3);// 清除被调拨格子数据 |
| | | spianMapper.Inserttask(2, 0,cageout.getId(),ids,glassid);//新增调度任务 |
| | | spianMapper.Inserttask(1, 0,cageout.getId(),1000,glassid);//新增出片任务 |
| | | // 传输mes数据,坐标,数据 |
| | | S7control.getinstance().WriteWord(adddresslist, datas);//派发出片车任务 |
| | | S7control.getinstance().WriteWord(adddresslist, datas);//派发出片车任务 |
| | | |
| | | outmesid(glassids);//派发调拨玻璃ID |
| | | return (200); //结束 |
| | | |
| | | } else {// 笼子号大于5时 |
| | |
| | | datas.add((short) prcid2); |
| | | datas.add((short) 2); |
| | | datas.add((short) 1); |
| | | String glassids=spianMapper.SelectGlassid(cage, cell); //获取被调拨的玻璃id |
| | | spianMapper.Inserttask(2, 0,cageout.getId()+1,ids,glassid);//新增调度任务 |
| | | spianMapper.Inserttask(1, 0,cageout.getId(),1000,glassid);//新增出片任务 |
| | | spianMapper.UpdateDBCage(ids, cage, cell);// 将原格子数据更新到新格子里 |
| | | spianMapper.UpdataAddCage1(glasswidth, cages, cells);//减少新格子宽度 |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);//增加原格子宽度 |
| | | spianMapper.UpdateDBCage(ids, cage, cell);// 将原格子数据更新到新格子里 |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 0);// 清除被调拨格子数据 |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 3);// 清除被调拨格子数据 |
| | | // 传输mes数据,坐标,数据 |
| | | S7control.getinstance().WriteWord(adddresslist, datas);//派发出片车任务 |
| | | S7control.getinstance().WriteWord(adddresslist, datas);//派发出片车任务 |
| | | |
| | | outmesid(glassids);//派发调拨玻璃ID |
| | | return (200);//结束 |
| | | |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | public void outmesid(String glassid) { |
| | | System.out.println("outmesid:"+glassid); |
| | | List<Byte> glassidlist=new ArrayList(); |
| | | for (char iditem : glassid.toCharArray()) { |
| | | glassidlist.add(Byte.valueOf(String.valueOf(iditem))); |
| | | } |
| | | byte[] bytes= Bytes.toArray(glassidlist); |
| | | System.out.println("outmesidbytes:"+bytes.length); |
| | | S7control.getinstance().WriteByte("DB105.30", bytes);//派发出片id |
| | | } |
| | | |
| | | /*** 修改用户* @throws SQLException */ |
| | | // public static int updateUser(Glass user) throws SQLException {conn = |
| | | // getConn(); |