Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
# Conflicts:
# springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
| | |
| | | })
|
| | | }
|
| | |
|
| | | export function CompleteQueue(id,frameid) {
|
| | | export function CompleteQueue(id,frameid,glassid) {
|
| | | return request({
|
| | | url: '/home/CompleteQueue?id=' + id+'&frameid='+frameid,
|
| | | url: '/home/CompleteQueue?id=' + id+'&frameid='+frameid+'&glassid='+glassid,
|
| | | method: 'post',
|
| | | data:""
|
| | | })
|
| | |
| | | "Unable to find whether the aluminum frame is flipped or not":"Unable to find whether the aluminum frame is flipped or not",
|
| | | "You do not have this permission":"You do not have this permission",
|
| | | "This glass is already in the Queue":"This glass is already in the Queue",
|
| | | "complete":"complete",
|
| | | "Complete":"Complete",
|
| | | "Not Allow":"Not Allow",
|
| | | "ServoManualone": {
|
| | | "A01 所在格子": "A01 Current Grid",
|
| | | "数量": "Quantity",
|
| | |
| | | "Unable to find the placement method of the aluminum frame":"查询不到铝框摆放方式",
|
| | | "Unable to find whether the aluminum frame is flipped or not":"查询不到铝框是否翻转",
|
| | | "This glass is already in the Queue":"此玻璃已在出片队列中",
|
| | | "complete":"完成",
|
| | | "Complete":"完成",
|
| | | "Not Allow":"不允许",
|
| | | "langparameter": {
|
| | | "conveyor Velocity(Auto FAST)": "D01-D06 皮带输送自动快速",
|
| | | "conveyor Velocity(Auto SLOW)": "D01-D06 皮带输送自动慢速",
|
| | |
| | | <el-table-column prop="barcode" :label="$t('Complete')">
|
| | | <template slot-scope='scope'>
|
| | | <el-button type="primary" style="padding: 4px 10px;font-size: 12px;" :disabled="!isAllowQueue"
|
| | | @click="CompleteQueue(scope.row.id,scope.row.barcode)">{{ $t('Complete') }}</el-button>
|
| | | @click="CompleteQueue(scope.row.id,scope.row.barcode,scope.row.glassId)">{{ $t('Complete') }}</el-button>
|
| | | </template>
|
| | | </el-table-column>
|
| | | <el-table-column :width="280" :label="$t('Operate')">
|
| | |
| | | created() {
|
| | | this.load();
|
| | | this.init();
|
| | | setInterval(() => {
|
| | | if(socket.readyState != 1){
|
| | | this.init();
|
| | | }
|
| | | }, 20000);
|
| | | }
|
| | | ,
|
| | | methods: {
|
| | |
| | | //打开事件
|
| | | socket.onopen = function () {
|
| | | console.log("websocket已打开");
|
| | | // setInterval(()=>{
|
| | | // if(socket){
|
| | | // if(socket.readyState==socket.OPEN){
|
| | | // socket.send('');
|
| | | // }
|
| | | // }
|
| | | // },5000);
|
| | | };
|
| | | // 浏览器端收消息,获得从服务端发送过来的文本消息
|
| | | socket.onmessage = function (msg) {
|
| | |
| | | this.form5 = {};
|
| | | },
|
| | | //手动完成出片任务
|
| | | CompleteQueue(id,frameid) {
|
| | | CompleteQueue(id,frameid).then(res => {
|
| | | CompleteQueue(id,frameid,glassid) {
|
| | | CompleteQueue(id,frameid,glassid).then(res => {
|
| | | if (res.data.message == 200) {
|
| | | this.$message.success(this.$t('Operation successful'));
|
| | | }
|
New file |
| | |
| | | package com.example.springboot.component; |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.example.springboot.service.JdbcConnections; |
| | | import com.example.springboot.service.SpianService; |
| | | import com.example.springboot.entity.north_glass_buffer1; |
| | | import com.example.springboot.mapper.AlarmMapper; |
| | | import com.example.springboot.mapper.SpianMapper; |
| | | |
| | | public class PlcHold extends Thread { |
| | | |
| | | private AlarmMapper alarmMapper; |
| | | |
| | | @Autowired |
| | | private JdbcConnections jdbcConnections; |
| | | private SpianMapper spianMapper; |
| | | private SpianService spianService; |
| | | |
| | | @Override |
| | | public void run() { |
| | | boolean inglassbegin = false; |
| | | boolean outglassbegin = false; |
| | | while (this != null) { |
| | | try { |
| | | |
| | | Thread.sleep(1000); |
| | | } catch (InterruptedException e) { |
| | | // \\ TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | spianService = WebSocketServer.applicationContext.getBean(SpianService.class); |
| | | spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class); |
| | | jdbcConnections = WebSocketServer.applicationContext.getBean(JdbcConnections.class); |
| | | // 根据玻璃id获取订单号,单独数据源 |
| | | // try { |
| | | // north_glass_buffer1 glass = jdbcConnections.selectGlass(112); |
| | | // // System.out.println(glass.getOrderId()); |
| | | // } catch (SQLException e) { |
| | | // // TODO Auto-generated catch block |
| | | // e.printStackTrace(); |
| | | // } |
| | | //spianService.selectAll("X12345610102GV"); |
| | | 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.16", 1);// 获取进片车任务是否启动 |
| | | |
| | | boolean B01backs = spianService.listbool("DB106.60");// b01汇报 |
| | | boolean B02backs = spianService.listbool("DB106.62");// b02汇报 |
| | | StringBuilder B01glassid = spianService.queGlassid("DB103.184", 14);// BO1的玻璃id |
| | | StringBuilder B02glassid = spianService.queGlassid("DB103.212", 14);// B02的玻璃id |
| | | // 当进片小车完成任务时 |
| | | if (B01backs == true) { |
| | | // 当B01小车汇报完成时更改玻璃状态 为1 |
| | | spianMapper.UpdateCageOver(B01glassid.toString(), 1);// 更改笼子表进片状态 |
| | | spianMapper.Updatetask(1, 0);// 更改进片任务状态为1 |
| | | spianMapper.UpdatetaskOut(B01glassid.toString()); // 完成上一次出片或者进片任务 |
| | | spianMapper.OverOutSlice(B01glassid.toString(), 2);// 完成出片队列任务 |
| | | spianMapper.UpdataGlassCage(B01glassid.toString(),0);// 清除出片格子玻璃信息 |
| | | S7control.getinstance().WriteWord("DB106.60", (short) 0);// 恢复B01小车应答改为0 |
| | | System.out.println("汇报时B01|" + B01glassid); |
| | | |
| | | // S7control.getinstance().WriteWord("DB105.48", (short) 1);//汇报B01小车收到 |
| | | } |
| | | |
| | | // 当出片小车完成任务时 |
| | | if (B02backs == true) { |
| | | // 当B02小车汇报完成时更改玻璃状态为0 |
| | | spianMapper.UpdateCageOver(B02glassid.toString(), 0);// 更改笼子表出片状态 |
| | | spianMapper.UpdatetaskOut(B02glassid.toString()); // 完成上一次出片或者进片任务 |
| | | spianMapper.OverOutSlice(B02glassid.toString(), 2);// 完成出片队列任务 |
| | | spianMapper.UpdataGlassCage(B01glassid.toString(),0);// 清除出片格子玻璃信息 |
| | | S7control.getinstance().WriteWord("DB106.62", (short) 0);// 恢复B02小车应答改为0 |
| | | // S7control.getinstance().WriteWord("DB105.50", (short) 1);//汇报B02小车收到 |
| | | System.out.println("汇报时B02|" + B02glassid); |
| | | } |
| | | |
| | | // 获取DO1数据 |
| | | StringBuilder queueid1 = spianService.queGlassid("DB106.26", 14);// 获取请求的id跟DO1同时清 |
| | | // 获取DO2数据 |
| | | StringBuilder queueid2 = spianService.queGlassid("DB103.58", 14); |
| | | // System.out.println("D01|" + queueid1); |
| | | // System.out.println("D02|" + queueid2); |
| | | |
| | | int questate = spianMapper.Selectquecount(queueid1.toString());// 判断扫码位是否有玻璃已确认 |
| | | // queueid1.toString().isEmpty() |
| | | north_glass_buffer1 glass1 = spianMapper.selectGlass(queueid1.toString());// D01的玻璃信息 |
| | | north_glass_buffer1 glass2 = spianMapper.selectGlass(queueid2.toString());// D02玻璃信息 |
| | | // 当扫码位玻璃id为空时 宽度为0 |
| | | |
| | | if (queueid1 != null && questate == 0) { |
| | | // 写入D01的数据到上片队列表 |
| | | if (glass1 == null) { // 当没有值时传空 |
| | | spianMapper.Updatequeue(null, null, null, null, 0, null, null, null, null, 1); |
| | | } else { |
| | | |
| | | spianMapper.Updatequeue(queueid1.toString(), glass1.getordernumber(), glass1.getlistnumber(), |
| | | glass1.getboxnumber(), 0, glass1.getglasslengthmm().toString(), glass1.getglassheightmm().toString(), |
| | | glass1.getglasslength().toString(), glass1.getglassheight().toString(), 1); |
| | | } |
| | | |
| | | } |
| | | if (queueid2 != null) { |
| | | // 写入D02的数据到上片队列表 |
| | | if (glass2 == null) { |
| | | spianMapper.Updatequeue(null, null, null, null, 0, null, null, null, null, 2); |
| | | } else { |
| | | spianMapper.Updatequeue(queueid2.toString(), glass2.getordernumber(), glass2.getlistnumber(), |
| | | glass2.getboxnumber(), 0, glass2.getglasslengthmm().toString(), glass2.getglassheightmm().toString(), |
| | | glass2.getglasslength().toString(), glass2.getglassheight().toString(), 2); |
| | | spianMapper.overqueue2(queueid2.toString(), 0, 1);// 更改扫码位任务表的状态为0 |
| | | S7control.getinstance().WriteWord("DB105.16", (short) 0);// 关闭任务启动 |
| | | } |
| | | |
| | | } |
| | | |
| | | // 出片任务//////////////////////////////// |
| | | List<Short> outlist = S7control.getinstance().ReadWord("DB106.20", 1); // 出片车状态 |
| | | List<Short> outlist1 = S7control.getinstance().ReadWord("DB105.18", 1); // 出片任务是否启动 |
| | | // StringBuilder writedstrIdOut = new StringBuilder(); |
| | | // 获取已下发的出片id |
| | | byte[] writedglassidbytesOut = S7control.getinstance().ReadByte("DB105.30", 14); |
| | | String writedstrIdOut = new String(writedglassidbytesOut); |
| | | |
| | | boolean outstate = false;// 出片车空闲判断 |
| | | boolean outstate1 = false;// 出片车任务是否启动 |
| | | if (outlist != null && outlist1 != null) { |
| | | // 判断按订单出片 |
| | | outstate = outlist.contains((short) 0);// 出片车空闲判断 当出片车空闲时为true |
| | | outstate1 = outlist1.contains((short) 1);// 出片车任务是否启动 当出片车任务启动时为true |
| | | |
| | | north_glass_buffer1 glass = spianMapper.SelectDBOut();// 判断是否有调拨后的出片任务未完成 |
| | | |
| | | if (!outglassbegin & !outstate)// 当任务还未开始,且出片车不空闲时,任务状态改为开始 |
| | | { |
| | | outglassbegin = true; |
| | | } |
| | | if (outglassbegin & outstate)// 当任务开始且出片车空闲时 |
| | | { |
| | | outglassbegin = false; |
| | | } |
| | | |
| | | if (outstate == true & glass.getbarcode() != null&&Plchome.isAllowQueue==true) { // 当出片车空闲且有出片任务待完成时 |
| | | // 判断有两个出片或调拨任务时并且出片id和未完成的出片任务id不一样时执行出片 |
| | | if (!writedstrIdOut.toString().equals(glass.getbarcode().toString())) { |
| | | spianService.selectout2(glass.getbarcode().toString()); |
| | | outstate = false; |
| | | } |
| | | } |
| | | // 判断当前是否有未执行的任务 |
| | | int outnum = spianMapper.SelectOutSliceshu(); |
| | | // 当没有任务执行并且出片车空闲时 |
| | | if (outnum == 0 && outstate == true&&Plchome.isAllowQueue==true) { |
| | | // 判断铝框出片队列表是否有待出片的玻璃 |
| | | String outglassid = spianMapper.SelectOutSlice(); |
| | | if (outglassid != null) { |
| | | |
| | | spianService.selectout2(outglassid); |
| | | outstate = false; |
| | | } |
| | | } |
| | | if (outstate == true) {// 当出片车空闲时,且出片启动为1时,任务启动改为0 |
| | | if (outstate1 == true) { |
| | | S7control.getinstance().WriteWord("DB105.18", (short) 0);// 出片任务启动改为0 |
| | | } |
| | | } |
| | | } |
| | | |
| | | // if (outstate == true) { // 出片车状态空闲时 |
| | | // Integer state = spianMapper.Selectoutstate(); |
| | | // String orderid = spianMapper.SelectOrderout(); |
| | | |
| | | // if (orderid != null && state == 0) { |
| | | // spianService.selectout(orderid); |
| | | // } |
| | | // } |
| | | |
| | | // 查询数据库 |
| | | // 推送到前端 |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import com.example.springboot.service.OutSliceServive; |
| | | import com.example.springboot.service.SpianService; |
| | | |
| | | |
| | | public class Plchome extends Thread { |
| | | |
| | | @Autowired |
| | |
| | | private SpianService spianService; |
| | | private North_Glass_Buffer1Service north_Glass_Buffer1Service; |
| | | private JdbcConnections dbserve; |
| | | //出片队列是否允许出片 |
| | | public static Boolean isAllowQueue=true; |
| | | //铝框id |
| | | // 出片队列是否允许出片 |
| | | public static Boolean isAllowQueue = true; |
| | | // 铝框id |
| | | public static String FrameNo; |
| | | //是否需要手动确认玻璃 |
| | | public static Boolean isConfirm=false; |
| | | // 是否需要手动确认玻璃 |
| | | public static Boolean isConfirm = false; |
| | | |
| | | // public static Map b=new HashMap<>(); |
| | | // b.put() |
| | | @Override |
| | |
| | | // 查询报警信息 |
| | | List<alarmmg> alarmmg = homeMapper.SelectAlarmmgInfo(); |
| | | jsonObject.append("alarmmg", alarmmg); |
| | | // 读去Plc进片车与出片车位置W |
| | | List<String> addressList = new ArrayList<String>(); |
| | | addressList.add("DB106.12"); |
| | | addressList.add("DB106.0"); |
| | | List<Short> paramlist = S7control.getinstance().ReadWord(addressList); |
| | | if (paramlist != null) { |
| | | jsonObject.append("params", paramlist); |
| | | } |
| | | // // 获取进片车状态 |
| | | // List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8", |
| | | // 1);// 获取进片车状态 |
| | | // boolean exist1 = datas1ListState.contains((short) 0); |
| | | // jsonObject.append("zhuangtai", exist1); |
| | | //获取进片玻璃信息 |
| | | List<Short> inglassInfo = S7control.getinstance().ReadWord("DB106.24", 1); |
| | | if (inglassInfo != null) { |
| | | if (inglassInfo.size() > 0) |
| | | jsonObject.append("loadglassheight", inglassInfo.get(0) * 70); |
| | | } |
| | | |
| | | // // 读去Plc进片车与出片车位置W |
| | | // List<String> addressList = new ArrayList<String>(); |
| | | // addressList.add("DB106.12"); |
| | | // addressList.add("DB106.0"); |
| | | // List<Short> paramlist = S7control.getinstance().ReadWord(addressList); |
| | | // if (paramlist != null) { |
| | | // jsonObject.append("params", paramlist); |
| | | // } |
| | | // // 获取进片车状态 |
| | | // List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8", |
| | | // 1);// 获取进片车状态 |
| | | // boolean exist1 = datas1ListState.contains((short) 0); |
| | | // jsonObject.append("zhuangtai", exist1); |
| | | // // 获取进片玻璃信息 |
| | | // List<Short> inglassInfo = S7control.getinstance().ReadWord("DB106.24", 1); |
| | | // if (inglassInfo != null) { |
| | | // if (inglassInfo.size() > 0) |
| | | // jsonObject.append("loadglassheight", inglassInfo.get(0) * 70); |
| | | // } |
| | | |
| | | // 伍 获取进是否有待确认的玻璃id |
| | | String queid = spianMapper.Selectqueueid(); |
| | | int state = spianMapper.Selectqueuestate(); |
| | |
| | | // 获取扫码位与上片位玻璃信息 |
| | | Queue form2 = homeMapper.GetQueueInfo(2); |
| | | Queue form3 = homeMapper.GetQueueInfo(1); |
| | | if(form2.getglassId()!=null&&form2.getglassId()!=""){ |
| | | if (form2.getglassId() != null && form2.getglassId() != "") { |
| | | jsonObject.append("form2", form2); |
| | | } |
| | | if(form3.getglassId()!=null&&form3.getglassId()!=""){ |
| | | if (form3.getglassId() != null && form3.getglassId() != "") { |
| | | jsonObject.append("form3", form3); |
| | | } |
| | | // 获取出片队列信息 |
| | | List<Out_slice> listoutslice=outSliceServive.SelectProductionqueue(); |
| | | List<Out_slice> listoutslice = outSliceServive.SelectProductionqueue(); |
| | | // List<Out_slice> listoutslice = homeMapper.SelectProductionqueue(); |
| | | // for (Out_slice out_slice : listoutslice) { |
| | | // out_slice.setstorageCage(homeMapper.SelectStorageGlassById(out_slice.getGlassId())); |
| | | // out_slice.setstorageCage(homeMapper.SelectStorageGlassById(out_slice.getGlassId())); |
| | | // } |
| | | jsonObject.append("listoutslice", listoutslice); |
| | | //获取当前出片队列状态 |
| | | jsonObject.append("isAllowQueue",Plchome.isAllowQueue); |
| | | // 获取当前出片队列状态 |
| | | jsonObject.append("isAllowQueue", Plchome.isAllowQueue); |
| | | |
| | | //获取铝框idDB106.DBW64 |
| | | // // 获取铝框idDB106.DBW64 |
| | | // String frameno=spianService.queGlassid("DB106.24",14).toString(); |
| | | // if(frameno!=Plchome.FrameNo){ |
| | | // Plchome.FrameNo=frameno; |
| | | // Plchome.FrameNo=frameno; |
| | | // } |
| | | // Plchome.FrameNo="123"; |
| | | // try { |
| | | // north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo); |
| | | // north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo); |
| | | // } catch (SQLException e) { |
| | | // // TODO Auto-generated catch block |
| | | // e.printStackTrace(); |
| | | // // TODO Auto-generated catch block |
| | | // e.printStackTrace(); |
| | | // } |
| | | //是否需要人工确认上片玻璃 |
| | | // 是否需要人工确认上片玻璃 |
| | | jsonObject.append("isConfirm", isConfirm); |
| | | |
| | | //铝框线交互 |
| | | // 铝框线交互 |
| | | |
| | | // //铝框id请求字 |
| | | // List<Short> framerequest = S7control.getinstance().ReadWord("铝框id请求字地址", 1); |
| | | // if(framerequest!=null){ |
| | | // //铝框id |
| | | // String franmeno= spianService.queGlassid("铝框id地址", 14).toString(); |
| | | // String position; |
| | | // try { |
| | | // position=dbserve.SelectPositionByFrameBarcode(franmeno); |
| | | // } catch (SQLException e) { |
| | | // // TODO Auto-generated catch block |
| | | // position="0"; |
| | | // e.printStackTrace(); |
| | | // } |
| | | // Short send; |
| | | // if(position=="0"){ |
| | | // send=0; |
| | | // }else{ |
| | | // send=1; |
| | | // } |
| | | // S7control.getinstance().WriteWord("铝框翻转发送地址", (short)send); |
| | | // //铝框id |
| | | // String franmeno= spianService.queGlassid("铝框id地址", 14).toString(); |
| | | // String position; |
| | | // try { |
| | | // position=dbserve.SelectPositionByFrameBarcode(franmeno); |
| | | // } catch (SQLException e) { |
| | | // // TODO Auto-generated catch block |
| | | // position="0"; |
| | | // e.printStackTrace(); |
| | | // } |
| | | |
| | | // Short send; |
| | | // if(position=="0"){ |
| | | // send=0; |
| | | // }else{ |
| | | // send=1; |
| | | // } |
| | | // S7control.getinstance().WriteWord("铝框翻转发送地址", (short)send); |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class); |
| | | boolean dbconnected = false; |
| | | try { |
| | |
| | | jsonObject.append("dbconnected", dbconnected); |
| | | // jsonObject.append("params", new short[] { 30, 40, }); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Home"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | } |
| | | } |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | //new PlcHold().start(); |
| | | // |
| | | // |
| | | // new Plchome().start(); |
| | | new Plchome().start(); |
| | | //// // |
| | | // new PlcParameter().start(); |
| | | // // |
| | |
| | | // new Plcstate().start(); |
| | | // new PlcPositioning1().start(); |
| | | // new PlcPositioning2().start(); |
| | | // new PlcParameter2().start(); |
| | | // new PlcParameter2().start(); |
| | | // new PlcParameter1().start(); |
| | | // new PLCAutomaticParameterSetting().start(); |
| | | // |
| | | // new PlcManualonePosition().start(); |
| | | // new PlcManualonePosition2().start(); |
| | | new PlcServoManualone().start(); |
| | | // new PlcServoManualone().start(); |
| | | // new PLCManualJog().start(); |
| | | } |
| | | } |
| | |
| | | @GetMapping("/UpdateTask") |
| | | public Result UpdateTask(Integer types, Integer shelfrack, String glassid) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | homeMapper.UpdateTask(types); |
| | | homeMapper.UpdateTask(types,glassid); |
| | | StorageCage glass = homeMapper.SelectGlassInfo(glassid); |
| | | if (types == 0) { |
| | | homeMapper.UpdateCageTask1(glassid); |
| | |
| | | |
| | | //手动完成任务 |
| | | @PostMapping("/CompleteQueue") |
| | | public Result CompleteQueue(String id,String frameid) { |
| | | return outSliceServive.CompleteQueue(id,frameid); |
| | | public Result CompleteQueue(String id,String frameid,String glassid) { |
| | | return outSliceServive.CompleteQueue(id,frameid,glassid); |
| | | |
| | | } |
| | | |
| | |
| | | private String cataskStatege; |
| | | private String shelfRack;//起始位 |
| | | private String loadrack;//目标位 |
| | | private Integer count;//玻璃数量 |
| | | |
| | | |
| | | public Integer id() { |
| | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public Integer getCount() { |
| | | return count; |
| | | } |
| | | |
| | | public void setCount(Integer count) { |
| | | this.count = count; |
| | | } |
| | | |
| | | public String getTaskType() { |
| | | return taskType; |
| | | } |
| | |
| | | short SelectInTask(); |
| | | |
| | | // 手动完成任务 |
| | | @Update("update storage_task set task_state=1 where task_type=#{task_type} and task_state=0") |
| | | void UpdateTask(@Param("task_type") Integer task_type); |
| | | @Update("update storage_task set task_state=1 where task_type=#{task_type} and task_state=0 and glass_id=#{glassid}") |
| | | void UpdateTask(@Param("task_type") Integer task_type,String glassid); |
| | | |
| | | // 手动完成进片任务修改笼子数据 |
| | | @Update("update storage_cage set state=1 where glass_id=#{glassid} and state=2") |
| | |
| | | |
| | | //@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;") |
| | | //获取订单号排序的空订单笼子 |
| | | @Select("select a.cage,COUNT(if(a.order_id=#{orderids},a.order_id,null))as orderid,b.shu,c.shu2,a.cell,min(a.state)as state1 from storage_cage a left join (select COUNT(*)shu,cage from storage_cage where order_id=#{orderids} GROUP BY cage)as b on a.cage=b.cage left join(select cage ,COUNT(glass_id)as shu2 from storage_cage GROUP BY cage)c on a.cage=c.cage where (order_id=#{orderids} or ''='') GROUP BY cage,cell HAVING state1=0 ORDER BY shu desc,shu2,cage asc; ") |
| | | @Select("select a.cage,COUNT(if(a.order_id=#{orderids},a.order_id,null))as orderid,b.shu,c.shu2,a.cell,min(a.state)as state1,disabled from storage_cage a left join (select COUNT(*)shu,cage from storage_cage where order_id=#{orderids} GROUP BY cage)as b on a.cage=b.cage left join(select cage ,COUNT(glass_id)as shu2 from storage_cage GROUP BY cage)c on a.cage=c.cage where (order_id=#{orderids} or ''='') GROUP BY cage,cell HAVING state1=0 ORDER BY shu desc,shu2,cage asc; ") |
| | | List<StorageCage> selectAll(String orderids); |
| | | //获取判断该格子是否需要把外片推入内片位置 |
| | | @Select("select state from storage_cage where cage=#{cage} and cell=#{cell} and tier=1;") |
| | |
| | | // @Insert("insert into user(name, date, address, user_no) values (#{name}, #{date}, #{address}, #{userNo})") |
| | | // void insert (Spian spian); |
| | | //新增任务表 |
| | | @Insert("INSERT INTO `canadames`.`storage_task`(`task_type`, `task_state`, `shelf_rack`, `load_rack`,start_time,glass_id) VALUES (#{tasktype},#{taskstate},#{shelfrack},#{loadrack},now(),#{glassid});") |
| | | void Inserttask(int tasktype,int taskstate,int shelfrack,int loadrack,String glassid); |
| | | @Insert("INSERT INTO `canadames`.`storage_task`(`task_type`, `task_state`, `shelf_rack`, `load_rack`,start_time,glass_id,count) VALUES (#{tasktype},#{taskstate},#{shelfrack},#{loadrack},now(),#{glassid},#{count});") |
| | | void Inserttask(int tasktype,int taskstate,int shelfrack,int loadrack,String glassid,int count); |
| | | //修改任务表 |
| | | @Update("update storage_task set task_state=#{state} where task_type=#{type} and task_state=0;") |
| | | void Updatetask(int state,int type); |
| | |
| | | import java.util.Map; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoProperties.Storage; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.example.springboot.common.Result; |
| | | import com.example.springboot.component.S7control; |
| | | import com.example.springboot.entity.Out_slice; |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.mapper.HomeMapper; |
| | | import com.example.springboot.mapper.SpianMapper; |
| | | |
| | | @Service |
| | | public class OutSliceServive { |
| | | |
| | | @Autowired |
| | | private HomeMapper homeMapper; |
| | | @Autowired |
| | | private SpianMapper spianMapper; |
| | | |
| | | @Autowired |
| | | private JdbcConnections jdbcConnections; |
| | |
| | | return listoutslice; |
| | | } |
| | | |
| | | public Result CompleteQueue(String id, String frameid) { |
| | | homeMapper.CompleteQueue(id); |
| | | Short num=homeMapper.SelectCountByFrameNo(frameid); |
| | | if(num==0){ |
| | | homeMapper.CompleteQueueByFrameNo(frameid); |
| | | public Result CompleteQueue(String id, String frameid, String glassid) { |
| | | homeMapper.CompleteQueue(id); |
| | | Short num = homeMapper.SelectCountByFrameNo(frameid); |
| | | if (num == 0) { |
| | | homeMapper.CompleteQueueByFrameNo(frameid); |
| | | } |
| | | StorageCage storageCage = homeMapper.SelectGlassInfo(glassid); |
| | | spianMapper.UpdataOutCage1(storageCage.getGlassWidth(), storageCage.getCage(), storageCage.getCell()); |
| | | |
| | | homeMapper.UpdateCageTask2(glassid); |
| | | S7control.getinstance().WriteWord("DB105.12", (short) 0); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | // 判断选中笼子是否有合适宽度空格 |
| | | // 有合适空格时进片 |
| | | if (cages1 != null && cages >= 1) { |
| | | if (cages1 != null && cages >= 1&&storageCage2.getDisabled()==0) { |
| | | ids = cages1.getId();// 数据库ID |
| | | tiers = cages1.getTier();// 内外片 |
| | | cells = cages1.getCell();// 格子号 |
| | |
| | | //spianMapper.UpdataAddCage(orderids, glassid, widths, cage1, cells, ids-1, 2); |
| | | spianMapper.UpdataAddCage2(orderids, glassid, glasslist, cage1,cells, ids-1, 2); |
| | | spianMapper.UpdataAddCage1(widths, cage1, cells);// 减少格子宽度 |
| | | spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString());// 新增任务 |
| | | spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString(),prctier);// 新增任务 |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | System.out.println("汇报时任务|" + datas); |
| | | |
| | |
| | | //spianMapper.UpdataAddCage(orderids, glassid, widths, cage1, cells, ids, 2); |
| | | spianMapper.UpdataAddCage2(orderids, glassid, glasslist, cage1,cells, ids, 2); |
| | | spianMapper.UpdataAddCage1(widths, cage1, cells);// 减少格子宽度 |
| | | spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString());// 新增任务 |
| | | spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString(),prctier);// 新增任务 |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | System.out.println("汇报时任务|" + datas); |
| | | |
| | |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度 |
| | | spianMapper.UpdataGlassCageState(glassid,3);//更改笼子表的玻璃状态 |
| | | |
| | | spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid);// 新增任务 |
| | | spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid,state);// 新增任务 |
| | | // int state = spianMapper.selectGlassState(cage, cell);//获取格子数量 |
| | | if (state == 2) { |
| | | spianMapper.UpdateDBCage1(cage, cell);// 将内片数据更新到外片里 |
| | |
| | | datas.add((short) 1); |
| | | datas.add((short) 1); |
| | | spianMapper.OverOutSlice(glassid, 1);//更新出片队列任务状态为进行中 |
| | | spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid);// 新增任务 |
| | | spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid,1);// 新增任务 |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度 |
| | | spianMapper.UpdataGlassCageState(glassid,3);//更改笼子表的玻璃状态 |
| | | spianMapper.OverOutSlice(glassid,2);//完成出片队列任务 |
| | |
| | | spianMapper.UpdataAddCage1(glasswidth, cages, cells);// 减少新格子宽度 |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度 |
| | | spianMapper.UpdataGlassCageState(glassids,3);//更改笼子表的玻璃状态 |
| | | spianMapper.Inserttask(2, 0, cageout.getId(), ids, glassid);// 新增调度任务 |
| | | spianMapper.Inserttask(2, 0, cageout.getId(), ids, glassid,2);// 新增调度任务 |
| | | //spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid);// 新增出片任务 |
| | | // 传输mes数据,坐标,数据 |
| | | S7control.getinstance().WriteWord(adddresslist, datas);// 派发出片车任务 |
| | |
| | | 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(2, 0, cageout.getId() + 1, ids, glassid,2);// 新增调度任务 |
| | | //spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid);// 新增出片任务 |
| | | spianMapper.UpdateDBCage(ids, cage, cell,2);// 将原格子数据更新到新格子里 |
| | | spianMapper.UpdataAddCage1(glasswidth, cages, cells);// 减少新格子宽度 |